diff options
497 files changed, 9195 insertions, 6504 deletions
diff --git a/.gitignore b/.gitignore index cc5c822e69..9096ff228a 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,7 @@ local.properties .idea .gradletasknamecache project.properties +platform/android/java/lib/.cxx/ platform/android/java/libs/* platform/android/java/app/libs/* diff --git a/.travis.yml b/.travis.yml index 8b58e12563..14ee95e77e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -129,9 +129,6 @@ matrix: before_install: - eval "${MATRIX_EVAL}" - - if [ "$STATIC_CHECKS" = "yes" ]; then - unset SCONS_CACHE; - fi install: - if [ "$TRAVIS_OS_NAME" = "linux" ]; then @@ -150,6 +147,10 @@ install: ./emsdk/emsdk install latest; ./emsdk/emsdk activate latest; fi + - if [ "$STATIC_CHECKS" = "yes" ]; then + unset SCONS_CACHE; + pip3 install --user black pygments; + fi before_script: - if [ "$PLATFORM" = "android" ]; then @@ -160,6 +161,7 @@ before_script: script: - if [ "$STATIC_CHECKS" = "yes" ]; then sh ./misc/travis/clang-format.sh && + sh ./misc/travis/black-format.sh && doc/tools/makerst.py --dry-run doc/classes modules; else scons -j2 CC=$CC CXX=$CXX platform=$PLATFORM tools=$TOOLS target=$TARGET $OPTIONS $EXTRA_ARGS && diff --git a/SConstruct b/SConstruct index 2a52529539..8fc333a8fa 100644 --- a/SConstruct +++ b/SConstruct @@ -26,48 +26,48 @@ platform_exporters = [] platform_apis = [] for x in sorted(glob.glob("platform/*")): - if (not os.path.isdir(x) or not os.path.exists(x + "/detect.py")): + if not os.path.isdir(x) or not os.path.exists(x + "/detect.py"): continue tmppath = "./" + x sys.path.insert(0, tmppath) import detect - if (os.path.exists(x + "/export/export.cpp")): + if os.path.exists(x + "/export/export.cpp"): platform_exporters.append(x[9:]) - if (os.path.exists(x + "/api/api.cpp")): + if os.path.exists(x + "/api/api.cpp"): platform_apis.append(x[9:]) - if (detect.is_active()): + if detect.is_active(): active_platforms.append(detect.get_name()) active_platform_ids.append(x) - if (detect.can_build()): + if detect.can_build(): x = x.replace("platform/", "") # rest of world x = x.replace("platform\\", "") # win32 platform_list += [x] platform_opts[x] = detect.get_opts() platform_flags[x] = detect.get_flags() sys.path.remove(tmppath) - sys.modules.pop('detect') + sys.modules.pop("detect") module_list = methods.detect_modules() methods.save_active_platforms(active_platforms, active_platform_ids) -custom_tools = ['default'] +custom_tools = ["default"] platform_arg = ARGUMENTS.get("platform", ARGUMENTS.get("p", False)) if os.name == "nt" and (platform_arg == "android" or ARGUMENTS.get("use_mingw", False)): - custom_tools = ['mingw'] -elif platform_arg == 'javascript': + custom_tools = ["mingw"] +elif platform_arg == "javascript": # Use generic POSIX build toolchain for Emscripten. - custom_tools = ['cc', 'c++', 'ar', 'link', 'textfile', 'zip'] + custom_tools = ["cc", "c++", "ar", "link", "textfile", "zip"] env_base = Environment(tools=custom_tools) -if 'TERM' in os.environ: - env_base['ENV']['TERM'] = os.environ['TERM'] -env_base.AppendENVPath('PATH', os.getenv('PATH')) -env_base.AppendENVPath('PKG_CONFIG_PATH', os.getenv('PKG_CONFIG_PATH')) +if "TERM" in os.environ: + env_base["ENV"]["TERM"] = os.environ["TERM"] +env_base.AppendENVPath("PATH", os.getenv("PATH")) +env_base.AppendENVPath("PKG_CONFIG_PATH", os.getenv("PKG_CONFIG_PATH")) env_base.disabled_modules = [] env_base.use_ptrcall = False env_base.module_version_string = "" @@ -94,7 +94,7 @@ env_base.SConsignFile(".sconsign{0}.dblite".format(pickle.HIGHEST_PROTOCOL)) # Build options -customs = ['custom.py'] +customs = ["custom.py"] profile = ARGUMENTS.get("profile", False) if profile: @@ -106,62 +106,62 @@ if profile: opts = Variables(customs, ARGUMENTS) # Target build options -opts.Add('arch', "Platform-dependent architecture (arm/arm64/x86/x64/mips/...)", '') -opts.Add(EnumVariable('bits', "Target platform bits", 'default', ('default', '32', '64'))) -opts.Add('p', "Platform (alias for 'platform')", '') -opts.Add('platform', "Target platform (%s)" % ('|'.join(platform_list), ), '') -opts.Add(EnumVariable('target', "Compilation target", 'debug', ('debug', 'release_debug', 'release'))) -opts.Add(EnumVariable('optimize', "Optimization type", 'speed', ('speed', 'size'))) +opts.Add("arch", "Platform-dependent architecture (arm/arm64/x86/x64/mips/...)", "") +opts.Add(EnumVariable("bits", "Target platform bits", "default", ("default", "32", "64"))) +opts.Add("p", "Platform (alias for 'platform')", "") +opts.Add("platform", "Target platform (%s)" % ("|".join(platform_list),), "") +opts.Add(EnumVariable("target", "Compilation target", "debug", ("debug", "release_debug", "release"))) +opts.Add(EnumVariable("optimize", "Optimization type", "speed", ("speed", "size"))) -opts.Add(BoolVariable('tools', "Build the tools (a.k.a. the Godot editor)", True)) -opts.Add(BoolVariable('use_lto', 'Use link-time optimization', False)) -opts.Add(BoolVariable('use_precise_math_checks', 'Math checks use very precise epsilon (useful to debug the engine)', False)) +opts.Add(BoolVariable("tools", "Build the tools (a.k.a. the Godot editor)", True)) +opts.Add(BoolVariable("use_lto", "Use link-time optimization", False)) +opts.Add(BoolVariable("use_precise_math_checks", "Math checks use very precise epsilon (debug option)", False)) # Components -opts.Add(BoolVariable('deprecated', "Enable deprecated features", True)) -opts.Add(BoolVariable('minizip', "Enable ZIP archive support using minizip", True)) -opts.Add(BoolVariable('xaudio2', "Enable the XAudio2 audio driver", False)) +opts.Add(BoolVariable("deprecated", "Enable deprecated features", True)) +opts.Add(BoolVariable("minizip", "Enable ZIP archive support using minizip", True)) +opts.Add(BoolVariable("xaudio2", "Enable the XAudio2 audio driver", False)) # Advanced options -opts.Add(BoolVariable('verbose', "Enable verbose output for the compilation", False)) -opts.Add(BoolVariable('progress', "Show a progress indicator during compilation", True)) -opts.Add(EnumVariable('warnings', "Set the level of warnings emitted during compilation", 'all', ('extra', 'all', 'moderate', 'no'))) -opts.Add(BoolVariable('werror', "Treat compiler warnings as errors. Depends on the level of warnings set with 'warnings'", False)) -opts.Add(BoolVariable('dev', "If yes, alias for verbose=yes warnings=extra werror=yes", False)) -opts.Add('extra_suffix', "Custom extra suffix added to the base filename of all generated binary files", '') -opts.Add(BoolVariable('vsproj', "Generate a Visual Studio solution", False)) -opts.Add(EnumVariable('macports_clang', "Build using Clang from MacPorts", 'no', ('no', '5.0', 'devel'))) -opts.Add(BoolVariable('disable_3d', "Disable 3D nodes for a smaller executable", False)) -opts.Add(BoolVariable('disable_advanced_gui', "Disable advanced GUI nodes and behaviors", False)) -opts.Add(BoolVariable('no_editor_splash', "Don't use the custom splash screen for the editor", False)) -opts.Add('system_certs_path', "Use this path as SSL certificates default for editor (for package maintainers)", '') +opts.Add(BoolVariable("verbose", "Enable verbose output for the compilation", False)) +opts.Add(BoolVariable("progress", "Show a progress indicator during compilation", True)) +opts.Add(EnumVariable("warnings", "Level of compilation warnings", "all", ("extra", "all", "moderate", "no"))) +opts.Add(BoolVariable("werror", "Treat compiler warnings as errors", True)) +opts.Add(BoolVariable("dev", "If yes, alias for verbose=yes warnings=extra werror=yes", False)) +opts.Add("extra_suffix", "Custom extra suffix added to the base filename of all generated binary files", "") +opts.Add(BoolVariable("vsproj", "Generate a Visual Studio solution", False)) +opts.Add(EnumVariable("macports_clang", "Build using Clang from MacPorts", "no", ("no", "5.0", "devel"))) +opts.Add(BoolVariable("disable_3d", "Disable 3D nodes for a smaller executable", False)) +opts.Add(BoolVariable("disable_advanced_gui", "Disable advanced GUI nodes and behaviors", False)) +opts.Add(BoolVariable("no_editor_splash", "Don't use the custom splash screen for the editor", False)) +opts.Add("system_certs_path", "Use this path as SSL certificates default for editor (for package maintainers)", "") # Thirdparty libraries -#opts.Add(BoolVariable('builtin_assimp', "Use the built-in Assimp library", True)) -opts.Add(BoolVariable('builtin_bullet', "Use the built-in Bullet library", True)) -opts.Add(BoolVariable('builtin_certs', "Bundle default SSL certificates to be used if you don't specify an override in the project settings", True)) -opts.Add(BoolVariable('builtin_enet', "Use the built-in ENet library", True)) -opts.Add(BoolVariable('builtin_freetype', "Use the built-in FreeType library", True)) -opts.Add(BoolVariable('builtin_glslang', "Use the built-in glslang library", True)) -opts.Add(BoolVariable('builtin_libogg', "Use the built-in libogg library", True)) -opts.Add(BoolVariable('builtin_libpng', "Use the built-in libpng library", True)) -opts.Add(BoolVariable('builtin_libtheora', "Use the built-in libtheora library", True)) -opts.Add(BoolVariable('builtin_libvorbis', "Use the built-in libvorbis library", True)) -opts.Add(BoolVariable('builtin_libvpx', "Use the built-in libvpx library", True)) -opts.Add(BoolVariable('builtin_libwebp', "Use the built-in libwebp library", True)) -opts.Add(BoolVariable('builtin_wslay', "Use the built-in wslay library", True)) -opts.Add(BoolVariable('builtin_mbedtls', "Use the built-in mbedTLS library", True)) -opts.Add(BoolVariable('builtin_miniupnpc', "Use the built-in miniupnpc library", True)) -opts.Add(BoolVariable('builtin_opus', "Use the built-in Opus library", True)) -opts.Add(BoolVariable('builtin_pcre2', "Use the built-in PCRE2 library", True)) -opts.Add(BoolVariable('builtin_pcre2_with_jit', "Use JIT compiler for the built-in PCRE2 library", True)) -opts.Add(BoolVariable('builtin_recast', "Use the built-in Recast library", True)) -opts.Add(BoolVariable('builtin_rvo2', "Use the built-in RVO2 library", True)) -opts.Add(BoolVariable('builtin_squish', "Use the built-in squish library", True)) -opts.Add(BoolVariable('builtin_vulkan', "Use the built-in Vulkan loader library and headers", True)) -opts.Add(BoolVariable('builtin_xatlas', "Use the built-in xatlas library", True)) -opts.Add(BoolVariable('builtin_zlib', "Use the built-in zlib library", True)) -opts.Add(BoolVariable('builtin_zstd', "Use the built-in Zstd library", True)) +# opts.Add(BoolVariable('builtin_assimp', "Use the built-in Assimp library", True)) +opts.Add(BoolVariable("builtin_bullet", "Use the built-in Bullet library", True)) +opts.Add(BoolVariable("builtin_certs", "Use the built-in SSL certificates bundles", True)) +opts.Add(BoolVariable("builtin_enet", "Use the built-in ENet library", True)) +opts.Add(BoolVariable("builtin_freetype", "Use the built-in FreeType library", True)) +opts.Add(BoolVariable("builtin_glslang", "Use the built-in glslang library", True)) +opts.Add(BoolVariable("builtin_libogg", "Use the built-in libogg library", True)) +opts.Add(BoolVariable("builtin_libpng", "Use the built-in libpng library", True)) +opts.Add(BoolVariable("builtin_libtheora", "Use the built-in libtheora library", True)) +opts.Add(BoolVariable("builtin_libvorbis", "Use the built-in libvorbis library", True)) +opts.Add(BoolVariable("builtin_libvpx", "Use the built-in libvpx library", True)) +opts.Add(BoolVariable("builtin_libwebp", "Use the built-in libwebp library", True)) +opts.Add(BoolVariable("builtin_wslay", "Use the built-in wslay library", True)) +opts.Add(BoolVariable("builtin_mbedtls", "Use the built-in mbedTLS library", True)) +opts.Add(BoolVariable("builtin_miniupnpc", "Use the built-in miniupnpc library", True)) +opts.Add(BoolVariable("builtin_opus", "Use the built-in Opus library", True)) +opts.Add(BoolVariable("builtin_pcre2", "Use the built-in PCRE2 library", True)) +opts.Add(BoolVariable("builtin_pcre2_with_jit", "Use JIT compiler for the built-in PCRE2 library", True)) +opts.Add(BoolVariable("builtin_recast", "Use the built-in Recast library", True)) +opts.Add(BoolVariable("builtin_rvo2", "Use the built-in RVO2 library", True)) +opts.Add(BoolVariable("builtin_squish", "Use the built-in squish library", True)) +opts.Add(BoolVariable("builtin_vulkan", "Use the built-in Vulkan loader library and headers", True)) +opts.Add(BoolVariable("builtin_xatlas", "Use the built-in xatlas library", True)) +opts.Add(BoolVariable("builtin_zlib", "Use the built-in zlib library", True)) +opts.Add(BoolVariable("builtin_zstd", "Use the built-in Zstd library", True)) # Compilation environment setup opts.Add("CXX", "C++ compiler") @@ -184,63 +184,64 @@ for x in module_list: tmppath = "./modules/" + x sys.path.insert(0, tmppath) import config + enabled_attr = getattr(config, "is_enabled", None) - if (callable(enabled_attr) and not config.is_enabled()): + if callable(enabled_attr) and not config.is_enabled(): module_enabled = False sys.path.remove(tmppath) - sys.modules.pop('config') - opts.Add(BoolVariable('module_' + x + '_enabled', "Enable module '%s'" % (x, ), module_enabled)) + sys.modules.pop("config") + opts.Add(BoolVariable("module_" + x + "_enabled", "Enable module '%s'" % (x,), module_enabled)) opts.Update(env_base) # update environment Help(opts.GenerateHelpText(env_base)) # generate help # add default include paths -env_base.Prepend(CPPPATH=['#']) +env_base.Prepend(CPPPATH=["#"]) # configure ENV for platform env_base.platform_exporters = platform_exporters env_base.platform_apis = platform_apis -if (env_base["use_precise_math_checks"]): - env_base.Append(CPPDEFINES=['PRECISE_MATH_CHECKS']) +if env_base["use_precise_math_checks"]: + env_base.Append(CPPDEFINES=["PRECISE_MATH_CHECKS"]) -if (env_base['target'] == 'debug'): - env_base.Append(CPPDEFINES=['DEBUG_MEMORY_ALLOC','DISABLE_FORCED_INLINE']) +if env_base["target"] == "debug": + env_base.Append(CPPDEFINES=["DEBUG_MEMORY_ALLOC", "DISABLE_FORCED_INLINE"]) # The two options below speed up incremental builds, but reduce the certainty that all files # will properly be rebuilt. As such, we only enable them for debug (dev) builds, not release. # To decide whether to rebuild a file, use the MD5 sum only if the timestamp has changed. # http://scons.org/doc/production/HTML/scons-user/ch06.html#idm139837621851792 - env_base.Decider('MD5-timestamp') + env_base.Decider("MD5-timestamp") # Use cached implicit dependencies by default. Can be overridden by specifying `--implicit-deps-changed` in the command line. # http://scons.org/doc/production/HTML/scons-user/ch06s04.html - env_base.SetOption('implicit_cache', 1) + env_base.SetOption("implicit_cache", 1) -if (env_base['no_editor_splash']): - env_base.Append(CPPDEFINES=['NO_EDITOR_SPLASH']) +if env_base["no_editor_splash"]: + env_base.Append(CPPDEFINES=["NO_EDITOR_SPLASH"]) -if not env_base['deprecated']: - env_base.Append(CPPDEFINES=['DISABLE_DEPRECATED']) +if not env_base["deprecated"]: + env_base.Append(CPPDEFINES=["DISABLE_DEPRECATED"]) env_base.platforms = {} selected_platform = "" -if env_base['platform'] != "": - selected_platform = env_base['platform'] -elif env_base['p'] != "": - selected_platform = env_base['p'] +if env_base["platform"] != "": + selected_platform = env_base["platform"] +elif env_base["p"] != "": + selected_platform = env_base["p"] env_base["platform"] = selected_platform else: # Missing `platform` argument, try to detect platform automatically - if sys.platform.startswith('linux'): - selected_platform = 'linuxbsd' - elif sys.platform == 'darwin': - selected_platform = 'osx' - elif sys.platform == 'win32': - selected_platform = 'windows' + if sys.platform.startswith("linux"): + selected_platform = "linuxbsd" + elif sys.platform == "darwin": + selected_platform = "osx" + elif sys.platform == "win32": + selected_platform = "windows" else: print("Could not detect platform automatically. Supported platforms:") for x in platform_list: @@ -254,26 +255,27 @@ else: if selected_platform in ["linux", "bsd", "x11"]: if selected_platform == "x11": # Deprecated alias kept for compatibility. - print('Platform "x11" has been renamed to "linuxbsd" in Godot 4.0. ' - 'Building for platform "linuxbsd".') + print('Platform "x11" has been renamed to "linuxbsd" in Godot 4.0. Building for platform "linuxbsd".') # Alias for convenience. selected_platform = "linuxbsd" + env_base["platform"] = selected_platform if selected_platform in platform_list: tmppath = "./platform/" + selected_platform sys.path.insert(0, tmppath) import detect + if "create" in dir(detect): env = detect.create(env_base) else: env = env_base.Clone() - if env['dev']: - env['verbose'] = True - env['warnings'] = "extra" - env['werror'] = True + if env["dev"]: + env["verbose"] = True + env["warnings"] = "extra" + env["werror"] = True - if env['vsproj']: + if env["vsproj"]: env.vs_incs = [] env.vs_srcs = [] @@ -286,7 +288,7 @@ if selected_platform in platform_list: pieces = fname.split(".") if len(pieces) > 0: basename = pieces[0] - basename = basename.replace('\\\\', '/') + basename = basename.replace("\\\\", "/") if os.path.isfile(basename + ".h"): env.vs_incs = env.vs_incs + [basename + ".h"] elif os.path.isfile(basename + ".hpp"): @@ -295,28 +297,29 @@ if selected_platform in platform_list: env.vs_srcs = env.vs_srcs + [basename + ".c"] elif os.path.isfile(basename + ".cpp"): env.vs_srcs = env.vs_srcs + [basename + ".cpp"] + env.AddToVSProject = AddToVSProject env.extra_suffix = "" - if env["extra_suffix"] != '': - env.extra_suffix += '.' + env["extra_suffix"] + if env["extra_suffix"] != "": + env.extra_suffix += "." + env["extra_suffix"] # Environment flags - CCFLAGS = env.get('CCFLAGS', '') - env['CCFLAGS'] = '' + CCFLAGS = env.get("CCFLAGS", "") + env["CCFLAGS"] = "" env.Append(CCFLAGS=str(CCFLAGS).split()) - CFLAGS = env.get('CFLAGS', '') - env['CFLAGS'] = '' + CFLAGS = env.get("CFLAGS", "") + env["CFLAGS"] = "" env.Append(CFLAGS=str(CFLAGS).split()) - CXXFLAGS = env.get('CXXFLAGS', '') - env['CXXFLAGS'] = '' + CXXFLAGS = env.get("CXXFLAGS", "") + env["CXXFLAGS"] = "" env.Append(CXXFLAGS=str(CXXFLAGS).split()) - LINKFLAGS = env.get('LINKFLAGS', '') - env['LINKFLAGS'] = '' + LINKFLAGS = env.get("LINKFLAGS", "") + env["LINKFLAGS"] = "" env.Append(LINKFLAGS=str(LINKFLAGS).split()) # Platform specific flags @@ -335,12 +338,12 @@ if selected_platform in platform_list: if not env.msvc: # Specifying GNU extensions support explicitly, which are supported by # both GCC and Clang. Both currently default to gnu11 and gnu++14. - env.Prepend(CFLAGS=['-std=gnu11']) - env.Prepend(CXXFLAGS=['-std=gnu++17']) + env.Prepend(CFLAGS=["-std=gnu11"]) + env.Prepend(CXXFLAGS=["-std=gnu++17"]) else: # MSVC doesn't have clear C standard support, /std only covers C++. # We apply it to CCFLAGS (both C and C++ code) in case it impacts C features. - env.Prepend(CCFLAGS=['/std:c++17']) + env.Prepend(CCFLAGS=["/std:c++17"]) # Enforce our minimal compiler version requirements cc_version = methods.get_compiler_version(env) or [-1, -1] @@ -351,16 +354,20 @@ if selected_platform in platform_list: # GCC 8 before 8.4 has a regression in the support of guaranteed copy elision # which causes a build failure: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86521 if cc_version_major == 8 and cc_version_minor < 4: - print("Detected GCC 8 version < 8.4, which is not supported due to a " - "regression in its C++17 guaranteed copy elision support. Use a " - "newer GCC version, or Clang 6 or later by passing \"use_llvm=yes\" " - "to the SCons command line.") + print( + "Detected GCC 8 version < 8.4, which is not supported due to a " + "regression in its C++17 guaranteed copy elision support. Use a " + 'newer GCC version, or Clang 6 or later by passing "use_llvm=yes" ' + "to the SCons command line." + ) sys.exit(255) elif cc_version_major < 7: - print("Detected GCC version older than 7, which does not fully support " - "C++17. Supported versions are GCC 7, 9 and later. Use a newer GCC " - "version, or Clang 6 or later by passing \"use_llvm=yes\" to the " - "SCons command line.") + print( + "Detected GCC version older than 7, which does not fully support " + "C++17. Supported versions are GCC 7, 9 and later. Use a newer GCC " + 'version, or Clang 6 or later by passing "use_llvm=yes" to the ' + "SCons command line." + ) sys.exit(255) elif methods.using_clang(env): # Apple LLVM versions differ from upstream LLVM version \o/, compare @@ -368,87 +375,100 @@ if selected_platform in platform_list: if env["platform"] == "osx" or env["platform"] == "iphone": vanilla = methods.is_vanilla_clang(env) if vanilla and cc_version_major < 6: - print("Detected Clang version older than 6, which does not fully support " - "C++17. Supported versions are Clang 6 and later.") + print( + "Detected Clang version older than 6, which does not fully support " + "C++17. Supported versions are Clang 6 and later." + ) sys.exit(255) elif not vanilla and cc_version_major < 10: - print("Detected Apple Clang version older than 10, which does not fully " - "support C++17. Supported versions are Apple Clang 10 and later.") + print( + "Detected Apple Clang version older than 10, which does not fully " + "support C++17. Supported versions are Apple Clang 10 and later." + ) sys.exit(255) elif cc_version_major < 6: - print("Detected Clang version older than 6, which does not fully support " - "C++17. Supported versions are Clang 6 and later.") + print( + "Detected Clang version older than 6, which does not fully support " + "C++17. Supported versions are Clang 6 and later." + ) sys.exit(255) # Configure compiler warnings if env.msvc: # Truncations, narrowing conversions, signed/unsigned comparisons... - disable_nonessential_warnings = ['/wd4267', '/wd4244', '/wd4305', '/wd4018', '/wd4800'] - if (env["warnings"] == 'extra'): - env.Append(CCFLAGS=['/Wall']) # Implies /W4 - elif (env["warnings"] == 'all'): - env.Append(CCFLAGS=['/W3'] + disable_nonessential_warnings) - elif (env["warnings"] == 'moderate'): - env.Append(CCFLAGS=['/W2'] + disable_nonessential_warnings) - else: # 'no' - env.Append(CCFLAGS=['/w']) + disable_nonessential_warnings = ["/wd4267", "/wd4244", "/wd4305", "/wd4018", "/wd4800"] + if env["warnings"] == "extra": + env.Append(CCFLAGS=["/Wall"]) # Implies /W4 + elif env["warnings"] == "all": + env.Append(CCFLAGS=["/W3"] + disable_nonessential_warnings) + elif env["warnings"] == "moderate": + env.Append(CCFLAGS=["/W2"] + disable_nonessential_warnings) + else: # 'no' + env.Append(CCFLAGS=["/w"]) # Set exception handling model to avoid warnings caused by Windows system headers. - env.Append(CCFLAGS=['/EHsc']) - if (env["werror"]): - env.Append(CCFLAGS=['/WX']) + env.Append(CCFLAGS=["/EHsc"]) + if env["werror"]: + env.Append(CCFLAGS=["/WX"]) # Force to use Unicode encoding - env.Append(MSVC_FLAGS=['/utf8']) - else: # Rest of the world + env.Append(MSVC_FLAGS=["/utf8"]) + else: # Rest of the world shadow_local_warning = [] - all_plus_warnings = ['-Wwrite-strings'] + all_plus_warnings = ["-Wwrite-strings"] if methods.using_gcc(env): if cc_version_major >= 7: - shadow_local_warning = ['-Wshadow-local'] + shadow_local_warning = ["-Wshadow-local"] - if (env["warnings"] == 'extra'): - env.Append(CCFLAGS=['-Wall', '-Wextra', '-Wno-unused-parameter'] - + all_plus_warnings + shadow_local_warning) - env.Append(CXXFLAGS=['-Wctor-dtor-privacy', '-Wnon-virtual-dtor']) + if env["warnings"] == "extra": + env.Append(CCFLAGS=["-Wall", "-Wextra", "-Wno-unused-parameter"] + all_plus_warnings + shadow_local_warning) + env.Append(CXXFLAGS=["-Wctor-dtor-privacy", "-Wnon-virtual-dtor"]) if methods.using_gcc(env): - env.Append(CCFLAGS=['-Walloc-zero', - '-Wduplicated-branches', '-Wduplicated-cond', - '-Wstringop-overflow=4', '-Wlogical-op']) + env.Append( + CCFLAGS=[ + "-Walloc-zero", + "-Wduplicated-branches", + "-Wduplicated-cond", + "-Wstringop-overflow=4", + "-Wlogical-op", + ] + ) # -Wnoexcept was removed temporarily due to GH-36325. - env.Append(CXXFLAGS=['-Wplacement-new=1']) + env.Append(CXXFLAGS=["-Wplacement-new=1"]) if cc_version_major >= 9: - env.Append(CCFLAGS=['-Wattribute-alias=2']) + env.Append(CCFLAGS=["-Wattribute-alias=2"]) if methods.using_clang(env): - env.Append(CCFLAGS=['-Wimplicit-fallthrough']) - elif (env["warnings"] == 'all'): - env.Append(CCFLAGS=['-Wall'] + shadow_local_warning) - elif (env["warnings"] == 'moderate'): - env.Append(CCFLAGS=['-Wall', '-Wno-unused'] + shadow_local_warning) - else: # 'no' - env.Append(CCFLAGS=['-w']) - if (env["werror"]): - env.Append(CCFLAGS=['-Werror']) + env.Append(CCFLAGS=["-Wimplicit-fallthrough"]) + elif env["warnings"] == "all": + env.Append(CCFLAGS=["-Wall"] + shadow_local_warning) + elif env["warnings"] == "moderate": + env.Append(CCFLAGS=["-Wall", "-Wno-unused"] + shadow_local_warning) + else: # 'no' + env.Append(CCFLAGS=["-w"]) + if env["werror"]: + env.Append(CCFLAGS=["-Werror"]) # FIXME: Temporary workaround after the Vulkan merge, remove once warnings are fixed. if methods.using_gcc(env): - env.Append(CXXFLAGS=['-Wno-error=cpp']) + env.Append(CXXFLAGS=["-Wno-error=cpp"]) + if cc_version_major == 7: # Bogus warning fixed in 8+. + env.Append(CCFLAGS=["-Wno-error=strict-overflow"]) else: - env.Append(CXXFLAGS=['-Wno-error=#warnings']) - else: # always enable those errors - env.Append(CCFLAGS=['-Werror=return-type']) + env.Append(CXXFLAGS=["-Wno-error=#warnings"]) + else: # always enable those errors + env.Append(CCFLAGS=["-Werror=return-type"]) - if (hasattr(detect, 'get_program_suffix')): + if hasattr(detect, "get_program_suffix"): suffix = "." + detect.get_program_suffix() else: suffix = "." + selected_platform - if (env["target"] == "release"): + if env["target"] == "release": if env["tools"]: print("Tools can only be built with targets 'debug' and 'release_debug'.") sys.exit(255) suffix += ".opt" - env.Append(CPPDEFINES=['NDEBUG']) + env.Append(CPPDEFINES=["NDEBUG"]) - elif (env["target"] == "release_debug"): + elif env["target"] == "release_debug": if env["tools"]: suffix += ".opt.tools" else: @@ -461,27 +481,28 @@ if selected_platform in platform_list: if env["arch"] != "": suffix += "." + env["arch"] - elif (env["bits"] == "32"): + elif env["bits"] == "32": suffix += ".32" - elif (env["bits"] == "64"): + elif env["bits"] == "64": suffix += ".64" suffix += env.extra_suffix sys.path.remove(tmppath) - sys.modules.pop('detect') + sys.modules.pop("detect") env.module_list = [] env.module_icons_paths = [] env.doc_class_path = {} for x in sorted(module_list): - if not env['module_' + x + '_enabled']: + if not env["module_" + x + "_enabled"]: continue tmppath = "./modules/" + x sys.path.insert(0, tmppath) env.current_module = x import config + if config.can_build(env, selected_platform): config.configure(env) env.module_list.append(x) @@ -503,7 +524,7 @@ if selected_platform in platform_list: env.module_icons_paths.append("modules/" + x + "/" + "icons") sys.path.remove(tmppath) - sys.modules.pop('config') + sys.modules.pop("config") methods.update_version(env.module_version_string) @@ -522,45 +543,66 @@ if selected_platform in platform_list: env["LIBSUFFIX"] = suffix + env["LIBSUFFIX"] env["SHLIBSUFFIX"] = suffix + env["SHLIBSUFFIX"] - if (env.use_ptrcall): - env.Append(CPPDEFINES=['PTRCALL_ENABLED']) - if env['tools']: - env.Append(CPPDEFINES=['TOOLS_ENABLED']) - if env['disable_3d']: - if env['tools']: - print("Build option 'disable_3d=yes' cannot be used with 'tools=yes' (editor), only with 'tools=no' (export template).") + if env.use_ptrcall: + env.Append(CPPDEFINES=["PTRCALL_ENABLED"]) + if env["tools"]: + env.Append(CPPDEFINES=["TOOLS_ENABLED"]) + if env["disable_3d"]: + if env["tools"]: + print( + "Build option 'disable_3d=yes' cannot be used with 'tools=yes' (editor), " + "only with 'tools=no' (export template)." + ) sys.exit(255) else: - env.Append(CPPDEFINES=['_3D_DISABLED']) - if env['disable_advanced_gui']: - if env['tools']: - print("Build option 'disable_advanced_gui=yes' cannot be used with 'tools=yes' (editor), only with 'tools=no' (export template).") + env.Append(CPPDEFINES=["_3D_DISABLED"]) + if env["disable_advanced_gui"]: + if env["tools"]: + print( + "Build option 'disable_advanced_gui=yes' cannot be used with 'tools=yes' (editor), " + "only with 'tools=no' (export template)." + ) sys.exit(255) else: - env.Append(CPPDEFINES=['ADVANCED_GUI_DISABLED']) - if env['minizip']: - env.Append(CPPDEFINES=['MINIZIP_ENABLED']) + env.Append(CPPDEFINES=["ADVANCED_GUI_DISABLED"]) + if env["minizip"]: + env.Append(CPPDEFINES=["MINIZIP_ENABLED"]) - editor_module_list = ['regex'] + editor_module_list = ["regex"] for x in editor_module_list: - if not env['module_' + x + '_enabled']: - if env['tools']: - print("Build option 'module_" + x + "_enabled=no' cannot be used with 'tools=yes' (editor), only with 'tools=no' (export template).") + if not env["module_" + x + "_enabled"]: + if env["tools"]: + print( + "Build option 'module_" + x + "_enabled=no' cannot be used with 'tools=yes' (editor), " + "only with 'tools=no' (export template)." + ) sys.exit(255) - if not env['verbose']: + if not env["verbose"]: methods.no_verbose(sys, env) - if (not env["platform"] == "server"): - env.Append(BUILDERS = { 'GLES2_GLSL' : env.Builder(action=run_in_subprocess(gles_builders.build_gles2_headers), suffix='glsl.gen.h', src_suffix='.glsl')}) - env.Append(BUILDERS = { 'RD_GLSL' : env.Builder(action=run_in_subprocess(gles_builders.build_rd_headers), suffix='glsl.gen.h', src_suffix='.glsl')}) + if not env["platform"] == "server": + env.Append( + BUILDERS={ + "GLES2_GLSL": env.Builder( + action=run_in_subprocess(gles_builders.build_gles2_headers), suffix="glsl.gen.h", src_suffix=".glsl" + ) + } + ) + env.Append( + BUILDERS={ + "RD_GLSL": env.Builder( + action=run_in_subprocess(gles_builders.build_rd_headers), suffix="glsl.gen.h", src_suffix=".glsl" + ) + } + ) scons_cache_path = os.environ.get("SCONS_CACHE") if scons_cache_path != None: CacheDir(scons_cache_path) print("Scons cache enabled... (path: '" + scons_cache_path + "')") - Export('env') + Export("env") # build subdirs, the build order is dependent on link order. @@ -577,16 +619,16 @@ if selected_platform in platform_list: SConscript("platform/" + selected_platform + "/SCsub") # build selected platform # Microsoft Visual Studio Project Generation - if env['vsproj']: - env['CPPPATH'] = [Dir(path) for path in env['CPPPATH']] + if env["vsproj"]: + env["CPPPATH"] = [Dir(path) for path in env["CPPPATH"]] methods.generate_vs_project(env, GetOption("num_jobs")) methods.generate_cpp_hint_file("cpp.hint") # Check for the existence of headers conf = Configure(env) - if ("check_c_headers" in env): + if "check_c_headers" in env: for header in env["check_c_headers"]: - if (conf.CheckCHeader(header[0])): + if conf.CheckCHeader(header[0]): env.AppendUnique(CPPDEFINES=[header[1]]) elif selected_platform != "": @@ -608,26 +650,30 @@ elif selected_platform != "": sys.exit(255) # The following only makes sense when the env is defined, and assumes it is -if 'env' in locals(): +if "env" in locals(): screen = sys.stdout # Progress reporting is not available in non-TTY environments since it # messes with the output (for example, when writing to a file) - show_progress = (env['progress'] and sys.stdout.isatty()) + show_progress = env["progress"] and sys.stdout.isatty() node_count = 0 node_count_max = 0 node_count_interval = 1 - node_count_fname = str(env.Dir('#')) + '/.scons_node_count' + node_count_fname = str(env.Dir("#")) + "/.scons_node_count" import time, math class cache_progress: # The default is 1 GB cache and 12 hours half life - def __init__(self, path = None, limit = 1073741824, half_life = 43200): + def __init__(self, path=None, limit=1073741824, half_life=43200): self.path = path self.limit = limit self.exponent_scale = math.log(2) / half_life - if env['verbose'] and path != None: - screen.write('Current cache limit is ' + self.convert_size(limit) + ' (used: ' + self.convert_size(self.get_size(path)) + ')\n') + if env["verbose"] and path != None: + screen.write( + "Current cache limit is {} (used: {})\n".format( + self.convert_size(limit), self.convert_size(self.get_size(path)) + ) + ) self.delete(self.file_list()) def __call__(self, node, *args, **kw): @@ -635,22 +681,22 @@ if 'env' in locals(): if show_progress: # Print the progress percentage node_count += node_count_interval - if (node_count_max > 0 and node_count <= node_count_max): - screen.write('\r[%3d%%] ' % (node_count * 100 / node_count_max)) + if node_count_max > 0 and node_count <= node_count_max: + screen.write("\r[%3d%%] " % (node_count * 100 / node_count_max)) screen.flush() - elif (node_count_max > 0 and node_count > node_count_max): - screen.write('\r[100%] ') + elif node_count_max > 0 and node_count > node_count_max: + screen.write("\r[100%] ") screen.flush() else: - screen.write('\r[Initial build] ') + screen.write("\r[Initial build] ") screen.flush() def delete(self, files): if len(files) == 0: return - if env['verbose']: + if env["verbose"]: # Utter something - screen.write('\rPurging %d %s from cache...\n' % (len(files), len(files) > 1 and 'files' or 'file')) + screen.write("\rPurging %d %s from cache...\n" % (len(files), len(files) > 1 and "files" or "file")) [os.remove(f) for f in files] def file_list(self): @@ -659,7 +705,7 @@ if 'env' in locals(): return [] # Gather a list of (filename, (size, atime)) within the # cache directory - file_stat = [(x, os.stat(x)[6:8]) for x in glob.glob(os.path.join(self.path, '*', '*'))] + file_stat = [(x, os.stat(x)[6:8]) for x in glob.glob(os.path.join(self.path, "*", "*"))] if file_stat == []: # Nothing to do return [] @@ -674,7 +720,7 @@ if 'env' in locals(): # Search for the first entry where the storage limit is # reached sum, mark = 0, None - for i,x in enumerate(file_stat): + for i, x in enumerate(file_stat): sum += x[1] if sum > self.limit: mark = i @@ -693,7 +739,7 @@ if 'env' in locals(): s = round(size_bytes / p, 2) return "%s %s" % (int(s) if i == 0 else s, size_name[i]) - def get_size(self, start_path = '.'): + def get_size(self, start_path="."): total_size = 0 for dirpath, dirnames, filenames in os.walk(start_path): for f in filenames: @@ -703,8 +749,8 @@ if 'env' in locals(): def progress_finish(target, source, env): global node_count, progressor - with open(node_count_fname, 'w') as f: - f.write('%d\n' % node_count) + with open(node_count_fname, "w") as f: + f.write("%d\n" % node_count) progressor.delete(progressor.file_list()) try: @@ -718,7 +764,7 @@ if 'env' in locals(): # cache directory to a size not larger than cache_limit. cache_limit = float(os.getenv("SCONS_CACHE_LIMIT", 1024)) * 1024 * 1024 progressor = cache_progress(cache_directory, cache_limit) - Progress(progressor, interval = node_count_interval) + Progress(progressor, interval=node_count_interval) - progress_finish_command = Command('progress_finish', [], progress_finish) + progress_finish_command = Command("progress_finish", [], progress_finish) AlwaysBuild(progress_finish_command) diff --git a/core/SCsub b/core/SCsub index ca003ce931..0ab4f11d87 100644 --- a/core/SCsub +++ b/core/SCsub @@ -1,6 +1,6 @@ #!/usr/bin/env python -Import('env') +Import("env") import core_builders import make_binders @@ -11,31 +11,32 @@ env.core_sources = [] # Generate AES256 script encryption key import os + txt = "0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0" -if ("SCRIPT_AES256_ENCRYPTION_KEY" in os.environ): +if "SCRIPT_AES256_ENCRYPTION_KEY" in os.environ: e = os.environ["SCRIPT_AES256_ENCRYPTION_KEY"] txt = "" ec_valid = True - if (len(e) != 64): + if len(e) != 64: ec_valid = False else: for i in range(len(e) >> 1): - if (i > 0): + if i > 0: txt += "," - txts = "0x" + e[i * 2:i * 2 + 2] + txts = "0x" + e[i * 2 : i * 2 + 2] try: int(txts, 16) except: ec_valid = False txt += txts - if (not ec_valid): + if not ec_valid: txt = "0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0" print("Invalid AES256 encryption key, not 64 bits hex: " + e) # NOTE: It is safe to generate this file here, since this is still executed serially with open("script_encryption_key.gen.cpp", "w") as f: - f.write("#include \"core/project_settings.h\"\nuint8_t script_encryption_key[32]={" + txt + "};\n") + f.write('#include "core/project_settings.h"\nuint8_t script_encryption_key[32]={' + txt + "};\n") # Add required thirdparty code. @@ -49,7 +50,6 @@ thirdparty_misc_sources = [ # C sources "fastlz.c", "smaz.c", - # C++ sources "hq2x.cpp", "pcg.cpp", @@ -60,30 +60,30 @@ thirdparty_misc_sources = [thirdparty_misc_dir + file for file in thirdparty_mis env_thirdparty.add_source_files(env.core_sources, thirdparty_misc_sources) # Zlib library, can be unbundled -if env['builtin_zlib']: - thirdparty_zlib_dir = "#thirdparty/zlib/" - thirdparty_zlib_sources = [ - "adler32.c", - "compress.c", - "crc32.c", - "deflate.c", - "infback.c", - "inffast.c", - "inflate.c", - "inftrees.c", - "trees.c", - "uncompr.c", - "zutil.c", - ] - thirdparty_zlib_sources = [thirdparty_zlib_dir + file for file in thirdparty_zlib_sources] - - env_thirdparty.Prepend(CPPPATH=[thirdparty_zlib_dir]) - # Needs to be available in main env too - env.Prepend(CPPPATH=[thirdparty_zlib_dir]) - if (env['target'] == 'debug'): - env_thirdparty.Append(CPPDEFINES=['ZLIB_DEBUG']) - - env_thirdparty.add_source_files(env.core_sources, thirdparty_zlib_sources) +if env["builtin_zlib"]: + thirdparty_zlib_dir = "#thirdparty/zlib/" + thirdparty_zlib_sources = [ + "adler32.c", + "compress.c", + "crc32.c", + "deflate.c", + "infback.c", + "inffast.c", + "inflate.c", + "inftrees.c", + "trees.c", + "uncompr.c", + "zutil.c", + ] + thirdparty_zlib_sources = [thirdparty_zlib_dir + file for file in thirdparty_zlib_sources] + + env_thirdparty.Prepend(CPPPATH=[thirdparty_zlib_dir]) + # Needs to be available in main env too + env.Prepend(CPPPATH=[thirdparty_zlib_dir]) + if env["target"] == "debug": + env_thirdparty.Append(CPPDEFINES=["ZLIB_DEBUG"]) + + env_thirdparty.add_source_files(env.core_sources, thirdparty_zlib_sources) # Minizip library, could be unbundled in theory # However, our version has some custom modifications, so it won't compile with the system one @@ -99,7 +99,7 @@ env_thirdparty.add_source_files(env.core_sources, thirdparty_minizip_sources) # Zstd library, can be unbundled in theory # though we currently use some private symbols # https://github.com/godotengine/godot/issues/17374 -if env['builtin_zstd']: +if env["builtin_zstd"]: thirdparty_zstd_dir = "#thirdparty/zstd/" thirdparty_zstd_sources = [ "common/debug.c", @@ -142,32 +142,45 @@ if env['builtin_zstd']: env.add_source_files(env.core_sources, "*.cpp") # Certificates -env.Depends("#core/io/certs_compressed.gen.h", ["#thirdparty/certs/ca-certificates.crt", env.Value(env['builtin_certs']), env.Value(env['system_certs_path'])]) -env.CommandNoCache("#core/io/certs_compressed.gen.h", "#thirdparty/certs/ca-certificates.crt", run_in_subprocess(core_builders.make_certs_header)) +env.Depends( + "#core/io/certs_compressed.gen.h", + ["#thirdparty/certs/ca-certificates.crt", env.Value(env["builtin_certs"]), env.Value(env["system_certs_path"])], +) +env.CommandNoCache( + "#core/io/certs_compressed.gen.h", + "#thirdparty/certs/ca-certificates.crt", + run_in_subprocess(core_builders.make_certs_header), +) # Make binders -env.CommandNoCache(['method_bind.gen.inc', 'method_bind_ext.gen.inc', 'method_bind_free_func.gen.inc'], 'make_binders.py', run_in_subprocess(make_binders.run)) +env.CommandNoCache( + ["method_bind.gen.inc", "method_bind_ext.gen.inc", "method_bind_free_func.gen.inc"], + "make_binders.py", + run_in_subprocess(make_binders.run), +) # Authors -env.Depends('#core/authors.gen.h', "../AUTHORS.md") -env.CommandNoCache('#core/authors.gen.h', "../AUTHORS.md", run_in_subprocess(core_builders.make_authors_header)) +env.Depends("#core/authors.gen.h", "../AUTHORS.md") +env.CommandNoCache("#core/authors.gen.h", "../AUTHORS.md", run_in_subprocess(core_builders.make_authors_header)) # Donors -env.Depends('#core/donors.gen.h', "../DONORS.md") -env.CommandNoCache('#core/donors.gen.h', "../DONORS.md", run_in_subprocess(core_builders.make_donors_header)) +env.Depends("#core/donors.gen.h", "../DONORS.md") +env.CommandNoCache("#core/donors.gen.h", "../DONORS.md", run_in_subprocess(core_builders.make_donors_header)) # License -env.Depends('#core/license.gen.h', ["../COPYRIGHT.txt", "../LICENSE.txt"]) -env.CommandNoCache('#core/license.gen.h', ["../COPYRIGHT.txt", "../LICENSE.txt"], run_in_subprocess(core_builders.make_license_header)) +env.Depends("#core/license.gen.h", ["../COPYRIGHT.txt", "../LICENSE.txt"]) +env.CommandNoCache( + "#core/license.gen.h", ["../COPYRIGHT.txt", "../LICENSE.txt"], run_in_subprocess(core_builders.make_license_header) +) # Chain load SCsubs -SConscript('os/SCsub') -SConscript('math/SCsub') -SConscript('crypto/SCsub') -SConscript('io/SCsub') -SConscript('debugger/SCsub') -SConscript('input/SCsub') -SConscript('bind/SCsub') +SConscript("os/SCsub") +SConscript("math/SCsub") +SConscript("crypto/SCsub") +SConscript("io/SCsub") +SConscript("debugger/SCsub") +SConscript("input/SCsub") +SConscript("bind/SCsub") # Build it all as a library diff --git a/core/bind/SCsub b/core/bind/SCsub index 1c5f954470..19a6549225 100644 --- a/core/bind/SCsub +++ b/core/bind/SCsub @@ -1,5 +1,5 @@ #!/usr/bin/env python -Import('env') +Import("env") env.add_source_files(env.core_sources, "*.cpp") diff --git a/core/core_builders.py b/core/core_builders.py index a06b61cb9b..d03874608e 100644 --- a/core/core_builders.py +++ b/core/core_builders.py @@ -11,15 +11,15 @@ def escape_string(s): rev_result = [] while c >= 256: c, low = (c // 256, c % 256) - rev_result.append('\\%03o' % low) - rev_result.append('\\%03o' % c) - return ''.join(reversed(rev_result)) + rev_result.append("\\%03o" % low) + rev_result.append("\\%03o" % c) + return "".join(reversed(rev_result)) - result = '' + result = "" if isinstance(s, str): - s = s.encode('utf-8') + s = s.encode("utf-8") for c in s: - if not(32 <= c < 127) or c in (ord('\\'), ord('"')): + if not (32 <= c < 127) or c in (ord("\\"), ord('"')): result += charcode_to_c_escapes(c) else: result += chr(c) @@ -34,6 +34,7 @@ def make_certs_header(target, source, env): buf = f.read() decomp_size = len(buf) import zlib + buf = zlib.compress(buf) g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") @@ -41,9 +42,9 @@ def make_certs_header(target, source, env): g.write("#define CERTS_COMPRESSED_GEN_H\n") # System certs path. Editor will use them if defined. (for package maintainers) - path = env['system_certs_path'] - g.write("#define _SYSTEM_CERTS_PATH \"%s\"\n" % str(path)) - if env['builtin_certs']: + path = env["system_certs_path"] + g.write('#define _SYSTEM_CERTS_PATH "%s"\n' % str(path)) + if env["builtin_certs"]: # Defined here and not in env so changing it does not trigger a full rebuild. g.write("#define BUILTIN_CERTS_ENABLED\n") g.write("static const int _certs_compressed_size = " + str(len(buf)) + ";\n") @@ -59,8 +60,18 @@ def make_certs_header(target, source, env): def make_authors_header(target, source, env): - sections = ["Project Founders", "Lead Developer", "Project Manager", "Developers"] - sections_id = ["AUTHORS_FOUNDERS", "AUTHORS_LEAD_DEVELOPERS", "AUTHORS_PROJECT_MANAGERS", "AUTHORS_DEVELOPERS"] + sections = [ + "Project Founders", + "Lead Developer", + "Project Manager", + "Developers", + ] + sections_id = [ + "AUTHORS_FOUNDERS", + "AUTHORS_LEAD_DEVELOPERS", + "AUTHORS_PROJECT_MANAGERS", + "AUTHORS_DEVELOPERS", + ] src = source[0] dst = target[0] @@ -80,7 +91,7 @@ def make_authors_header(target, source, env): for line in f: if reading: if line.startswith(" "): - g.write("\t\"" + escape_string(line.strip()) + "\",\n") + g.write('\t"' + escape_string(line.strip()) + '",\n') continue if line.startswith("## "): if reading: @@ -103,10 +114,22 @@ def make_authors_header(target, source, env): def make_donors_header(target, source, env): - sections = ["Platinum sponsors", "Gold sponsors", "Mini sponsors", - "Gold donors", "Silver donors", "Bronze donors"] - sections_id = ["DONORS_SPONSOR_PLAT", "DONORS_SPONSOR_GOLD", "DONORS_SPONSOR_MINI", - "DONORS_GOLD", "DONORS_SILVER", "DONORS_BRONZE"] + sections = [ + "Platinum sponsors", + "Gold sponsors", + "Mini sponsors", + "Gold donors", + "Silver donors", + "Bronze donors", + ] + sections_id = [ + "DONORS_SPONSOR_PLAT", + "DONORS_SPONSOR_GOLD", + "DONORS_SPONSOR_MINI", + "DONORS_GOLD", + "DONORS_SILVER", + "DONORS_BRONZE", + ] src = source[0] dst = target[0] @@ -126,7 +149,7 @@ def make_donors_header(target, source, env): for line in f: if reading >= 0: if line.startswith(" "): - g.write("\t\"" + escape_string(line.strip()) + "\",\n") + g.write('\t"' + escape_string(line.strip()) + '",\n') continue if line.startswith("## "): if reading: @@ -169,8 +192,8 @@ def make_license_header(target, source, env): return line def next_tag(self): - if not ':' in self.current: - return ('', []) + if not ":" in self.current: + return ("", []) tag, line = self.current.split(":", 1) lines = [line.strip()] while self.next_line() and self.current.startswith(" "): @@ -178,6 +201,7 @@ def make_license_header(target, source, env): return (tag, lines) from collections import OrderedDict + projects = OrderedDict() license_list = [] @@ -218,26 +242,30 @@ def make_license_header(target, source, env): with open(src_license, "r", encoding="utf-8") as license_file: for line in license_file: escaped_string = escape_string(line.strip()) - f.write("\n\t\t\"" + escaped_string + "\\n\"") + f.write('\n\t\t"' + escaped_string + '\\n"') f.write(";\n\n") - f.write("struct ComponentCopyrightPart {\n" - "\tconst char *license;\n" - "\tconst char *const *files;\n" - "\tconst char *const *copyright_statements;\n" - "\tint file_count;\n" - "\tint copyright_count;\n" - "};\n\n") - - f.write("struct ComponentCopyright {\n" - "\tconst char *name;\n" - "\tconst ComponentCopyrightPart *parts;\n" - "\tint part_count;\n" - "};\n\n") + f.write( + "struct ComponentCopyrightPart {\n" + "\tconst char *license;\n" + "\tconst char *const *files;\n" + "\tconst char *const *copyright_statements;\n" + "\tint file_count;\n" + "\tint copyright_count;\n" + "};\n\n" + ) + + f.write( + "struct ComponentCopyright {\n" + "\tconst char *name;\n" + "\tconst ComponentCopyrightPart *parts;\n" + "\tint part_count;\n" + "};\n\n" + ) f.write("const char *const COPYRIGHT_INFO_DATA[] = {\n") for line in data_list: - f.write("\t\"" + escape_string(line) + "\",\n") + f.write('\t"' + escape_string(line) + '",\n') f.write("};\n\n") f.write("const ComponentCopyrightPart COPYRIGHT_PROJECT_PARTS[] = {\n") @@ -246,11 +274,21 @@ def make_license_header(target, source, env): for project_name, project in iter(projects.items()): part_indexes[project_name] = part_index for part in project: - f.write("\t{ \"" + escape_string(part["License"][0]) + "\", " - + "©RIGHT_INFO_DATA[" + str(part["file_index"]) + "], " - + "©RIGHT_INFO_DATA[" + str(part["copyright_index"]) + "], " - + str(len(part["Files"])) + ", " - + str(len(part["Copyright"])) + " },\n") + f.write( + '\t{ "' + + escape_string(part["License"][0]) + + '", ' + + "©RIGHT_INFO_DATA[" + + str(part["file_index"]) + + "], " + + "©RIGHT_INFO_DATA[" + + str(part["copyright_index"]) + + "], " + + str(len(part["Files"])) + + ", " + + str(len(part["Copyright"])) + + " },\n" + ) part_index += 1 f.write("};\n\n") @@ -258,30 +296,37 @@ def make_license_header(target, source, env): f.write("const ComponentCopyright COPYRIGHT_INFO[] = {\n") for project_name, project in iter(projects.items()): - f.write("\t{ \"" + escape_string(project_name) + "\", " - + "©RIGHT_PROJECT_PARTS[" + str(part_indexes[project_name]) + "], " - + str(len(project)) + " },\n") + f.write( + '\t{ "' + + escape_string(project_name) + + '", ' + + "©RIGHT_PROJECT_PARTS[" + + str(part_indexes[project_name]) + + "], " + + str(len(project)) + + " },\n" + ) f.write("};\n\n") 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") + f.write('\t"' + escape_string(l[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:]: if line == ".": - f.write("\t\"\\n\"\n") + f.write('\t"\\n"\n') else: - f.write("\t\"" + escape_string(line) + "\\n\"\n") - f.write("\t\"\",\n\n") + f.write('\t"' + escape_string(line) + '\\n"\n') + f.write('\t"",\n\n') f.write("};\n\n") f.write("#endif // LICENSE_GEN_H\n") -if __name__ == '__main__': +if __name__ == "__main__": subprocess_main(globals()) diff --git a/core/crypto/SCsub b/core/crypto/SCsub index 0a3f05d87a..da4a9c9381 100644 --- a/core/crypto/SCsub +++ b/core/crypto/SCsub @@ -1,6 +1,6 @@ #!/usr/bin/env python -Import('env') +Import("env") env_crypto = env.Clone() @@ -22,7 +22,9 @@ if not has_module: env_thirdparty = env_crypto.Clone() env_thirdparty.disable_warnings() # Custom config file - env_thirdparty.Append(CPPDEFINES=[('MBEDTLS_CONFIG_FILE', '\\"thirdparty/mbedtls/include/godot_core_mbedtls_config.h\\"')]) + env_thirdparty.Append( + CPPDEFINES=[("MBEDTLS_CONFIG_FILE", '\\"thirdparty/mbedtls/include/godot_core_mbedtls_config.h\\"')] + ) thirdparty_mbedtls_dir = "#thirdparty/mbedtls/library/" thirdparty_mbedtls_sources = [ "aes.c", @@ -30,7 +32,7 @@ if not has_module: "md5.c", "sha1.c", "sha256.c", - "godot_core_mbedtls_platform.c" + "godot_core_mbedtls_platform.c", ] thirdparty_mbedtls_sources = [thirdparty_mbedtls_dir + file for file in thirdparty_mbedtls_sources] env_thirdparty.add_source_files(env.core_sources, thirdparty_mbedtls_sources) diff --git a/core/debugger/SCsub b/core/debugger/SCsub index 1c5f954470..19a6549225 100644 --- a/core/debugger/SCsub +++ b/core/debugger/SCsub @@ -1,5 +1,5 @@ #!/usr/bin/env python -Import('env') +Import("env") env.add_source_files(env.core_sources, "*.cpp") diff --git a/core/image.cpp b/core/image.cpp index d691c4f442..a18391830c 100644 --- a/core/image.cpp +++ b/core/image.cpp @@ -2945,7 +2945,7 @@ void Image::_bind_methods() { ClassDB::bind_method(D_METHOD("detect_used_channels", "source"), &Image::detect_used_channels, DEFVAL(COMPRESS_SOURCE_GENERIC)); ClassDB::bind_method(D_METHOD("compress", "mode", "source", "lossy_quality"), &Image::compress, DEFVAL(COMPRESS_SOURCE_GENERIC), DEFVAL(0.7)); - ClassDB::bind_method(D_METHOD("compress_from_channels", "mode", "channels", "lossy_quality"), &Image::compress, DEFVAL(0.7)); + ClassDB::bind_method(D_METHOD("compress_from_channels", "mode", "channels", "lossy_quality"), &Image::compress_from_channels, DEFVAL(0.7)); ClassDB::bind_method(D_METHOD("decompress"), &Image::decompress); ClassDB::bind_method(D_METHOD("is_compressed"), &Image::is_compressed); diff --git a/core/input/SCsub b/core/input/SCsub index f1660932e5..d46e52a347 100644 --- a/core/input/SCsub +++ b/core/input/SCsub @@ -1,20 +1,28 @@ #!/usr/bin/env python -Import('env') +Import("env") from platform_methods import run_in_subprocess import input_builders # Order matters here. Higher index controller database files write on top of lower index database files. -controller_databases = ["#core/input/gamecontrollerdb_204.txt", "#core/input/gamecontrollerdb_205.txt", "#core/input/gamecontrollerdb.txt", "#core/input/godotcontrollerdb.txt"] +controller_databases = [ + "#core/input/gamecontrollerdb_204.txt", + "#core/input/gamecontrollerdb_205.txt", + "#core/input/gamecontrollerdb.txt", + "#core/input/godotcontrollerdb.txt", +] env.Depends("#core/input/default_controller_mappings.gen.cpp", controller_databases) -env.CommandNoCache("#core/input/default_controller_mappings.gen.cpp", controller_databases, run_in_subprocess(input_builders.make_default_controller_mappings)) +env.CommandNoCache( + "#core/input/default_controller_mappings.gen.cpp", + controller_databases, + run_in_subprocess(input_builders.make_default_controller_mappings), +) env.add_source_files(env.core_sources, "*.cpp") # Don't warn about duplicate entry here, we need it registered manually for first build, # even if later builds will pick it up twice due to above *.cpp globbing. env.add_source_files(env.core_sources, "#core/input/default_controller_mappings.gen.cpp", warn_duplicates=False) - diff --git a/core/input/input_builders.py b/core/input/input_builders.py index ca142c0c80..6184c5debb 100644 --- a/core/input/input_builders.py +++ b/core/input/input_builders.py @@ -12,8 +12,8 @@ def make_default_controller_mappings(target, source, env): g = open(dst, "w") g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") - g.write("#include \"core/typedefs.h\"\n") - g.write("#include \"core/input/default_controller_mappings.h\"\n") + g.write('#include "core/typedefs.h"\n') + g.write('#include "core/input/default_controller_mappings.h"\n') # ensure mappings have a consistent order platform_mappings = OrderedDict() @@ -37,11 +37,19 @@ def make_default_controller_mappings(target, source, env): line_parts = line.split(",") guid = line_parts[0] if guid in platform_mappings[current_platform]: - g.write("// WARNING - DATABASE {} OVERWROTE PRIOR MAPPING: {} {}\n".format(src_path, current_platform, platform_mappings[current_platform][guid])) + g.write( + "// WARNING - DATABASE {} OVERWROTE PRIOR MAPPING: {} {}\n".format( + src_path, current_platform, platform_mappings[current_platform][guid] + ) + ) valid_mapping = True for input_map in line_parts[2:]: if "+" in input_map or "-" in input_map or "~" in input_map: - g.write("// WARNING - DISCARDED UNSUPPORTED MAPPING TYPE FROM DATABASE {}: {} {}\n".format(src_path, current_platform, line)) + g.write( + "// WARNING - DISCARDED UNSUPPORTED MAPPING TYPE FROM DATABASE {}: {} {}\n".format( + src_path, current_platform, line + ) + ) valid_mapping = False break if valid_mapping: @@ -62,12 +70,12 @@ def make_default_controller_mappings(target, source, env): variable = platform_variables[platform] g.write("{}\n".format(variable)) for mapping in mappings.values(): - g.write("\t\"{}\",\n".format(mapping)) + g.write('\t"{}",\n'.format(mapping)) g.write("#endif\n") g.write("\tNULL\n};\n") g.close() -if __name__ == '__main__': +if __name__ == "__main__": subprocess_main(globals()) diff --git a/core/io/SCsub b/core/io/SCsub index 1c5f954470..19a6549225 100644 --- a/core/io/SCsub +++ b/core/io/SCsub @@ -1,5 +1,5 @@ #!/usr/bin/env python -Import('env') +Import("env") env.add_source_files(env.core_sources, "*.cpp") diff --git a/core/make_binders.py b/core/make_binders.py index c42b91fbe5..94bee95bfb 100644 --- a/core/make_binders.py +++ b/core/make_binders.py @@ -280,58 +280,57 @@ MethodBind* create_method_bind($ifret R$ $ifnoret void$ (*p_method)($ifconst con """ - def make_version(template, nargs, argmax, const, ret): intext = template from_pos = 0 outtext = "" - while(True): + while True: to_pos = intext.find("$", from_pos) - if (to_pos == -1): + if to_pos == -1: outtext += intext[from_pos:] break else: outtext += intext[from_pos:to_pos] end = intext.find("$", to_pos + 1) - if (end == -1): + if end == -1: break # ignore - macro = intext[to_pos + 1:end] + macro = intext[to_pos + 1 : end] cmd = "" data = "" - if (macro.find(" ") != -1): - cmd = macro[0:macro.find(" ")] - data = macro[macro.find(" ") + 1:] + if macro.find(" ") != -1: + cmd = macro[0 : macro.find(" ")] + data = macro[macro.find(" ") + 1 :] else: cmd = macro - if (cmd == "argc"): + if cmd == "argc": outtext += str(nargs) - if (cmd == "ifret" and ret): + if cmd == "ifret" and ret: outtext += data - if (cmd == "ifargs" and nargs): + if cmd == "ifargs" and nargs: outtext += data - if (cmd == "ifretargs" and nargs and ret): + if cmd == "ifretargs" and nargs and ret: outtext += data - if (cmd == "ifconst" and const): + if cmd == "ifconst" and const: outtext += data - elif (cmd == "ifnoconst" and not const): + elif cmd == "ifnoconst" and not const: outtext += data - elif (cmd == "ifnoret" and not ret): + elif cmd == "ifnoret" and not ret: outtext += data - elif (cmd == "iftempl" and (nargs > 0 or ret)): + elif cmd == "iftempl" and (nargs > 0 or ret): outtext += data - elif (cmd == "arg,"): + elif cmd == "arg,": for i in range(1, nargs + 1): - if (i > 1): + if i > 1: outtext += ", " outtext += data.replace("@", str(i)) - elif (cmd == "arg"): + elif cmd == "arg": for i in range(1, nargs + 1): outtext += data.replace("@", str(i)) - elif (cmd == "noarg"): + elif cmd == "noarg": for i in range(nargs + 1, argmax + 1): outtext += data.replace("@", str(i)) @@ -348,7 +347,9 @@ def run(target, source, env): text_ext = "" text_free_func = "#ifndef METHOD_BIND_FREE_FUNC_H\n#define METHOD_BIND_FREE_FUNC_H\n" text_free_func += "\n//including this header file allows method binding to use free functions\n" - text_free_func += "//note that the free function must have a pointer to an instance of the class as its first parameter\n" + text_free_func += ( + "//note that the free function must have a pointer to an instance of the class as its first parameter\n" + ) for i in range(0, versions + 1): @@ -361,7 +362,7 @@ def run(target, source, env): t += make_version(template_typed, i, versions, True, False) t += make_version(template, i, versions, True, True) t += make_version(template_typed, i, versions, True, True) - if (i >= versions_ext): + if i >= versions_ext: text_ext += t else: text += t @@ -383,6 +384,7 @@ def run(target, source, env): f.write(text_free_func) -if __name__ == '__main__': +if __name__ == "__main__": from platform_methods import subprocess_main + subprocess_main(globals()) diff --git a/core/math/SCsub b/core/math/SCsub index be438fcfbe..c8fdac207e 100644 --- a/core/math/SCsub +++ b/core/math/SCsub @@ -1,6 +1,6 @@ #!/usr/bin/env python -Import('env') +Import("env") env_math = env.Clone() diff --git a/core/os/SCsub b/core/os/SCsub index 1c5f954470..19a6549225 100644 --- a/core/os/SCsub +++ b/core/os/SCsub @@ -1,5 +1,5 @@ #!/usr/bin/env python -Import('env') +Import("env") env.add_source_files(env.core_sources, "*.cpp") diff --git a/core/variant_call.cpp b/core/variant_call.cpp index db7244a221..fecd507b48 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -1957,7 +1957,7 @@ void register_variant_methods() { ADDFUNC0NC(DICTIONARY, NIL, Dictionary, clear, varray()); ADDFUNC1R(DICTIONARY, BOOL, Dictionary, has, NIL, "key", varray()); ADDFUNC1R(DICTIONARY, BOOL, Dictionary, has_all, ARRAY, "keys", varray()); - ADDFUNC1R(DICTIONARY, BOOL, Dictionary, erase, NIL, "key", varray()); + ADDFUNC1RNC(DICTIONARY, BOOL, Dictionary, erase, NIL, "key", varray()); ADDFUNC0R(DICTIONARY, INT, Dictionary, hash, varray()); ADDFUNC0R(DICTIONARY, ARRAY, Dictionary, keys, varray()); ADDFUNC0R(DICTIONARY, ARRAY, Dictionary, values, varray()); diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml index 74c364bad5..8c6821eaac 100644 --- a/doc/classes/@GlobalScope.xml +++ b/doc/classes/@GlobalScope.xml @@ -36,8 +36,8 @@ <member name="IP" type="IP" setter="" getter=""> The [IP] singleton. </member> - <member name="Input" type="Input" setter="" getter=""> - The [Input] singleton. + <member name="Input" type="InputFilter" setter="" getter=""> + The [InputFilter] singleton. </member> <member name="InputMap" type="InputMap" setter="" getter=""> The [InputMap] singleton. @@ -56,14 +56,14 @@ <member name="Marshalls" type="Marshalls" setter="" getter=""> The [Marshalls] singleton. </member> - <member name="Navigation2DServer" type="Navigation2DServer" setter="" getter=""> - The [Navigation2DServer] singleton. - </member> <member name="NavigationMeshGenerator" type="NavigationMeshGenerator" setter="" getter=""> The [NavigationMeshGenerator] singleton. </member> - <member name="NavigationServer" type="NavigationServer" setter="" getter=""> - The [NavigationServer] singleton. + <member name="NavigationServer2D" type="NavigationServer2D" setter="" getter=""> + The [NavigationServer2D] singleton. + </member> + <member name="NavigationServer3D" type="NavigationServer3D" setter="" getter=""> + The [NavigationServer2D] singleton. </member> <member name="OS" type="OS" setter="" getter=""> The [OS] singleton. @@ -71,15 +71,18 @@ <member name="Performance" type="Performance" setter="" getter=""> The [Performance] singleton. </member> - <member name="Physics2DServer" type="Physics2DServer" setter="" getter=""> - The [Physics2DServer] singleton. + <member name="PhysicsServer2D" type="PhysicsServer2D" setter="" getter=""> + The [PhysicsServer2D] singleton. </member> - <member name="PhysicsServer" type="PhysicsServer" setter="" getter=""> - The [PhysicsServer] singleton. + <member name="PhysicsServer3D" type="PhysicsServer3D" setter="" getter=""> + The [PhysicsServer3D] singleton. </member> <member name="ProjectSettings" type="ProjectSettings" setter="" getter=""> The [ProjectSettings] singleton. </member> + <member name="RenderingServer" type="RenderingServer" setter="" getter=""> + The [RenderingServer] singleton. + </member> <member name="ResourceLoader" type="ResourceLoader" setter="" getter=""> The [ResourceLoader] singleton. </member> @@ -92,9 +95,6 @@ <member name="VisualScriptEditor" type="VisualScriptEditor" setter="" getter=""> The [VisualScriptEditor] singleton. </member> - <member name="VisualServer" type="VisualServer" setter="" getter=""> - The [VisualServer] singleton. - </member> </members> <constants> <constant name="MARGIN_LEFT" value="0" enum="Margin"> diff --git a/doc/classes/ARVRAnchor.xml b/doc/classes/ARVRAnchor.xml index 87181f572d..82575ce7cb 100644 --- a/doc/classes/ARVRAnchor.xml +++ b/doc/classes/ARVRAnchor.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ARVRAnchor" inherits="Spatial" version="4.0"> +<class name="ARVRAnchor" inherits="Node3D" version="4.0"> <brief_description> An anchor point in AR space. </brief_description> diff --git a/doc/classes/ARVRCamera.xml b/doc/classes/ARVRCamera.xml index a571d26c83..c97d5cf1d8 100644 --- a/doc/classes/ARVRCamera.xml +++ b/doc/classes/ARVRCamera.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ARVRCamera" inherits="Camera" version="4.0"> +<class name="ARVRCamera" inherits="Camera3D" version="4.0"> <brief_description> A camera node with a few overrules for AR/VR applied, such as location tracking. </brief_description> diff --git a/doc/classes/ARVRController.xml b/doc/classes/ARVRController.xml index ebae25feb7..572b47ce6d 100644 --- a/doc/classes/ARVRController.xml +++ b/doc/classes/ARVRController.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ARVRController" inherits="Spatial" version="4.0"> +<class name="ARVRController" inherits="Node3D" version="4.0"> <brief_description> A spatial node representing a spatially-tracked controller. </brief_description> diff --git a/doc/classes/ARVROrigin.xml b/doc/classes/ARVROrigin.xml index 9a386fd154..a88a89c927 100644 --- a/doc/classes/ARVROrigin.xml +++ b/doc/classes/ARVROrigin.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ARVROrigin" inherits="Spatial" version="4.0"> +<class name="ARVROrigin" inherits="Node3D" version="4.0"> <brief_description> The origin point in AR/VR. </brief_description> diff --git a/doc/classes/ARVRServer.xml b/doc/classes/ARVRServer.xml index 6db7121858..d8d069c048 100644 --- a/doc/classes/ARVRServer.xml +++ b/doc/classes/ARVRServer.xml @@ -69,7 +69,7 @@ <return type="int"> </return> <description> - Returns the absolute timestamp (in μs) of the last [ARVRServer] commit of the AR/VR eyes to [VisualServer]. The value comes from an internal call to [method OS.get_ticks_usec]. + Returns the absolute timestamp (in μs) of the last [ARVRServer] commit of the AR/VR eyes to [RenderingServer]. The value comes from an internal call to [method OS.get_ticks_usec]. </description> </method> <method name="get_last_frame_usec"> diff --git a/doc/classes/AcceptDialog.xml b/doc/classes/AcceptDialog.xml index 01540383dc..99b566e74f 100644 --- a/doc/classes/AcceptDialog.xml +++ b/doc/classes/AcceptDialog.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="AcceptDialog" inherits="WindowDialog" version="4.0"> +<class name="AcceptDialog" inherits="Window" version="4.0"> <brief_description> Base dialog for user notification. </brief_description> @@ -67,9 +67,16 @@ <member name="dialog_text" type="String" setter="set_text" getter="get_text" default=""""> The text displayed by the dialog. </member> - <member name="window_title" type="String" setter="set_title" getter="get_title" override="true" default=""Alert!"" /> + <member name="title" type="String" setter="set_title" getter="get_title" override="true" default=""Alert!"" /> + <member name="transient" type="bool" setter="set_transient" getter="is_transient" override="true" default="true" /> + <member name="visible" type="bool" setter="set_visible" getter="is_visible" override="true" default="false" /> + <member name="wrap_controls" type="bool" setter="set_wrap_controls" getter="is_wrapping_controls" override="true" default="true" /> </members> <signals> + <signal name="cancelled"> + <description> + </description> + </signal> <signal name="confirmed"> <description> Emitted when the dialog is accepted, i.e. the OK button is pressed. diff --git a/doc/classes/AnimatedSprite.xml b/doc/classes/AnimatedSprite2D.xml index b5c1d38ff9..8d0534ccd2 100644 --- a/doc/classes/AnimatedSprite.xml +++ b/doc/classes/AnimatedSprite2D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="AnimatedSprite" inherits="Node2D" version="4.0"> +<class name="AnimatedSprite2D" inherits="Node2D" version="4.0"> <brief_description> Sprite node that can use multiple textures for animation. </brief_description> @@ -61,7 +61,7 @@ If [code]true[/code], the [member animation] is currently playing. </member> <member name="shininess" type="float" setter="set_shininess" getter="get_shininess" default="1.0"> - Strength of the specular light effect of this [AnimatedSprite]. + Strength of the specular light effect of this [AnimatedSprite2D]. </member> <member name="specular_color" type="Color" setter="set_specular_color" getter="get_specular_color" default="Color( 1, 1, 1, 1 )"> The color of the specular light effect. diff --git a/doc/classes/AnimatedTexture.xml b/doc/classes/AnimatedTexture.xml index b851c76e59..80b910aaa7 100644 --- a/doc/classes/AnimatedTexture.xml +++ b/doc/classes/AnimatedTexture.xml @@ -4,7 +4,7 @@ Proxy texture for simple frame-based animations. </brief_description> <description> - [AnimatedTexture] is a resource format for frame-based animations, where multiple textures can be chained automatically with a predefined delay for each frame. Unlike [AnimationPlayer] or [AnimatedSprite], it isn't a [Node], but has the advantage of being usable anywhere a [Texture2D] resource can be used, e.g. in a [TileSet]. + [AnimatedTexture] is a resource format for frame-based animations, where multiple textures can be chained automatically with a predefined delay for each frame. Unlike [AnimationPlayer] or [AnimatedSprite2D], it isn't a [Node], but has the advantage of being usable anywhere a [Texture2D] resource can be used, e.g. in a [TileSet]. The playback of the animation is controlled by the [member fps] property as well as each frame's optional delay (see [method set_frame_delay]). The animation loops, i.e. it will restart at frame 0 automatically after playing the last frame. [AnimatedTexture] currently requires all frame textures to have the same size, otherwise the bigger ones will be cropped to match the smallest one. Also, it doesn't support [AtlasTexture]. Each frame needs to be separate image. </description> @@ -71,7 +71,7 @@ </members> <constants> <constant name="MAX_FRAMES" value="256"> - The maximum number of frames supported by [AnimatedTexture]. If you need more frames in your animation, use [AnimationPlayer] or [AnimatedSprite]. + The maximum number of frames supported by [AnimatedTexture]. If you need more frames in your animation, use [AnimationPlayer] or [AnimatedSprite2D]. </constant> </constants> </class> diff --git a/doc/classes/Area.xml b/doc/classes/Area3D.xml index b273a7a9d9..1adfc878e2 100644 --- a/doc/classes/Area.xml +++ b/doc/classes/Area3D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Area" inherits="CollisionObject" version="4.0"> +<class name="Area3D" inherits="CollisionObject3D" version="4.0"> <brief_description> General-purpose area node for detection and 3D physics influence. </brief_description> <description> - 3D area that detects [CollisionObject] nodes overlapping, entering, or exiting. Can also alter or override local physics parameters (gravity, damping). + 3D area that detects [CollisionObject3D] nodes overlapping, entering, or exiting. Can also alter or override local physics parameters (gravity, damping). </description> <tutorials> </tutorials> @@ -31,14 +31,14 @@ <return type="Array"> </return> <description> - Returns a list of intersecting [Area]s. For performance reasons (collisions are all processed at the same time) this list is modified once during the physics step, not immediately after objects are moved. Consider using signals instead. + Returns a list of intersecting [Area3D]s. For performance reasons (collisions are all processed at the same time) this list is modified once during the physics step, not immediately after objects are moved. Consider using signals instead. </description> </method> <method name="get_overlapping_bodies" qualifiers="const"> <return type="Array"> </return> <description> - Returns a list of intersecting [PhysicsBody]s. For performance reasons (collisions are all processed at the same time) this list is modified once during the physics step, not immediately after objects are moved. Consider using signals instead. + Returns a list of intersecting [PhysicsBody3D]s. For performance reasons (collisions are all processed at the same time) this list is modified once during the physics step, not immediately after objects are moved. Consider using signals instead. </description> </method> <method name="overlaps_area" qualifiers="const"> @@ -47,7 +47,7 @@ <argument index="0" name="area" type="Node"> </argument> <description> - If [code]true[/code], the given area overlaps the Area. + If [code]true[/code], the given area overlaps the Area3D. [b]Note:[/b] The result of this test is not immediate after moving objects. For performance, list of overlaps is updated once per frame and before the physics step. Consider using signals instead. </description> </method> @@ -57,9 +57,9 @@ <argument index="0" name="body" type="Node"> </argument> <description> - If [code]true[/code], the given physics body overlaps the Area. + If [code]true[/code], the given physics body overlaps the Area3D. [b]Note:[/b] The result of this test is not immediate after moving objects. For performance, list of overlaps is updated once per frame and before the physics step. Consider using signals instead. - The [code]body[/code] argument can either be a [PhysicsBody] or a [GridMap] instance (while GridMaps are not physics body themselves, they register their tiles with collision shapes as a virtual physics body). + The [code]body[/code] argument can either be a [PhysicsBody3D] or a [GridMap] instance (while GridMaps are not physics body themselves, they register their tiles with collision shapes as a virtual physics body). </description> </method> <method name="set_collision_layer_bit"> @@ -70,7 +70,7 @@ <argument index="1" name="value" type="bool"> </argument> <description> - Set/clear individual bits on the layer mask. This simplifies editing this [Area]'s layers. + Set/clear individual bits on the layer mask. This simplifies editing this [Area3D]'s layers. </description> </method> <method name="set_collision_mask_bit"> @@ -81,7 +81,7 @@ <argument index="1" name="value" type="bool"> </argument> <description> - Set/clear individual bits on the collision mask. This simplifies editing which [Area] layers this [Area] scans. + Set/clear individual bits on the collision mask. This simplifies editing which [Area3D] layers this [Area3D] scans. </description> </method> </methods> @@ -137,20 +137,20 @@ <member name="reverb_bus_uniformity" type="float" setter="set_reverb_uniformity" getter="get_reverb_uniformity" default="0.0"> The degree to which this area's reverb is a uniform effect. Ranges from [code]0[/code] to [code]1[/code] with [code]0.1[/code] precision. </member> - <member name="space_override" type="int" setter="set_space_override_mode" getter="get_space_override_mode" enum="Area.SpaceOverride" default="0"> + <member name="space_override" type="int" setter="set_space_override_mode" getter="get_space_override_mode" enum="Area3D.SpaceOverride" default="0"> Override mode for gravity and damping calculations within this area. See [enum SpaceOverride] for possible values. </member> </members> <signals> <signal name="area_entered"> - <argument index="0" name="area" type="Area"> + <argument index="0" name="area" type="Area3D"> </argument> <description> Emitted when another area enters. </description> </signal> <signal name="area_exited"> - <argument index="0" name="area" type="Area"> + <argument index="0" name="area" type="Area3D"> </argument> <description> Emitted when another area exits. @@ -159,7 +159,7 @@ <signal name="area_shape_entered"> <argument index="0" name="area_id" type="int"> </argument> - <argument index="1" name="area" type="Area"> + <argument index="1" name="area" type="Area3D"> </argument> <argument index="2" name="area_shape" type="int"> </argument> @@ -172,7 +172,7 @@ <signal name="area_shape_exited"> <argument index="0" name="area_id" type="int"> </argument> - <argument index="1" name="area" type="Area"> + <argument index="1" name="area" type="Area3D"> </argument> <argument index="2" name="area_shape" type="int"> </argument> @@ -187,7 +187,7 @@ </argument> <description> Emitted when a physics body enters. - The [code]body[/code] argument can either be a [PhysicsBody] or a [GridMap] instance (while GridMaps are not physics body themselves, they register their tiles with collision shapes as a virtual physics body). + The [code]body[/code] argument can either be a [PhysicsBody3D] or a [GridMap] instance (while GridMaps are not physics body themselves, they register their tiles with collision shapes as a virtual physics body). </description> </signal> <signal name="body_exited"> @@ -195,7 +195,7 @@ </argument> <description> Emitted when a physics body exits. - The [code]body[/code] argument can either be a [PhysicsBody] or a [GridMap] instance (while GridMaps are not physics body themselves, they register their tiles with collision shapes as a virtual physics body). + The [code]body[/code] argument can either be a [PhysicsBody3D] or a [GridMap] instance (while GridMaps are not physics body themselves, they register their tiles with collision shapes as a virtual physics body). </description> </signal> <signal name="body_shape_entered"> @@ -209,7 +209,7 @@ </argument> <description> Emitted when a physics body enters, reporting which shapes overlapped. - The [code]body[/code] argument can either be a [PhysicsBody] or a [GridMap] instance (while GridMaps are not physics body themselves, they register their tiles with collision shapes as a virtual physics body). + The [code]body[/code] argument can either be a [PhysicsBody3D] or a [GridMap] instance (while GridMaps are not physics body themselves, they register their tiles with collision shapes as a virtual physics body). </description> </signal> <signal name="body_shape_exited"> @@ -223,7 +223,7 @@ </argument> <description> Emitted when a physics body exits, reporting which shapes were overlapping. - The [code]body[/code] argument can either be a [PhysicsBody] or a [GridMap] instance (while GridMaps are not physics body themselves, they register their tiles with collision shapes as a virtual physics body). + The [code]body[/code] argument can either be a [PhysicsBody3D] or a [GridMap] instance (while GridMaps are not physics body themselves, they register their tiles with collision shapes as a virtual physics body). </description> </signal> </signals> diff --git a/doc/classes/ArrayMesh.xml b/doc/classes/ArrayMesh.xml index 47abd2e996..9e742ea581 100644 --- a/doc/classes/ArrayMesh.xml +++ b/doc/classes/ArrayMesh.xml @@ -18,10 +18,10 @@ arrays[ArrayMesh.ARRAY_VERTEX] = vertices # Create the Mesh. arr_mesh.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLES, arrays) - var m = MeshInstance.new() + var m = MeshInstance3D.new() m.mesh = arr_mesh [/codeblock] - The [MeshInstance] is ready to be added to the [SceneTree] to be shown. + The [MeshInstance3D] is ready to be added to the [SceneTree] to be shown. </description> <tutorials> <link>https://docs.godotengine.org/en/latest/tutorials/content/procedural_geometry/arraymesh.html</link> diff --git a/doc/classes/AudioStreamPlayer3D.xml b/doc/classes/AudioStreamPlayer3D.xml index 4ec8dba2c6..3eeb524e9c 100644 --- a/doc/classes/AudioStreamPlayer3D.xml +++ b/doc/classes/AudioStreamPlayer3D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="AudioStreamPlayer3D" inherits="Spatial" version="4.0"> +<class name="AudioStreamPlayer3D" inherits="Node3D" version="4.0"> <brief_description> Plays 3D sound in 3D space. </brief_description> diff --git a/doc/classes/BaseMaterial3D.xml b/doc/classes/BaseMaterial3D.xml index 380e739f46..bffaf91e1d 100644 --- a/doc/classes/BaseMaterial3D.xml +++ b/doc/classes/BaseMaterial3D.xml @@ -634,8 +634,8 @@ The object's X axis will always face the camera. </constant> <constant name="BILLBOARD_PARTICLES" value="3" enum="BillboardMode"> - Used for particle systems when assigned to [Particles] and [CPUParticles] nodes. Enables [code]particles_anim_*[/code] properties. - The [member ParticlesMaterial.anim_speed] or [member CPUParticles.anim_speed] should also be set to a positive value for the animation to play. + Used for particle systems when assigned to [GPUParticles3D] and [CPUParticles3D] nodes. Enables [code]particles_anim_*[/code] properties. + The [member ParticlesMaterial.anim_speed] or [member CPUParticles3D.anim_speed] should also be set to a positive value for the animation to play. </constant> <constant name="TEXTURE_CHANNEL_RED" value="0" enum="TextureChannel"> Used to read from the red channel of a texture. diff --git a/doc/classes/BoneAttachment.xml b/doc/classes/BoneAttachment3D.xml index d15322254b..ab1e5b17d9 100644 --- a/doc/classes/BoneAttachment.xml +++ b/doc/classes/BoneAttachment3D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="BoneAttachment" inherits="Spatial" version="4.0"> +<class name="BoneAttachment3D" inherits="Node3D" version="4.0"> <brief_description> A node that will attach to a bone. </brief_description> <description> - This node must be the child of a [Skeleton] node. You can then select a bone for this node to attach to. The BoneAttachment node will copy the transform of the selected bone. + This node must be the child of a [Skeleton3D] node. You can then select a bone for this node to attach to. The BoneAttachment3D node will copy the transform of the selected bone. </description> <tutorials> </tutorials> diff --git a/doc/classes/BoxShape.xml b/doc/classes/BoxShape3D.xml index 3a5f05ef79..fd08da148d 100644 --- a/doc/classes/BoxShape.xml +++ b/doc/classes/BoxShape3D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="BoxShape" inherits="Shape" version="4.0"> +<class name="BoxShape3D" inherits="Shape3D" version="4.0"> <brief_description> Box shape resource. </brief_description> <description> - 3D box shape that can be a child of a [PhysicsBody] or [Area]. + 3D box shape that can be a child of a [PhysicsBody3D] or [Area3D]. </description> <tutorials> </tutorials> diff --git a/doc/classes/CPUParticles2D.xml b/doc/classes/CPUParticles2D.xml index 799ba32075..c2b821699d 100644 --- a/doc/classes/CPUParticles2D.xml +++ b/doc/classes/CPUParticles2D.xml @@ -5,7 +5,7 @@ </brief_description> <description> CPU-based 2D particle node used to create a variety of particle systems and effects. - See also [Particles2D], which provides the same functionality with hardware acceleration, but may not run on older devices. + See also [GPUParticles2D], which provides the same functionality with hardware acceleration, but may not run on older devices. </description> <tutorials> <link>https://docs.godotengine.org/en/latest/tutorials/2d/particle_systems_2d.html</link> @@ -17,7 +17,7 @@ <argument index="0" name="particles" type="Node"> </argument> <description> - Sets this node's properties to match a given [Particles2D] node with an assigned [ParticlesMaterial]. + Sets this node's properties to match a given [GPUParticles2D] node with an assigned [ParticlesMaterial]. </description> </method> <method name="get_param" qualifiers="const"> diff --git a/doc/classes/CPUParticles.xml b/doc/classes/CPUParticles3D.xml index 6a6525e99a..07da066bd9 100644 --- a/doc/classes/CPUParticles.xml +++ b/doc/classes/CPUParticles3D.xml @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="CPUParticles" inherits="GeometryInstance" version="4.0"> +<class name="CPUParticles3D" inherits="GeometryInstance3D" version="4.0"> <brief_description> CPU-based 3D particle emitter. </brief_description> <description> CPU-based 3D particle node used to create a variety of particle systems and effects. - See also [Particles], which provides the same functionality with hardware acceleration, but may not run on older devices. + See also [GPUParticles3D], which provides the same functionality with hardware acceleration, but may not run on older devices. </description> <tutorials> </tutorials> @@ -16,13 +16,13 @@ <argument index="0" name="particles" type="Node"> </argument> <description> - Sets this node's properties to match a given [Particles] node with an assigned [ParticlesMaterial]. + Sets this node's properties to match a given [GPUParticles3D] node with an assigned [ParticlesMaterial]. </description> </method> <method name="get_param" qualifiers="const"> <return type="float"> </return> - <argument index="0" name="param" type="int" enum="CPUParticles.Parameter"> + <argument index="0" name="param" type="int" enum="CPUParticles3D.Parameter"> </argument> <description> Returns the base value of the parameter specified by [enum Parameter]. @@ -31,7 +31,7 @@ <method name="get_param_curve" qualifiers="const"> <return type="Curve"> </return> - <argument index="0" name="param" type="int" enum="CPUParticles.Parameter"> + <argument index="0" name="param" type="int" enum="CPUParticles3D.Parameter"> </argument> <description> Returns the [Curve] of the parameter specified by [enum Parameter]. @@ -40,7 +40,7 @@ <method name="get_param_randomness" qualifiers="const"> <return type="float"> </return> - <argument index="0" name="param" type="int" enum="CPUParticles.Parameter"> + <argument index="0" name="param" type="int" enum="CPUParticles3D.Parameter"> </argument> <description> Returns the randomness factor of the parameter specified by [enum Parameter]. @@ -49,7 +49,7 @@ <method name="get_particle_flag" qualifiers="const"> <return type="bool"> </return> - <argument index="0" name="flag" type="int" enum="CPUParticles.Flags"> + <argument index="0" name="flag" type="int" enum="CPUParticles3D.Flags"> </argument> <description> Returns the enabled state of the given flag (see [enum Flags] for options). @@ -65,7 +65,7 @@ <method name="set_param"> <return type="void"> </return> - <argument index="0" name="param" type="int" enum="CPUParticles.Parameter"> + <argument index="0" name="param" type="int" enum="CPUParticles3D.Parameter"> </argument> <argument index="1" name="value" type="float"> </argument> @@ -76,7 +76,7 @@ <method name="set_param_curve"> <return type="void"> </return> - <argument index="0" name="param" type="int" enum="CPUParticles.Parameter"> + <argument index="0" name="param" type="int" enum="CPUParticles3D.Parameter"> </argument> <argument index="1" name="curve" type="Curve"> </argument> @@ -87,7 +87,7 @@ <method name="set_param_randomness"> <return type="void"> </return> - <argument index="0" name="param" type="int" enum="CPUParticles.Parameter"> + <argument index="0" name="param" type="int" enum="CPUParticles3D.Parameter"> </argument> <argument index="1" name="randomness" type="float"> </argument> @@ -98,7 +98,7 @@ <method name="set_particle_flag"> <return type="void"> </return> - <argument index="0" name="flag" type="int" enum="CPUParticles.Flags"> + <argument index="0" name="flag" type="int" enum="CPUParticles3D.Flags"> </argument> <argument index="1" name="enable" type="bool"> </argument> @@ -165,7 +165,7 @@ <member name="direction" type="Vector3" setter="set_direction" getter="get_direction" default="Vector3( 1, 0, 0 )"> Unit vector specifying the particles' emission direction. </member> - <member name="draw_order" type="int" setter="set_draw_order" getter="get_draw_order" enum="CPUParticles.DrawOrder" default="0"> + <member name="draw_order" type="int" setter="set_draw_order" getter="get_draw_order" enum="CPUParticles3D.DrawOrder" default="0"> Particle draw order. Uses [enum DrawOrder] values. </member> <member name="emission_box_extents" type="Vector3" setter="set_emission_box_extents" getter="get_emission_box_extents"> @@ -180,7 +180,7 @@ <member name="emission_points" type="PackedVector3Array" setter="set_emission_points" getter="get_emission_points" default="PackedVector3Array( )"> Sets the initial positions to spawn particles when using [constant EMISSION_SHAPE_POINTS] or [constant EMISSION_SHAPE_DIRECTED_POINTS]. </member> - <member name="emission_shape" type="int" setter="set_emission_shape" getter="get_emission_shape" enum="CPUParticles.EmissionShape" default="0"> + <member name="emission_shape" type="int" setter="set_emission_shape" getter="get_emission_shape" enum="CPUParticles3D.EmissionShape" default="0"> Particles will be emitted inside this region. See [enum EmissionShape] for possible values. </member> <member name="emission_sphere_radius" type="float" setter="set_emission_sphere_radius" getter="get_emission_sphere_radius"> diff --git a/doc/classes/Camera.xml b/doc/classes/Camera3D.xml index 6097721cbd..bfba23c7ee 100644 --- a/doc/classes/Camera.xml +++ b/doc/classes/Camera3D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Camera" inherits="Spatial" version="4.0"> +<class name="Camera3D" inherits="Node3D" version="4.0"> <brief_description> Camera node, displays from a point of view. </brief_description> <description> - Camera is a special node that displays what is visible from its current location. Cameras register themselves in the nearest [Viewport] node (when ascending the tree). Only one camera can be active per viewport. If no viewport is available ascending the tree, the camera will register in the global viewport. In other words, a camera just provides 3D display capabilities to a [Viewport], and, without one, a scene registered in that [Viewport] (or higher viewports) can't be displayed. + [Camera3D] is a special node that displays what is visible from its current location. Cameras register themselves in the nearest [Viewport] node (when ascending the tree). Only one camera can be active per viewport. If no viewport is available ascending the tree, the camera will register in the global viewport. In other words, a camera just provides 3D display capabilities to a [Viewport], and, without one, a scene registered in that [Viewport] (or higher viewports) can't be displayed. </description> <tutorials> </tutorials> @@ -22,14 +22,14 @@ <return type="RID"> </return> <description> - Returns the camera's RID from the [VisualServer]. + Returns the camera's RID from the [RenderingServer]. </description> </method> <method name="get_camera_transform" qualifiers="const"> <return type="Transform"> </return> <description> - Gets the camera transform. Subclassed cameras such as [InterpolatedCamera] may provide different transforms than the [Node] transform. + Gets the camera transform. Subclassed cameras such as [ClippedCamera3D] may provide different transforms than the [Node] transform. </description> </method> <method name="get_cull_mask_bit" qualifiers="const"> @@ -172,7 +172,7 @@ <member name="current" type="bool" setter="set_current" getter="is_current" default="false"> If [code]true[/code], the ancestor [Viewport] is currently using this camera. </member> - <member name="doppler_tracking" type="int" setter="set_doppler_tracking" getter="get_doppler_tracking" enum="Camera.DopplerTracking" default="0"> + <member name="doppler_tracking" type="int" setter="set_doppler_tracking" getter="get_doppler_tracking" enum="Camera3D.DopplerTracking" default="0"> If not [constant DOPPLER_TRACKING_DISABLED], this camera will simulate the [url=https://en.wikipedia.org/wiki/Doppler_effect]Doppler effect[/url] for objects changed in particular [code]_process[/code] methods. See [enum DopplerTracking] for possible values. </member> <member name="effects" type="CameraEffects" setter="set_effects" getter="get_effects"> @@ -192,13 +192,13 @@ <member name="h_offset" type="float" setter="set_h_offset" getter="get_h_offset" default="0.0"> The horizontal (X) offset of the camera viewport. </member> - <member name="keep_aspect" type="int" setter="set_keep_aspect_mode" getter="get_keep_aspect_mode" enum="Camera.KeepAspect" default="1"> + <member name="keep_aspect" type="int" setter="set_keep_aspect_mode" getter="get_keep_aspect_mode" enum="Camera3D.KeepAspect" default="1"> The axis to lock during [member fov]/[member size] adjustments. Can be either [constant KEEP_WIDTH] or [constant KEEP_HEIGHT]. </member> <member name="near" type="float" setter="set_znear" getter="get_znear" default="0.05"> The distance to the near culling boundary for this camera relative to its local Z axis. </member> - <member name="projection" type="int" setter="set_projection" getter="get_projection" enum="Camera.Projection" default="0"> + <member name="projection" type="int" setter="set_projection" getter="get_projection" enum="Camera3D.Projection" default="0"> The camera's projection mode. In [constant PROJECTION_PERSPECTIVE] mode, objects' Z distance from the camera's local space scales their perceived size. </member> <member name="size" type="float" setter="set_size" getter="get_size" default="1.0"> diff --git a/doc/classes/CanvasItem.xml b/doc/classes/CanvasItem.xml index 73ba8b392f..f2ce2a6fb9 100644 --- a/doc/classes/CanvasItem.xml +++ b/doc/classes/CanvasItem.xml @@ -426,7 +426,7 @@ <return type="RID"> </return> <description> - Returns the canvas item RID used by [VisualServer] for this item. + Returns the canvas item RID used by [RenderingServer] for this item. </description> </method> <method name="get_canvas_transform" qualifiers="const"> diff --git a/doc/classes/CanvasItemMaterial.xml b/doc/classes/CanvasItemMaterial.xml index ffe2272260..c2d44c1d17 100644 --- a/doc/classes/CanvasItemMaterial.xml +++ b/doc/classes/CanvasItemMaterial.xml @@ -18,7 +18,7 @@ The manner in which material reacts to lighting. </member> <member name="particles_anim_h_frames" type="int" setter="set_particles_anim_h_frames" getter="get_particles_anim_h_frames"> - The number of columns in the spritesheet assigned as [Texture2D] for a [Particles2D] or [CPUParticles2D]. + The number of columns in the spritesheet assigned as [Texture2D] for a [GPUParticles2D] or [CPUParticles2D]. [b]Note:[/b] This property is only used and visible in the editor if [member particles_animation] is [code]true[/code]. </member> <member name="particles_anim_loop" type="bool" setter="set_particles_anim_loop" getter="get_particles_anim_loop"> @@ -26,11 +26,11 @@ [b]Note:[/b] This property is only used and visible in the editor if [member particles_animation] is [code]true[/code]. </member> <member name="particles_anim_v_frames" type="int" setter="set_particles_anim_v_frames" getter="get_particles_anim_v_frames"> - The number of rows in the spritesheet assigned as [Texture2D] for a [Particles2D] or [CPUParticles2D]. + The number of rows in the spritesheet assigned as [Texture2D] for a [GPUParticles2D] or [CPUParticles2D]. [b]Note:[/b] This property is only used and visible in the editor if [member particles_animation] is [code]true[/code]. </member> <member name="particles_animation" type="bool" setter="set_particles_animation" getter="get_particles_animation" default="false"> - If [code]true[/code], enable spritesheet-based animation features when assigned to [Particles2D] and [CPUParticles2D] nodes. The [member ParticlesMaterial.anim_speed] or [member CPUParticles2D.anim_speed] should also be set to a positive value for the animation to play. + If [code]true[/code], enable spritesheet-based animation features when assigned to [GPUParticles2D] and [CPUParticles2D] nodes. The [member ParticlesMaterial.anim_speed] or [member CPUParticles2D.anim_speed] should also be set to a positive value for the animation to play. This property (and other [code]particles_anim_*[/code] properties that depend on it) has no effect on other types of nodes. </member> </members> diff --git a/doc/classes/CapsuleShape.xml b/doc/classes/CapsuleShape3D.xml index c83e832281..f56d94dc63 100644 --- a/doc/classes/CapsuleShape.xml +++ b/doc/classes/CapsuleShape3D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="CapsuleShape" inherits="Shape" version="4.0"> +<class name="CapsuleShape3D" inherits="Shape3D" version="4.0"> <brief_description> Capsule shape for collisions. </brief_description> diff --git a/doc/classes/ClippedCamera.xml b/doc/classes/ClippedCamera3D.xml index 4cdc098c2f..58ecec828d 100644 --- a/doc/classes/ClippedCamera.xml +++ b/doc/classes/ClippedCamera3D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ClippedCamera" inherits="Camera" version="4.0"> +<class name="ClippedCamera3D" inherits="Camera3D" version="4.0"> <brief_description> - A [Camera] that includes collision. + A [Camera3D] that includes collision. </brief_description> <description> - This node extends [Camera] to add collisions with [Area] and/or [PhysicsBody] nodes. The camera cannot move through colliding objects. + This node extends [Camera3D] to add collisions with [Area3D] and/or [PhysicsBody3D] nodes. The camera cannot move through colliding objects. </description> <tutorials> </tutorials> @@ -84,10 +84,10 @@ </methods> <members> <member name="clip_to_areas" type="bool" setter="set_clip_to_areas" getter="is_clip_to_areas_enabled" default="false"> - If [code]true[/code], the camera stops on contact with [Area]s. + If [code]true[/code], the camera stops on contact with [Area3D]s. </member> <member name="clip_to_bodies" type="bool" setter="set_clip_to_bodies" getter="is_clip_to_bodies_enabled" default="true"> - If [code]true[/code], the camera stops on contact with [PhysicsBody]s. + If [code]true[/code], the camera stops on contact with [PhysicsBody3D]s. </member> <member name="collision_mask" type="int" setter="set_collision_mask" getter="get_collision_mask" default="1"> The camera's collision mask. Only objects in at least one collision layer matching the mask will be detected. @@ -95,7 +95,7 @@ <member name="margin" type="float" setter="set_margin" getter="get_margin" default="0.0"> The camera's collision margin. The camera can't get closer than this distance to a colliding object. </member> - <member name="process_mode" type="int" setter="set_process_mode" getter="get_process_mode" enum="ClippedCamera.ProcessMode" default="0"> + <member name="process_mode" type="int" setter="set_process_mode" getter="get_process_mode" enum="ClippedCamera3D.ProcessMode" default="0"> The camera's process callback. See [enum ProcessMode]. </member> </members> diff --git a/doc/classes/CollisionObject.xml b/doc/classes/CollisionObject3D.xml index 34758d71b2..f8e897653d 100644 --- a/doc/classes/CollisionObject.xml +++ b/doc/classes/CollisionObject3D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="CollisionObject" inherits="Spatial" version="4.0"> +<class name="CollisionObject3D" inherits="Node3D" version="4.0"> <brief_description> Base node for collision objects. </brief_description> <description> - CollisionObject is the base class for physics objects. It can hold any number of collision [Shape]s. Each shape must be assigned to a [i]shape owner[/i]. The CollisionObject can have any number of shape owners. Shape owners are not nodes and do not appear in the editor, but are accessible through code using the [code]shape_owner_*[/code] methods. + CollisionObject3D is the base class for physics objects. It can hold any number of collision [Shape3D]s. Each shape must be assigned to a [i]shape owner[/i]. The CollisionObject3D can have any number of shape owners. Shape owners are not nodes and do not appear in the editor, but are accessible through code using the [code]shape_owner_*[/code] methods. </description> <tutorials> </tutorials> @@ -23,7 +23,7 @@ <argument index="4" name="shape_idx" type="int"> </argument> <description> - Accepts unhandled [InputEvent]s. [code]click_position[/code] is the clicked location in world space and [code]click_normal[/code] is the normal vector extending from the clicked surface of the [Shape] at [code]shape_idx[/code]. Connect to the [code]input_event[/code] signal to easily pick up these events. + Accepts unhandled [InputEvent]s. [code]click_position[/code] is the clicked location in world space and [code]click_normal[/code] is the normal vector extending from the clicked surface of the [Shape3D] at [code]shape_idx[/code]. Connect to the [code]input_event[/code] signal to easily pick up these events. </description> </method> <method name="create_shape_owner"> @@ -81,10 +81,10 @@ </return> <argument index="0" name="owner_id" type="int"> </argument> - <argument index="1" name="shape" type="Shape"> + <argument index="1" name="shape" type="Shape3D"> </argument> <description> - Adds a [Shape] to the shape owner. + Adds a [Shape3D] to the shape owner. </description> </method> <method name="shape_owner_clear_shapes"> @@ -106,14 +106,14 @@ </description> </method> <method name="shape_owner_get_shape" qualifiers="const"> - <return type="Shape"> + <return type="Shape3D"> </return> <argument index="0" name="owner_id" type="int"> </argument> <argument index="1" name="shape_id" type="int"> </argument> <description> - Returns the [Shape] with the given id from the given shape owner. + Returns the [Shape3D] with the given id from the given shape owner. </description> </method> <method name="shape_owner_get_shape_count" qualifiers="const"> @@ -133,7 +133,7 @@ <argument index="1" name="shape_id" type="int"> </argument> <description> - Returns the child index of the [Shape] with the given id from the given shape owner. + Returns the child index of the [Shape3D] with the given id from the given shape owner. </description> </method> <method name="shape_owner_get_transform" qualifiers="const"> @@ -181,10 +181,10 @@ </methods> <members> <member name="input_capture_on_drag" type="bool" setter="set_capture_input_on_drag" getter="get_capture_input_on_drag" default="false"> - If [code]true[/code], the [CollisionObject] will continue to receive input events as the mouse is dragged across its shapes. + If [code]true[/code], the [CollisionObject3D] will continue to receive input events as the mouse is dragged across its shapes. </member> <member name="input_ray_pickable" type="bool" setter="set_ray_pickable" getter="is_ray_pickable" default="true"> - If [code]true[/code], the [CollisionObject]'s shapes will respond to [RayCast]s. + If [code]true[/code], the [CollisionObject3D]'s shapes will respond to [RayCast3D]s. </member> </members> <signals> diff --git a/doc/classes/CollisionPolygon.xml b/doc/classes/CollisionPolygon3D.xml index 8aceec17a8..dd3c57d1d0 100644 --- a/doc/classes/CollisionPolygon.xml +++ b/doc/classes/CollisionPolygon3D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="CollisionPolygon" inherits="Spatial" version="4.0"> +<class name="CollisionPolygon3D" inherits="Node3D" version="4.0"> <brief_description> Editor-only class for defining a collision polygon in 3D space. </brief_description> <description> - Allows editing a collision polygon's vertices on a selected plane. Can also set a depth perpendicular to that plane. This class is only available in the editor. It will not appear in the scene tree at run-time. Creates a [Shape] for gameplay. Properties modified during gameplay will have no effect. + Allows editing a collision polygon's vertices on a selected plane. Can also set a depth perpendicular to that plane. This class is only available in the editor. It will not appear in the scene tree at run-time. Creates a [Shape3D] for gameplay. Properties modified during gameplay will have no effect. </description> <tutorials> </tutorials> diff --git a/doc/classes/CollisionShape.xml b/doc/classes/CollisionShape3D.xml index 7787bf957d..76515a65a7 100644 --- a/doc/classes/CollisionShape.xml +++ b/doc/classes/CollisionShape3D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="CollisionShape" inherits="Spatial" version="4.0"> +<class name="CollisionShape3D" inherits="Node3D" version="4.0"> <brief_description> Node that represents collision shape data in 3D space. </brief_description> <description> - Editor facility for creating and editing collision shapes in 3D space. You can use this node to represent all sorts of collision shapes, for example, add this to an [Area] to give it a detection shape, or add it to a [PhysicsBody] to create a solid object. [b]IMPORTANT[/b]: this is an Editor-only helper to create shapes, use [method CollisionObject.shape_owner_get_shape] to get the actual shape. + Editor facility for creating and editing collision shapes in 3D space. You can use this node to represent all sorts of collision shapes, for example, add this to an [Area3D] to give it a detection shape, or add it to a [PhysicsBody3D] to create a solid object. [b]IMPORTANT[/b]: this is an Editor-only helper to create shapes, use [method CollisionObject3D.shape_owner_get_shape] to get the actual shape. </description> <tutorials> <link>https://docs.godotengine.org/en/latest/tutorials/physics/physics_introduction.html</link> @@ -14,7 +14,7 @@ <return type="void"> </return> <description> - Sets the collision shape's shape to the addition of all its convexed [MeshInstance] siblings geometry. + Sets the collision shape's shape to the addition of all its convexed [MeshInstance3D] siblings geometry. </description> </method> <method name="resource_changed"> @@ -31,7 +31,7 @@ <member name="disabled" type="bool" setter="set_disabled" getter="is_disabled" default="false"> A disabled collision shape has no effect in the world. </member> - <member name="shape" type="Shape" setter="set_shape" getter="get_shape"> + <member name="shape" type="Shape3D" setter="set_shape" getter="get_shape"> The actual shape owned by this collision shape. </member> </members> diff --git a/doc/classes/ConcavePolygonShape.xml b/doc/classes/ConcavePolygonShape3D.xml index 47f2276c63..20402d350a 100644 --- a/doc/classes/ConcavePolygonShape.xml +++ b/doc/classes/ConcavePolygonShape3D.xml @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ConcavePolygonShape" inherits="Shape" version="4.0"> +<class name="ConcavePolygonShape3D" inherits="Shape3D" version="4.0"> <brief_description> Concave polygon shape. </brief_description> <description> - Concave polygon shape resource, which can be set into a [PhysicsBody] or area. This shape is created by feeding a list of triangles. - Note: when used for collision, [ConcavePolygonShape] is intended to work with static [PhysicsBody] nodes like [StaticBody] and will not work with [KinematicBody] or [RigidBody] with a mode other than Static. + Concave polygon shape resource, which can be set into a [PhysicsBody3D] or area. This shape is created by feeding a list of triangles. + Note: when used for collision, [ConcavePolygonShape3D] is intended to work with static [PhysicsBody3D] nodes like [StaticBody3D] and will not work with [KinematicBody3D] or [RigidBody3D] with a mode other than Static. </description> <tutorials> </tutorials> diff --git a/doc/classes/ConeTwistJoint.xml b/doc/classes/ConeTwistJoint3D.xml index 8682391a73..e86e95bec3 100644 --- a/doc/classes/ConeTwistJoint.xml +++ b/doc/classes/ConeTwistJoint3D.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ConeTwistJoint" inherits="Joint" version="4.0"> +<class name="ConeTwistJoint3D" inherits="Joint3D" version="4.0"> <brief_description> A twist joint between two 3D bodies. </brief_description> <description> - The joint can rotate the bodies across an axis defined by the local x-axes of the [Joint]. - The twist axis is initiated as the X axis of the [Joint]. - Once the Bodies swing, the twist axis is calculated as the middle of the x-axes of the Joint in the local space of the two Bodies. + The joint can rotate the bodies across an axis defined by the local x-axes of the [Joint3D]. + The twist axis is initiated as the X axis of the [Joint3D]. + Once the Bodies swing, the twist axis is calculated as the middle of the x-axes of the Joint3D in the local space of the two Bodies. </description> <tutorials> </tutorials> @@ -14,7 +14,7 @@ <method name="get_param" qualifiers="const"> <return type="float"> </return> - <argument index="0" name="param" type="int" enum="ConeTwistJoint.Param"> + <argument index="0" name="param" type="int" enum="ConeTwistJoint3D.Param"> </argument> <description> </description> @@ -22,7 +22,7 @@ <method name="set_param"> <return type="void"> </return> - <argument index="0" name="param" type="int" enum="ConeTwistJoint.Param"> + <argument index="0" name="param" type="int" enum="ConeTwistJoint3D.Param"> </argument> <argument index="1" name="value" type="float"> </argument> @@ -44,7 +44,7 @@ <member name="swing_span" type="float" setter="_set_swing_span" getter="_get_swing_span" default="45.0"> Swing is rotation from side to side, around the axis perpendicular to the twist axis. The swing span defines, how much rotation will not get corrected along the swing axis. - Could be defined as looseness in the [ConeTwistJoint]. + Could be defined as looseness in the [ConeTwistJoint3D]. If below 0.05, this behavior is locked. </member> <member name="twist_span" type="float" setter="_set_twist_span" getter="_get_twist_span" default="180.0"> @@ -56,7 +56,7 @@ <constant name="PARAM_SWING_SPAN" value="0" enum="Param"> Swing is rotation from side to side, around the axis perpendicular to the twist axis. The swing span defines, how much rotation will not get corrected along the swing axis. - Could be defined as looseness in the [ConeTwistJoint]. + Could be defined as looseness in the [ConeTwistJoint3D]. If below 0.05, this behavior is locked. </constant> <constant name="PARAM_TWIST_SPAN" value="1" enum="Param"> diff --git a/doc/classes/ConfigFile.xml b/doc/classes/ConfigFile.xml index a16326d55a..522d484131 100644 --- a/doc/classes/ConfigFile.xml +++ b/doc/classes/ConfigFile.xml @@ -8,7 +8,7 @@ [codeblock] [section] some_key=42 - string_example="Hello World!" + string_example="Hello World3D!" a_vector=Vector3( 1, 0, 2 ) [/codeblock] The stored data can be saved to or parsed from a file, though ConfigFile objects can also be used directly without accessing the filesystem. diff --git a/doc/classes/ConfirmationDialog.xml b/doc/classes/ConfirmationDialog.xml index 801d9508dd..6d5871508b 100644 --- a/doc/classes/ConfirmationDialog.xml +++ b/doc/classes/ConfirmationDialog.xml @@ -22,8 +22,9 @@ </method> </methods> <members> - <member name="rect_min_size" type="Vector2" setter="set_custom_minimum_size" getter="get_custom_minimum_size" override="true" default="Vector2( 200, 70 )" /> - <member name="window_title" type="String" setter="set_title" getter="get_title" override="true" default=""Please Confirm..."" /> + <member name="min_size" type="Vector2i" setter="set_min_size" getter="get_min_size" override="true" default="Vector2i( 200, 70 )" /> + <member name="size" type="Vector2i" setter="set_size" getter="get_size" override="true" default="Vector2i( 200, 100 )" /> + <member name="title" type="String" setter="set_title" getter="get_title" override="true" default=""Please Confirm..."" /> </members> <constants> </constants> diff --git a/doc/classes/Control.xml b/doc/classes/Control.xml index 89db5baf8a..85a75fda37 100644 --- a/doc/classes/Control.xml +++ b/doc/classes/Control.xml @@ -7,10 +7,12 @@ Base class for all UI-related nodes. [Control] features a bounding rectangle that defines its extents, an anchor position relative to its parent control or the current viewport, and margins that represent an offset to the anchor. The margins update automatically when the node, any of its parents, or the screen size change. For more information on Godot's UI system, anchors, margins, and containers, see the related tutorials in the manual. To build flexible UIs, you'll need a mix of UI elements that inherit from [Control] and [Container] nodes. [b]User Interface nodes and input[/b] - Godot sends input events to the scene's root node first, by calling [method Node._input]. [method Node._input] forwards the event down the node tree to the nodes under the mouse cursor, or on keyboard focus. To do so, it calls [method MainLoop._input_event]. Call [method accept_event] so no other node receives the event. Once you accepted an input, it becomes handled so [method Node._unhandled_input] will not process it. + Godot sends input events to the scene's root node first, by calling [method Node._input]. [method Node._input] forwards the event down the node tree to the nodes under the mouse cursor, or on keyboard focus. To do so, it calls [code]MainLoop._input_event[/code]. + [b]FIXME:[/b] No longer valid after DisplayServer split and Input refactoring. + Call [method accept_event] so no other node receives the event. Once you accepted an input, it becomes handled so [method Node._unhandled_input] will not process it. Only one [Control] node can be in keyboard focus. Only the node in focus will receive keyboard events. To get the focus, call [method grab_focus]. [Control] nodes lose focus when another node grabs it, or if you hide the node in focus. Sets [member mouse_filter] to [constant MOUSE_FILTER_IGNORE] to tell a [Control] node to ignore mouse or touch events. You'll need it if you place an icon on top of a button. - [Theme] resources change the Control's appearance. If you change the [Theme] on a [Control] node, it affects all of its children. To override some of the theme's parameters, call one of the [code]add_*_override[/code] methods, like [method add_font_override]. You can override the theme with the inspector. + [Theme] resources change the Control's appearance. If you change the [Theme] on a [Control] node, it affects all of its children. To override some of the theme's parameters, call one of the [code]add_theme_*_override[/code] methods, like [method add_theme_font_override]. You can override the theme with the inspector. </description> <tutorials> <link>https://docs.godotengine.org/en/latest/tutorials/gui/index.html</link> @@ -87,7 +89,7 @@ Marks an input event as handled. Once you accept an input event, it stops propagating, even to nodes listening to [method Node._unhandled_input] or [method Node._unhandled_key_input]. </description> </method> - <method name="add_color_override"> + <method name="add_theme_color_override"> <return type="void"> </return> <argument index="0" name="name" type="StringName"> @@ -98,7 +100,7 @@ Overrides the [Color] with given [code]name[/code] in the [member theme] resource the control uses. If the [code]color[/code] is empty or invalid, the override is cleared and the color from assigned [Theme] is used. </description> </method> - <method name="add_constant_override"> + <method name="add_theme_constant_override"> <return type="void"> </return> <argument index="0" name="name" type="StringName"> @@ -109,7 +111,7 @@ Overrides an integer constant with given [code]name[/code] in the [member theme] resource the control uses. If the [code]constant[/code] is empty or invalid, the override is cleared and the constant from assigned [Theme] is used. </description> </method> - <method name="add_font_override"> + <method name="add_theme_font_override"> <return type="void"> </return> <argument index="0" name="name" type="StringName"> @@ -120,7 +122,7 @@ Overrides the font with given [code]name[/code] in the [member theme] resource the control uses. If [code]font[/code] is empty or invalid, the override is cleared and the font from assigned [Theme] is used. </description> </method> - <method name="add_icon_override"> + <method name="add_theme_icon_override"> <return type="void"> </return> <argument index="0" name="name" type="StringName"> @@ -131,7 +133,7 @@ Overrides the icon with given [code]name[/code] in the [member theme] resource the control uses. If [code]icon[/code] is empty or invalid, the override is cleared and the icon from assigned [Theme] is used. </description> </method> - <method name="add_shader_override"> + <method name="add_theme_shader_override"> <return type="void"> </return> <argument index="0" name="name" type="StringName"> @@ -142,7 +144,7 @@ Overrides the [Shader] with given [code]name[/code] in the [member theme] resource the control uses. If [code]shader[/code] is empty or invalid, the override is cleared and the shader from assigned [Theme] is used. </description> </method> - <method name="add_stylebox_override"> + <method name="add_theme_stylebox_override"> <return type="void"> </return> <argument index="0" name="name" type="StringName"> @@ -217,21 +219,6 @@ Returns [member margin_left] and [member margin_top]. See also [member rect_position]. </description> </method> - <method name="get_color" qualifiers="const"> - <return type="Color"> - </return> - <argument index="0" name="name" type="StringName"> - </argument> - <argument index="1" name="type" type="StringName" default=""""> - </argument> - <description> - Returns a color from assigned [Theme] with given [code]name[/code] and associated with [Control] of given [code]type[/code]. - [codeblock] - func _ready(): - modulate = get_color("font_color", "Button") #get the color defined for button fonts - [/codeblock] - </description> - </method> <method name="get_combined_minimum_size" qualifiers="const"> <return type="Vector2"> </return> @@ -239,17 +226,6 @@ Returns combined minimum size from [member rect_min_size] and [method get_minimum_size]. </description> </method> - <method name="get_constant" qualifiers="const"> - <return type="int"> - </return> - <argument index="0" name="name" type="StringName"> - </argument> - <argument index="1" name="type" type="StringName" default=""""> - </argument> - <description> - Returns a constant from assigned [Theme] with given [code]name[/code] and associated with [Control] of given [code]type[/code]. - </description> - </method> <method name="get_cursor_shape" qualifiers="const"> <return type="int" enum="Control.CursorShape"> </return> @@ -298,17 +274,6 @@ Returns the control that has the keyboard focus or [code]null[/code] if none. </description> </method> - <method name="get_font" qualifiers="const"> - <return type="Font"> - </return> - <argument index="0" name="name" type="StringName"> - </argument> - <argument index="1" name="type" type="StringName" default=""""> - </argument> - <description> - Returns a font from assigned [Theme] with given [code]name[/code] and associated with [Control] of given [code]type[/code]. - </description> - </method> <method name="get_global_rect" qualifiers="const"> <return type="Rect2"> </return> @@ -316,17 +281,6 @@ Returns the position and size of the control relative to the top-left corner of the screen. See [member rect_position] and [member rect_size]. </description> </method> - <method name="get_icon" qualifiers="const"> - <return type="Texture2D"> - </return> - <argument index="0" name="name" type="StringName"> - </argument> - <argument index="1" name="type" type="StringName" default=""""> - </argument> - <description> - Returns an icon from assigned [Theme] with given [code]name[/code] and associated with [Control] of given [code]type[/code]. - </description> - </method> <method name="get_margin" qualifiers="const"> <return type="float"> </return> @@ -371,7 +325,55 @@ Returns the rotation (in radians). </description> </method> - <method name="get_stylebox" qualifiers="const"> + <method name="get_theme_color" qualifiers="const"> + <return type="Color"> + </return> + <argument index="0" name="name" type="StringName"> + </argument> + <argument index="1" name="type" type="StringName" default=""""> + </argument> + <description> + Returns a color from assigned [Theme] with given [code]name[/code] and associated with [Control] of given [code]type[/code]. + [codeblock] + func _ready(): + modulate = get_theme_color("font_color", "Button") #get the color defined for button fonts + [/codeblock] + </description> + </method> + <method name="get_theme_constant" qualifiers="const"> + <return type="int"> + </return> + <argument index="0" name="name" type="StringName"> + </argument> + <argument index="1" name="type" type="StringName" default=""""> + </argument> + <description> + Returns a constant from assigned [Theme] with given [code]name[/code] and associated with [Control] of given [code]type[/code]. + </description> + </method> + <method name="get_theme_font" qualifiers="const"> + <return type="Font"> + </return> + <argument index="0" name="name" type="StringName"> + </argument> + <argument index="1" name="type" type="StringName" default=""""> + </argument> + <description> + Returns a font from assigned [Theme] with given [code]name[/code] and associated with [Control] of given [code]type[/code]. + </description> + </method> + <method name="get_theme_icon" qualifiers="const"> + <return type="Texture2D"> + </return> + <argument index="0" name="name" type="StringName"> + </argument> + <argument index="1" name="type" type="StringName" default=""""> + </argument> + <description> + Returns an icon from assigned [Theme] with given [code]name[/code] and associated with [Control] of given [code]type[/code]. + </description> + </method> + <method name="get_theme_stylebox" qualifiers="const"> <return type="StyleBox"> </return> <argument index="0" name="name" type="StringName"> @@ -409,7 +411,25 @@ Steal the focus from another control and become the focused control (see [member focus_mode]). </description> </method> - <method name="has_color" qualifiers="const"> + <method name="has_focus" qualifiers="const"> + <return type="bool"> + </return> + <description> + Returns [code]true[/code] if this is the current focused control. See [member focus_mode]. + </description> + </method> + <method name="has_point" qualifiers="virtual"> + <return type="bool"> + </return> + <argument index="0" name="point" type="Vector2"> + </argument> + <description> + Virtual method to be implemented by the user. Returns whether the given [code]point[/code] is inside this control. + If not overridden, default behavior is checking if the point is within control's Rect. + [b]Note:[/b] If you want to check if a point is inside the control, you can use [code]get_rect().has_point(point)[/code]. + </description> + </method> + <method name="has_theme_color" qualifiers="const"> <return type="bool"> </return> <argument index="0" name="name" type="StringName"> @@ -420,7 +440,7 @@ Returns [code]true[/code] if [Color] with given [code]name[/code] and associated with [Control] of given [code]type[/code] exists in assigned [Theme]. </description> </method> - <method name="has_color_override" qualifiers="const"> + <method name="has_theme_color_override" qualifiers="const"> <return type="bool"> </return> <argument index="0" name="name" type="StringName"> @@ -429,7 +449,7 @@ Returns [code]true[/code] if [Color] with given [code]name[/code] has a valid override in this [Control] node. </description> </method> - <method name="has_constant" qualifiers="const"> + <method name="has_theme_constant" qualifiers="const"> <return type="bool"> </return> <argument index="0" name="name" type="StringName"> @@ -440,7 +460,7 @@ Returns [code]true[/code] if constant with given [code]name[/code] and associated with [Control] of given [code]type[/code] exists in assigned [Theme]. </description> </method> - <method name="has_constant_override" qualifiers="const"> + <method name="has_theme_constant_override" qualifiers="const"> <return type="bool"> </return> <argument index="0" name="name" type="StringName"> @@ -449,14 +469,7 @@ Returns [code]true[/code] if constant with given [code]name[/code] has a valid override in this [Control] node. </description> </method> - <method name="has_focus" qualifiers="const"> - <return type="bool"> - </return> - <description> - Returns [code]true[/code] if this is the current focused control. See [member focus_mode]. - </description> - </method> - <method name="has_font" qualifiers="const"> + <method name="has_theme_font" qualifiers="const"> <return type="bool"> </return> <argument index="0" name="name" type="StringName"> @@ -467,7 +480,7 @@ Returns [code]true[/code] if font with given [code]name[/code] and associated with [Control] of given [code]type[/code] exists in assigned [Theme]. </description> </method> - <method name="has_font_override" qualifiers="const"> + <method name="has_theme_font_override" qualifiers="const"> <return type="bool"> </return> <argument index="0" name="name" type="StringName"> @@ -476,7 +489,7 @@ Returns [code]true[/code] if font with given [code]name[/code] has a valid override in this [Control] node. </description> </method> - <method name="has_icon" qualifiers="const"> + <method name="has_theme_icon" qualifiers="const"> <return type="bool"> </return> <argument index="0" name="name" type="StringName"> @@ -487,7 +500,7 @@ Returns [code]true[/code] if icon with given [code]name[/code] and associated with [Control] of given [code]type[/code] exists in assigned [Theme]. </description> </method> - <method name="has_icon_override" qualifiers="const"> + <method name="has_theme_icon_override" qualifiers="const"> <return type="bool"> </return> <argument index="0" name="name" type="StringName"> @@ -496,18 +509,7 @@ Returns [code]true[/code] if icon with given [code]name[/code] has a valid override in this [Control] node. </description> </method> - <method name="has_point" qualifiers="virtual"> - <return type="bool"> - </return> - <argument index="0" name="point" type="Vector2"> - </argument> - <description> - Virtual method to be implemented by the user. Returns whether the given [code]point[/code] is inside this control. - If not overridden, default behavior is checking if the point is within control's Rect. - [b]Note:[/b] If you want to check if a point is inside the control, you can use [code]get_rect().has_point(point)[/code]. - </description> - </method> - <method name="has_shader_override" qualifiers="const"> + <method name="has_theme_shader_override" qualifiers="const"> <return type="bool"> </return> <argument index="0" name="name" type="StringName"> @@ -516,7 +518,7 @@ Returns [code]true[/code] if [Shader] with given [code]name[/code] has a valid override in this [Control] node. </description> </method> - <method name="has_stylebox" qualifiers="const"> + <method name="has_theme_stylebox" qualifiers="const"> <return type="bool"> </return> <argument index="0" name="name" type="StringName"> @@ -527,7 +529,7 @@ Returns [code]true[/code] if [StyleBox] with given [code]name[/code] and associated with [Control] of given [code]type[/code] exists in assigned [Theme]. </description> </method> - <method name="has_stylebox_override" qualifiers="const"> + <method name="has_theme_stylebox_override" qualifiers="const"> <return type="bool"> </return> <argument index="0" name="name" type="StringName"> @@ -757,16 +759,6 @@ If [code]keep_margins[/code] is [code]true[/code], control's anchors will be updated instead of margins. </description> </method> - <method name="show_modal"> - <return type="void"> - </return> - <argument index="0" name="exclusive" type="bool" default="false"> - </argument> - <description> - Displays a control as modal. Control must be a subwindow. Modal controls capture the input signals until closed or the area outside them is accessed. When a modal control loses focus, or the ESC key is pressed, they automatically hide. Modal controls are used extensively for popup dialogs and menus. - If [code]exclusive[/code] is [code]true[/code], other controls will not receive input and clicking outside this control will not close it. - </description> - </method> <method name="warp_mouse"> <return type="void"> </return> @@ -905,11 +897,6 @@ Emitted when the node's minimum size changes. </description> </signal> - <signal name="modal_closed"> - <description> - Emitted when a modal [Control] is closed. See [method show_modal]. - </description> - </signal> <signal name="mouse_entered"> <description> Emitted when the mouse enters the control's [code]Rect[/code] area, provided its [member mouse_filter] lets the event reach it. @@ -930,6 +917,10 @@ Emitted when one of the size flags changes. See [member size_flags_horizontal] and [member size_flags_vertical]. </description> </signal> + <signal name="theme_changed"> + <description> + </description> + </signal> </signals> <constants> <constant name="FOCUS_NONE" value="0" enum="FocusMode"> @@ -957,10 +948,7 @@ Sent when the node loses focus. </constant> <constant name="NOTIFICATION_THEME_CHANGED" value="45"> - Sent when the node's [member theme] changes, right before Godot redraws the control. Happens when you call one of the [code]add_*_override[/code] methods. - </constant> - <constant name="NOTIFICATION_MODAL_CLOSE" value="46"> - Sent when an open modal dialog closes. See [method show_modal]. + Sent when the node's [member theme] changes, right before Godot redraws the control. Happens when you call one of the [code]add_theme_*_override[/code] methods. </constant> <constant name="NOTIFICATION_SCROLL_BEGIN" value="47"> Sent when this node is inside a [ScrollContainer] which has begun being scrolled. diff --git a/doc/classes/ConvexPolygonShape.xml b/doc/classes/ConvexPolygonShape3D.xml index 077bb57a03..c036f80e2d 100644 --- a/doc/classes/ConvexPolygonShape.xml +++ b/doc/classes/ConvexPolygonShape3D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ConvexPolygonShape" inherits="Shape" version="4.0"> +<class name="ConvexPolygonShape3D" inherits="Shape3D" version="4.0"> <brief_description> Convex polygon shape for 3D physics. </brief_description> <description> - Convex polygon shape resource, which can be added to a [PhysicsBody] or area. + Convex polygon shape resource, which can be added to a [PhysicsBody3D] or area. </description> <tutorials> </tutorials> diff --git a/doc/classes/Curve3D.xml b/doc/classes/Curve3D.xml index 5024cdefbd..fe454d90cc 100644 --- a/doc/classes/Curve3D.xml +++ b/doc/classes/Curve3D.xml @@ -4,7 +4,7 @@ Describes a Bézier curve in 3D space. </brief_description> <description> - This class describes a Bézier curve in 3D space. It is mainly used to give a shape to a [Path], but can be manually sampled for other purposes. + This class describes a Bézier curve in 3D space. It is mainly used to give a shape to a [Path3D], but can be manually sampled for other purposes. It keeps a cache of precalculated points along the curve, to speed up further calculations. </description> <tutorials> @@ -223,7 +223,7 @@ </argument> <description> Sets the tilt angle in radians for the point [code]idx[/code]. If the index is out of bounds, the function sends an error to the console. - The tilt controls the rotation along the look-at axis an object traveling the path would have. In the case of a curve controlling a [PathFollow], this tilt is an offset over the natural tilt the [PathFollow] calculates. + The tilt controls the rotation along the look-at axis an object traveling the path would have. In the case of a curve controlling a [PathFollow3D], this tilt is an offset over the natural tilt the [PathFollow3D] calculates. </description> </method> <method name="tessellate" qualifiers="const"> @@ -246,7 +246,7 @@ The distance in meters between two adjacent cached points. Changing it forces the cache to be recomputed the next time the [method get_baked_points] or [method get_baked_length] function is called. The smaller the distance, the more points in the cache and the more memory it will consume, so use with care. </member> <member name="up_vector_enabled" type="bool" setter="set_up_vector_enabled" getter="is_up_vector_enabled" default="true"> - If [code]true[/code], the curve will bake up vectors used for orientation. This is used when [member PathFollow.rotation_mode] is set to [constant PathFollow.ROTATION_ORIENTED]. Changing it forces the cache to be recomputed. + If [code]true[/code], the curve will bake up vectors used for orientation. This is used when [member PathFollow3D.rotation_mode] is set to [constant PathFollow3D.ROTATION_ORIENTED]. Changing it forces the cache to be recomputed. </member> </members> <constants> diff --git a/doc/classes/CylinderShape.xml b/doc/classes/CylinderShape3D.xml index 54adbd3b04..eb12568e71 100644 --- a/doc/classes/CylinderShape.xml +++ b/doc/classes/CylinderShape3D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="CylinderShape" inherits="Shape" version="4.0"> +<class name="CylinderShape3D" inherits="Shape3D" version="4.0"> <brief_description> Cylinder shape for collisions. </brief_description> diff --git a/doc/classes/DirectionalLight.xml b/doc/classes/DirectionalLight3D.xml index a3ef830d5d..a5d476f5c8 100644 --- a/doc/classes/DirectionalLight.xml +++ b/doc/classes/DirectionalLight3D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="DirectionalLight" inherits="Light" version="4.0"> +<class name="DirectionalLight3D" inherits="Light3D" version="4.0"> <brief_description> Directional light from a distance, as from the Sun. </brief_description> <description> - A directional light is a type of [Light] node that models an infinite number of parallel rays covering the entire scene. It is used for lights with strong intensity that are located far away from the scene to model sunlight or moonlight. The worldspace location of the DirectionalLight transform (origin) is ignored. Only the basis is used to determine light direction. + A directional light is a type of [Light3D] node that models an infinite number of parallel rays covering the entire scene. It is used for lights with strong intensity that are located far away from the scene to model sunlight or moonlight. The worldspace location of the DirectionalLight3D transform (origin) is ignored. Only the basis is used to determine light direction. </description> <tutorials> <link>https://docs.godotengine.org/en/latest/tutorials/3d/lights_and_shadows.html</link> @@ -18,7 +18,7 @@ <member name="directional_shadow_blend_splits" type="bool" setter="set_blend_splits" getter="is_blend_splits_enabled" default="false"> If [code]true[/code], shadow detail is sacrificed in exchange for smoother transitions between splits. </member> - <member name="directional_shadow_depth_range" type="int" setter="set_shadow_depth_range" getter="get_shadow_depth_range" enum="DirectionalLight.ShadowDepthRange" default="0"> + <member name="directional_shadow_depth_range" type="int" setter="set_shadow_depth_range" getter="get_shadow_depth_range" enum="DirectionalLight3D.ShadowDepthRange" default="0"> Optimizes shadow rendering for detail versus movement. See [enum ShadowDepthRange]. </member> <member name="directional_shadow_fade_start" type="float" setter="set_param" getter="get_param" default="0.8"> @@ -26,7 +26,7 @@ <member name="directional_shadow_max_distance" type="float" setter="set_param" getter="get_param" default="100.0"> The maximum distance for shadow splits. </member> - <member name="directional_shadow_mode" type="int" setter="set_shadow_mode" getter="get_shadow_mode" enum="DirectionalLight.ShadowMode" default="2"> + <member name="directional_shadow_mode" type="int" setter="set_shadow_mode" getter="get_shadow_mode" enum="DirectionalLight3D.ShadowMode" default="2"> The light's shadow rendering algorithm. See [enum ShadowMode]. </member> <member name="directional_shadow_normal_bias" type="float" setter="set_param" getter="get_param" default="0.8"> diff --git a/doc/classes/DisplayServer.xml b/doc/classes/DisplayServer.xml new file mode 100644 index 0000000000..7fa64c21cb --- /dev/null +++ b/doc/classes/DisplayServer.xml @@ -0,0 +1,1059 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="DisplayServer" inherits="Object" version="4.0"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <methods> + <method name="alert"> + <return type="void"> + </return> + <argument index="0" name="text" type="String"> + </argument> + <argument index="1" name="title" type="String" default=""Alert!""> + </argument> + <description> + </description> + </method> + <method name="clipboard_get" qualifiers="const"> + <return type="String"> + </return> + <description> + </description> + </method> + <method name="clipboard_set"> + <return type="void"> + </return> + <argument index="0" name="clipboard" type="String"> + </argument> + <description> + </description> + </method> + <method name="console_set_visible"> + <return type="void"> + </return> + <argument index="0" name="console_visible" type="bool"> + </argument> + <description> + </description> + </method> + <method name="create_sub_window"> + <return type="int"> + </return> + <argument index="0" name="mode" type="int" enum="DisplayServer.WindowMode"> + </argument> + <argument index="1" name="rect" type="int"> + </argument> + <argument index="2" name="arg2" type="Rect2i" default="Rect2i( 0, 0, 0, 0 )"> + </argument> + <description> + </description> + </method> + <method name="cursor_get_shape" qualifiers="const"> + <return type="int" enum="DisplayServer.CursorShape"> + </return> + <description> + </description> + </method> + <method name="cursor_set_custom_image"> + <return type="void"> + </return> + <argument index="0" name="cursor" type="Resource"> + </argument> + <argument index="1" name="shape" type="int" enum="DisplayServer.CursorShape" default="0"> + </argument> + <argument index="2" name="hotspot" type="Vector2" default="Vector2( 0, 0 )"> + </argument> + <description> + </description> + </method> + <method name="cursor_set_shape"> + <return type="void"> + </return> + <argument index="0" name="shape" type="int" enum="DisplayServer.CursorShape"> + </argument> + <description> + </description> + </method> + <method name="delete_sub_window"> + <return type="void"> + </return> + <argument index="0" name="window_id" type="int"> + </argument> + <description> + </description> + </method> + <method name="dialog_input_text"> + <return type="int" enum="Error"> + </return> + <argument index="0" name="title" type="String"> + </argument> + <argument index="1" name="description" type="String"> + </argument> + <argument index="2" name="existing_text" type="PackedStringArray"> + </argument> + <argument index="3" name="callback" type="Callable"> + </argument> + <description> + </description> + </method> + <method name="dialog_show"> + <return type="int" enum="Error"> + </return> + <argument index="0" name="title" type="String"> + </argument> + <argument index="1" name="description" type="String"> + </argument> + <argument index="2" name="buttons" type="PackedStringArray"> + </argument> + <argument index="3" name="callback" type="Callable"> + </argument> + <description> + </description> + </method> + <method name="enable_for_stealing_focus"> + <return type="void"> + </return> + <argument index="0" name="process_id" type="int"> + </argument> + <description> + </description> + </method> + <method name="force_process_and_drop_events"> + <return type="void"> + </return> + <description> + </description> + </method> + <method name="get_latin_keyboard_variant" qualifiers="const"> + <return type="int" enum="DisplayServer.LatinKeyboardVariant"> + </return> + <description> + </description> + </method> + <method name="get_name" qualifiers="const"> + <return type="String"> + </return> + <description> + </description> + </method> + <method name="get_screen_count" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="get_swap_ok_cancel"> + <return type="bool"> + </return> + <description> + </description> + </method> + <method name="get_window_at_screen_position" qualifiers="const"> + <return type="int"> + </return> + <argument index="0" name="position" type="Vector2i"> + </argument> + <description> + </description> + </method> + <method name="get_window_list" qualifiers="const"> + <return type="PackedInt32Array"> + </return> + <description> + </description> + </method> + <method name="global_menu_add_check_item"> + <return type="void"> + </return> + <argument index="0" name="menu_root" type="String"> + </argument> + <argument index="1" name="label" type="String"> + </argument> + <argument index="2" name="callback" type="Callable"> + </argument> + <argument index="3" name="tag" type="Variant" default="null"> + </argument> + <description> + </description> + </method> + <method name="global_menu_add_item"> + <return type="void"> + </return> + <argument index="0" name="menu_root" type="String"> + </argument> + <argument index="1" name="label" type="String"> + </argument> + <argument index="2" name="callback" type="Callable"> + </argument> + <argument index="3" name="tag" type="Variant" default="null"> + </argument> + <description> + </description> + </method> + <method name="global_menu_add_separator"> + <return type="void"> + </return> + <argument index="0" name="menu_root" type="String"> + </argument> + <description> + </description> + </method> + <method name="global_menu_add_submenu_item"> + <return type="void"> + </return> + <argument index="0" name="menu_root" type="String"> + </argument> + <argument index="1" name="label" type="String"> + </argument> + <argument index="2" name="submenu" type="String"> + </argument> + <description> + </description> + </method> + <method name="global_menu_clear"> + <return type="void"> + </return> + <argument index="0" name="menu_root" type="String"> + </argument> + <description> + </description> + </method> + <method name="global_menu_get_item_callback"> + <return type="Callable"> + </return> + <argument index="0" name="menu_root" type="String"> + </argument> + <argument index="1" name="idx" type="int"> + </argument> + <description> + </description> + </method> + <method name="global_menu_get_item_submenu"> + <return type="String"> + </return> + <argument index="0" name="menu_root" type="String"> + </argument> + <argument index="1" name="idx" type="int"> + </argument> + <description> + </description> + </method> + <method name="global_menu_get_item_tag"> + <return type="Variant"> + </return> + <argument index="0" name="menu_root" type="String"> + </argument> + <argument index="1" name="idx" type="int"> + </argument> + <description> + </description> + </method> + <method name="global_menu_get_item_text"> + <return type="String"> + </return> + <argument index="0" name="menu_root" type="String"> + </argument> + <argument index="1" name="idx" type="int"> + </argument> + <description> + </description> + </method> + <method name="global_menu_is_item_checkable" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="menu_root" type="String"> + </argument> + <argument index="1" name="idx" type="int"> + </argument> + <description> + </description> + </method> + <method name="global_menu_is_item_checked" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="menu_root" type="String"> + </argument> + <argument index="1" name="idx" type="int"> + </argument> + <description> + </description> + </method> + <method name="global_menu_remove_item"> + <return type="void"> + </return> + <argument index="0" name="menu_root" type="String"> + </argument> + <argument index="1" name="idx" type="int"> + </argument> + <description> + </description> + </method> + <method name="global_menu_set_item_callback"> + <return type="void"> + </return> + <argument index="0" name="menu_root" type="String"> + </argument> + <argument index="1" name="idx" type="int"> + </argument> + <argument index="2" name="callback" type="Callable"> + </argument> + <description> + </description> + </method> + <method name="global_menu_set_item_checkable"> + <return type="void"> + </return> + <argument index="0" name="menu_root" type="String"> + </argument> + <argument index="1" name="idx" type="int"> + </argument> + <argument index="2" name="checkable" type="bool"> + </argument> + <description> + </description> + </method> + <method name="global_menu_set_item_checked"> + <return type="void"> + </return> + <argument index="0" name="menu_root" type="String"> + </argument> + <argument index="1" name="idx" type="int"> + </argument> + <argument index="2" name="checked" type="bool"> + </argument> + <description> + </description> + </method> + <method name="global_menu_set_item_submenu"> + <return type="void"> + </return> + <argument index="0" name="menu_root" type="String"> + </argument> + <argument index="1" name="idx" type="int"> + </argument> + <argument index="2" name="submenu" type="String"> + </argument> + <description> + </description> + </method> + <method name="global_menu_set_item_tag"> + <return type="void"> + </return> + <argument index="0" name="menu_root" type="String"> + </argument> + <argument index="1" name="idx" type="int"> + </argument> + <argument index="2" name="tag" type="Variant"> + </argument> + <description> + </description> + </method> + <method name="global_menu_set_item_text"> + <return type="void"> + </return> + <argument index="0" name="menu_root" type="String"> + </argument> + <argument index="1" name="idx" type="int"> + </argument> + <argument index="2" name="text" type="String"> + </argument> + <description> + </description> + </method> + <method name="has_feature" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="feature" type="int" enum="DisplayServer.Feature"> + </argument> + <description> + </description> + </method> + <method name="ime_get_selection" qualifiers="const"> + <return type="Vector2i"> + </return> + <description> + </description> + </method> + <method name="ime_get_text" qualifiers="const"> + <return type="String"> + </return> + <description> + </description> + </method> + <method name="is_console_visible" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> + <method name="mouse_get_absolute_position" qualifiers="const"> + <return type="Vector2i"> + </return> + <description> + </description> + </method> + <method name="mouse_get_button_state" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="mouse_get_mode" qualifiers="const"> + <return type="int" enum="DisplayServer.MouseMode"> + </return> + <description> + </description> + </method> + <method name="mouse_get_position" qualifiers="const"> + <return type="Vector2i"> + </return> + <description> + </description> + </method> + <method name="mouse_set_mode"> + <return type="void"> + </return> + <argument index="0" name="mouse_mode" type="int" enum="DisplayServer.MouseMode"> + </argument> + <description> + </description> + </method> + <method name="mouse_warp_to_position"> + <return type="void"> + </return> + <argument index="0" name="position" type="Vector2i"> + </argument> + <description> + </description> + </method> + <method name="native_video_is_playing" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> + <method name="native_video_pause"> + <return type="void"> + </return> + <description> + </description> + </method> + <method name="native_video_play"> + <return type="int" enum="Error"> + </return> + <argument index="0" name="path" type="String"> + </argument> + <argument index="1" name="volume" type="float"> + </argument> + <argument index="2" name="audio_track" type="String"> + </argument> + <argument index="3" name="subtitle_track" type="String"> + </argument> + <argument index="4" name="arg4" type="int"> + </argument> + <description> + </description> + </method> + <method name="native_video_stop"> + <return type="void"> + </return> + <description> + </description> + </method> + <method name="native_video_unpause"> + <return type="void"> + </return> + <description> + </description> + </method> + <method name="process_events"> + <return type="void"> + </return> + <description> + </description> + </method> + <method name="screen_get_dpi" qualifiers="const"> + <return type="int"> + </return> + <argument index="0" name="screen" type="int" default="-1"> + </argument> + <description> + </description> + </method> + <method name="screen_get_orientation" qualifiers="const"> + <return type="int" enum="DisplayServer.ScreenOrientation"> + </return> + <argument index="0" name="screen" type="int" default="-1"> + </argument> + <description> + </description> + </method> + <method name="screen_get_position" qualifiers="const"> + <return type="Vector2i"> + </return> + <argument index="0" name="screen" type="int" default="-1"> + </argument> + <description> + </description> + </method> + <method name="screen_get_scale" qualifiers="const"> + <return type="float"> + </return> + <argument index="0" name="screen" type="int" default="-1"> + </argument> + <description> + </description> + </method> + <method name="screen_get_size" qualifiers="const"> + <return type="Vector2i"> + </return> + <argument index="0" name="screen" type="int" default="-1"> + </argument> + <description> + </description> + </method> + <method name="screen_get_usable_rect" qualifiers="const"> + <return type="Rect2i"> + </return> + <argument index="0" name="screen" type="int" default="-1"> + </argument> + <description> + </description> + </method> + <method name="screen_is_kept_on" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> + <method name="screen_is_touchscreen" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="screen" type="int" default="-1"> + </argument> + <description> + </description> + </method> + <method name="screen_set_keep_on"> + <return type="void"> + </return> + <argument index="0" name="enable" type="bool"> + </argument> + <description> + </description> + </method> + <method name="screen_set_orientation"> + <return type="void"> + </return> + <argument index="0" name="orientation" type="int" enum="DisplayServer.ScreenOrientation"> + </argument> + <argument index="1" name="screen" type="int" default="-1"> + </argument> + <description> + </description> + </method> + <method name="set_icon"> + <return type="void"> + </return> + <argument index="0" name="image" type="Image"> + </argument> + <description> + </description> + </method> + <method name="set_native_icon"> + <return type="void"> + </return> + <argument index="0" name="filename" type="String"> + </argument> + <description> + </description> + </method> + <method name="virtual_keyboard_get_height" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="virtual_keyboard_hide"> + <return type="void"> + </return> + <description> + </description> + </method> + <method name="virtual_keyboard_show"> + <return type="void"> + </return> + <argument index="0" name="existing_text" type="String"> + </argument> + <argument index="1" name="position" type="Rect2" default="Rect2i( 0, 0, 0, 0 )"> + </argument> + <argument index="2" name="max_length" type="int" default="-1"> + </argument> + <description> + </description> + </method> + <method name="vsync_is_enabled" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> + <method name="vsync_is_using_via_compositor" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> + <method name="vsync_set_enabled"> + <return type="void"> + </return> + <argument index="0" name="enabled" type="bool"> + </argument> + <description> + </description> + </method> + <method name="vsync_set_use_via_compositor"> + <return type="void"> + </return> + <argument index="0" name="enabled" type="bool"> + </argument> + <description> + </description> + </method> + <method name="window_attach_instance_id"> + <return type="void"> + </return> + <argument index="0" name="instance_id" type="int"> + </argument> + <argument index="1" name="window_id" type="int" default="0"> + </argument> + <description> + </description> + </method> + <method name="window_can_draw" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="window_id" type="int" default="0"> + </argument> + <description> + </description> + </method> + <method name="window_get_attached_instance_id" qualifiers="const"> + <return type="int"> + </return> + <argument index="0" name="window_id" type="int" default="0"> + </argument> + <description> + </description> + </method> + <method name="window_get_current_screen" qualifiers="const"> + <return type="int"> + </return> + <argument index="0" name="window_id" type="int" default="0"> + </argument> + <description> + </description> + </method> + <method name="window_get_flag" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="flag" type="int" enum="DisplayServer.WindowFlags"> + </argument> + <argument index="1" name="window_id" type="int" default="0"> + </argument> + <description> + </description> + </method> + <method name="window_get_max_size" qualifiers="const"> + <return type="Vector2i"> + </return> + <argument index="0" name="window_id" type="int" default="0"> + </argument> + <description> + </description> + </method> + <method name="window_get_min_size" qualifiers="const"> + <return type="Vector2i"> + </return> + <argument index="0" name="window_id" type="int" default="0"> + </argument> + <description> + </description> + </method> + <method name="window_get_mode" qualifiers="const"> + <return type="int" enum="DisplayServer.WindowMode"> + </return> + <argument index="0" name="window_id" type="int" default="0"> + </argument> + <description> + </description> + </method> + <method name="window_get_position" qualifiers="const"> + <return type="Vector2i"> + </return> + <argument index="0" name="window_id" type="int" default="0"> + </argument> + <description> + </description> + </method> + <method name="window_get_real_size" qualifiers="const"> + <return type="Vector2i"> + </return> + <argument index="0" name="window_id" type="int" default="0"> + </argument> + <description> + </description> + </method> + <method name="window_get_size" qualifiers="const"> + <return type="Vector2i"> + </return> + <argument index="0" name="window_id" type="int" default="0"> + </argument> + <description> + </description> + </method> + <method name="window_move_to_foreground"> + <return type="void"> + </return> + <argument index="0" name="window_id" type="int" default="0"> + </argument> + <description> + </description> + </method> + <method name="window_request_attention"> + <return type="void"> + </return> + <argument index="0" name="window_id" type="int" default="0"> + </argument> + <description> + </description> + </method> + <method name="window_set_current_screen"> + <return type="void"> + </return> + <argument index="0" name="screen" type="int"> + </argument> + <argument index="1" name="window_id" type="int" default="0"> + </argument> + <description> + </description> + </method> + <method name="window_set_drop_files_callback"> + <return type="void"> + </return> + <argument index="0" name="callback" type="Callable"> + </argument> + <argument index="1" name="window_id" type="int" default="0"> + </argument> + <description> + </description> + </method> + <method name="window_set_flag"> + <return type="void"> + </return> + <argument index="0" name="flag" type="int" enum="DisplayServer.WindowFlags"> + </argument> + <argument index="1" name="enabled" type="bool"> + </argument> + <argument index="2" name="window_id" type="int" default="0"> + </argument> + <description> + </description> + </method> + <method name="window_set_ime_active"> + <return type="void"> + </return> + <argument index="0" name="active" type="bool"> + </argument> + <argument index="1" name="window_id" type="int" default="0"> + </argument> + <description> + </description> + </method> + <method name="window_set_ime_position"> + <return type="void"> + </return> + <argument index="0" name="position" type="Vector2i"> + </argument> + <argument index="1" name="window_id" type="int" default="0"> + </argument> + <description> + </description> + </method> + <method name="window_set_input_event_callback"> + <return type="void"> + </return> + <argument index="0" name="callback" type="Callable"> + </argument> + <argument index="1" name="window_id" type="int" default="0"> + </argument> + <description> + </description> + </method> + <method name="window_set_input_text_callback"> + <return type="void"> + </return> + <argument index="0" name="callback" type="Callable"> + </argument> + <argument index="1" name="window_id" type="int" default="0"> + </argument> + <description> + </description> + </method> + <method name="window_set_max_size"> + <return type="void"> + </return> + <argument index="0" name="max_size" type="Vector2i"> + </argument> + <argument index="1" name="window_id" type="int" default="0"> + </argument> + <description> + </description> + </method> + <method name="window_set_min_size"> + <return type="void"> + </return> + <argument index="0" name="min_size" type="Vector2i"> + </argument> + <argument index="1" name="window_id" type="int" default="0"> + </argument> + <description> + </description> + </method> + <method name="window_set_mode"> + <return type="void"> + </return> + <argument index="0" name="mode" type="int" enum="DisplayServer.WindowMode"> + </argument> + <argument index="1" name="window_id" type="int" default="0"> + </argument> + <description> + </description> + </method> + <method name="window_set_position"> + <return type="void"> + </return> + <argument index="0" name="position" type="Vector2i"> + </argument> + <argument index="1" name="window_id" type="int" default="0"> + </argument> + <description> + </description> + </method> + <method name="window_set_rect_changed_callback"> + <return type="void"> + </return> + <argument index="0" name="callback" type="Callable"> + </argument> + <argument index="1" name="window_id" type="int" default="0"> + </argument> + <description> + </description> + </method> + <method name="window_set_size"> + <return type="void"> + </return> + <argument index="0" name="size" type="Vector2i"> + </argument> + <argument index="1" name="window_id" type="int" default="0"> + </argument> + <description> + </description> + </method> + <method name="window_set_title"> + <return type="void"> + </return> + <argument index="0" name="title" type="String"> + </argument> + <argument index="1" name="window_id" type="int" default="0"> + </argument> + <description> + </description> + </method> + <method name="window_set_transient"> + <return type="void"> + </return> + <argument index="0" name="window_id" type="int"> + </argument> + <argument index="1" name="parent_window_id" type="int"> + </argument> + <description> + </description> + </method> + <method name="window_set_window_event_callback"> + <return type="void"> + </return> + <argument index="0" name="callback" type="Callable"> + </argument> + <argument index="1" name="window_id" type="int" default="0"> + </argument> + <description> + </description> + </method> + </methods> + <constants> + <constant name="FEATURE_GLOBAL_MENU" value="0" enum="Feature"> + </constant> + <constant name="FEATURE_SUBWINDOWS" value="1" enum="Feature"> + </constant> + <constant name="FEATURE_TOUCHSCREEN" value="2" enum="Feature"> + </constant> + <constant name="FEATURE_MOUSE" value="3" enum="Feature"> + </constant> + <constant name="FEATURE_MOUSE_WARP" value="4" enum="Feature"> + </constant> + <constant name="FEATURE_CLIPBOARD" value="5" enum="Feature"> + </constant> + <constant name="FEATURE_VIRTUAL_KEYBOARD" value="6" enum="Feature"> + </constant> + <constant name="FEATURE_CURSOR_SHAPE" value="7" enum="Feature"> + </constant> + <constant name="FEATURE_CUSTOM_CURSOR_SHAPE" value="8" enum="Feature"> + </constant> + <constant name="FEATURE_NATIVE_VIDEO" value="9" enum="Feature"> + </constant> + <constant name="FEATURE_NATIVE_DIALOG" value="10" enum="Feature"> + </constant> + <constant name="FEATURE_CONSOLE_WINDOW" value="11" enum="Feature"> + </constant> + <constant name="FEATURE_IME" value="12" enum="Feature"> + </constant> + <constant name="FEATURE_WINDOW_TRANSPARENCY" value="13" enum="Feature"> + </constant> + <constant name="FEATURE_HIDPI" value="14" enum="Feature"> + </constant> + <constant name="FEATURE_ICON" value="15" enum="Feature"> + </constant> + <constant name="FEATURE_NATIVE_ICON" value="16" enum="Feature"> + </constant> + <constant name="FEATURE_ORIENTATION" value="17" enum="Feature"> + </constant> + <constant name="FEATURE_SWAP_BUFFERS" value="18" enum="Feature"> + </constant> + <constant name="MOUSE_MODE_VISIBLE" value="0" enum="MouseMode"> + </constant> + <constant name="MOUSE_MODE_HIDDEN" value="1" enum="MouseMode"> + </constant> + <constant name="MOUSE_MODE_CAPTURED" value="2" enum="MouseMode"> + </constant> + <constant name="MOUSE_MODE_CONFINED" value="3" enum="MouseMode"> + </constant> + <constant name="SCREEN_OF_MAIN_WINDOW" value="-1"> + </constant> + <constant name="MAIN_WINDOW_ID" value="0"> + </constant> + <constant name="INVALID_WINDOW_ID" value="-1"> + </constant> + <constant name="SCREEN_LANDSCAPE" value="0" enum="ScreenOrientation"> + </constant> + <constant name="SCREEN_PORTRAIT" value="1" enum="ScreenOrientation"> + </constant> + <constant name="SCREEN_REVERSE_LANDSCAPE" value="2" enum="ScreenOrientation"> + </constant> + <constant name="SCREEN_REVERSE_PORTRAIT" value="3" enum="ScreenOrientation"> + </constant> + <constant name="SCREEN_SENSOR_LANDSCAPE" value="4" enum="ScreenOrientation"> + </constant> + <constant name="SCREEN_SENSOR_PORTRAIT" value="5" enum="ScreenOrientation"> + </constant> + <constant name="SCREEN_SENSOR" value="6" enum="ScreenOrientation"> + </constant> + <constant name="CURSOR_ARROW" value="0" enum="CursorShape"> + </constant> + <constant name="CURSOR_IBEAM" value="1" enum="CursorShape"> + </constant> + <constant name="CURSOR_POINTING_HAND" value="2" enum="CursorShape"> + </constant> + <constant name="CURSOR_CROSS" value="3" enum="CursorShape"> + </constant> + <constant name="CURSOR_WAIT" value="4" enum="CursorShape"> + </constant> + <constant name="CURSOR_BUSY" value="5" enum="CursorShape"> + </constant> + <constant name="CURSOR_DRAG" value="6" enum="CursorShape"> + </constant> + <constant name="CURSOR_CAN_DROP" value="7" enum="CursorShape"> + </constant> + <constant name="CURSOR_FORBIDDEN" value="8" enum="CursorShape"> + </constant> + <constant name="CURSOR_VSIZE" value="9" enum="CursorShape"> + </constant> + <constant name="CURSOR_HSIZE" value="10" enum="CursorShape"> + </constant> + <constant name="CURSOR_BDIAGSIZE" value="11" enum="CursorShape"> + </constant> + <constant name="CURSOR_FDIAGSIZE" value="12" enum="CursorShape"> + </constant> + <constant name="CURSOR_MOVE" value="13" enum="CursorShape"> + </constant> + <constant name="CURSOR_VSPLIT" value="14" enum="CursorShape"> + </constant> + <constant name="CURSOR_HSPLIT" value="15" enum="CursorShape"> + </constant> + <constant name="CURSOR_HELP" value="16" enum="CursorShape"> + </constant> + <constant name="CURSOR_MAX" value="17" enum="CursorShape"> + </constant> + <constant name="WINDOW_MODE_WINDOWED" value="0" enum="WindowMode"> + </constant> + <constant name="WINDOW_MODE_MINIMIZED" value="1" enum="WindowMode"> + </constant> + <constant name="WINDOW_MODE_MAXIMIZED" value="2" enum="WindowMode"> + </constant> + <constant name="WINDOW_MODE_FULLSCREEN" value="3" enum="WindowMode"> + </constant> + <constant name="WINDOW_FLAG_RESIZE_DISABLED" value="0" enum="WindowFlags"> + </constant> + <constant name="WINDOW_FLAG_BORDERLESS" value="1" enum="WindowFlags"> + </constant> + <constant name="WINDOW_FLAG_ALWAYS_ON_TOP" value="2" enum="WindowFlags"> + </constant> + <constant name="WINDOW_FLAG_TRANSPARENT" value="3" enum="WindowFlags"> + </constant> + <constant name="WINDOW_FLAG_NO_FOCUS" value="4" enum="WindowFlags"> + </constant> + <constant name="WINDOW_FLAG_MAX" value="5" enum="WindowFlags"> + </constant> + <constant name="WINDOW_FLAG_RESIZE_DISABLED_BIT" value="1" enum="WindowFlags"> + </constant> + <constant name="WINDOW_FLAG_BORDERLESS_BIT" value="2" enum="WindowFlags"> + </constant> + <constant name="WINDOW_FLAG_ALWAYS_ON_TOP_BIT" value="4" enum="WindowFlags"> + </constant> + <constant name="WINDOW_FLAG_TRANSPARENT_BIT" value="8" enum="WindowFlags"> + </constant> + <constant name="WINDOW_FLAG_NO_FOCUS_BIT" value="16" enum="WindowFlags"> + </constant> + <constant name="LATIN_KEYBOARD_QWERTY" value="0" enum="LatinKeyboardVariant"> + </constant> + <constant name="LATIN_KEYBOARD_QWERTZ" value="1" enum="LatinKeyboardVariant"> + </constant> + <constant name="LATIN_KEYBOARD_AZERTY" value="2" enum="LatinKeyboardVariant"> + </constant> + <constant name="LATIN_KEYBOARD_QZERTY" value="3" enum="LatinKeyboardVariant"> + </constant> + <constant name="LATIN_KEYBOARD_DVORAK" value="4" enum="LatinKeyboardVariant"> + </constant> + <constant name="LATIN_KEYBOARD_NEO" value="5" enum="LatinKeyboardVariant"> + </constant> + <constant name="LATIN_KEYBOARD_COLEMAK" value="6" enum="LatinKeyboardVariant"> + </constant> + <constant name="WINDOW_EVENT_MOUSE_ENTER" value="0" enum="WindowEvent"> + </constant> + <constant name="WINDOW_EVENT_MOUSE_EXIT" value="1" enum="WindowEvent"> + </constant> + <constant name="WINDOW_EVENT_FOCUS_IN" value="2" enum="WindowEvent"> + </constant> + <constant name="WINDOW_EVENT_FOCUS_OUT" value="3" enum="WindowEvent"> + </constant> + <constant name="WINDOW_EVENT_CLOSE_REQUEST" value="4" enum="WindowEvent"> + </constant> + <constant name="WINDOW_EVENT_GO_BACK_REQUEST" value="5" enum="WindowEvent"> + </constant> + <constant name="WINDOW_EVENT_DPI_CHANGE" value="6" enum="WindowEvent"> + </constant> + </constants> +</class> diff --git a/doc/classes/EditorFeatureProfile.xml b/doc/classes/EditorFeatureProfile.xml index 75b906d6d2..53db8dd293 100644 --- a/doc/classes/EditorFeatureProfile.xml +++ b/doc/classes/EditorFeatureProfile.xml @@ -5,7 +5,7 @@ </brief_description> <description> An editor feature profile can be used to disable specific features of the Godot editor. When disabled, the features won't appear in the editor, which makes the editor less cluttered. This is useful in education settings to reduce confusion or when working in a team. For example, artists and level designers could use a feature profile that disables the script editor to avoid accidentally making changes to files they aren't supposed to edit. - To manage editor feature profiles visually, use [b]Editor > Manage Feature Profiles...[/b] at the top of the editor window. + To manage editor feature profiles visually, use [b]Editor > Manage Feature Profiles...[/b] at the top of the editor window. </description> <tutorials> </tutorials> diff --git a/doc/classes/EditorFileDialog.xml b/doc/classes/EditorFileDialog.xml index 3e6bbd682d..084459e518 100644 --- a/doc/classes/EditorFileDialog.xml +++ b/doc/classes/EditorFileDialog.xml @@ -60,14 +60,13 @@ <member name="display_mode" type="int" setter="set_display_mode" getter="get_display_mode" enum="EditorFileDialog.DisplayMode" default="0"> The view format in which the [EditorFileDialog] displays resources to the user. </member> - <member name="mode" type="int" setter="set_mode" getter="get_mode" enum="EditorFileDialog.Mode" default="4"> - The purpose of the [EditorFileDialog], which defines the allowed behaviors. + <member name="file_mode" type="int" setter="set_file_mode" getter="get_file_mode" enum="EditorFileDialog.FileMode" default="4"> + The dialog's open or save mode, which affects the selection behavior. See [enum FileMode] </member> - <member name="resizable" type="bool" setter="set_resizable" getter="get_resizable" override="true" default="true" /> <member name="show_hidden_files" type="bool" setter="set_show_hidden_files" getter="is_showing_hidden_files" default="false"> If [code]true[/code], hidden files and directories will be visible in the [EditorFileDialog]. </member> - <member name="window_title" type="String" setter="set_title" getter="get_title" override="true" default=""Save a File"" /> + <member name="title" type="String" setter="set_title" getter="get_title" override="true" default=""Save a File"" /> </members> <signals> <signal name="dir_selected"> @@ -93,19 +92,19 @@ </signal> </signals> <constants> - <constant name="MODE_OPEN_FILE" value="0" enum="Mode"> + <constant name="FILE_MODE_OPEN_FILE" value="0" enum="FileMode"> The [EditorFileDialog] can select only one file. Accepting the window will open the file. </constant> - <constant name="MODE_OPEN_FILES" value="1" enum="Mode"> + <constant name="FILE_MODE_OPEN_FILES" value="1" enum="FileMode"> The [EditorFileDialog] can select multiple files. Accepting the window will open all files. </constant> - <constant name="MODE_OPEN_DIR" value="2" enum="Mode"> + <constant name="FILE_MODE_OPEN_DIR" value="2" enum="FileMode"> The [EditorFileDialog] can select only one directory. Accepting the window will open the directory. </constant> - <constant name="MODE_OPEN_ANY" value="3" enum="Mode"> + <constant name="FILE_MODE_OPEN_ANY" value="3" enum="FileMode"> The [EditorFileDialog] can select a file or directory. Accepting the window will open it. </constant> - <constant name="MODE_SAVE_FILE" value="4" enum="Mode"> + <constant name="FILE_MODE_SAVE_FILE" value="4" enum="FileMode"> The [EditorFileDialog] can select only one file. Accepting the window will save the file. </constant> <constant name="ACCESS_RESOURCES" value="0" enum="Access"> diff --git a/doc/classes/EditorSpatialGizmo.xml b/doc/classes/EditorNode3DGizmo.xml index b8c4daab07..6d695ddeea 100644 --- a/doc/classes/EditorSpatialGizmo.xml +++ b/doc/classes/EditorNode3DGizmo.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="EditorSpatialGizmo" inherits="SpatialGizmo" version="4.0"> +<class name="EditorNode3DGizmo" inherits="Node3DGizmo" version="4.0"> <brief_description> - Custom gizmo for editing Spatial objects. + Custom gizmo for editing Node3D objects. </brief_description> <description> - Custom gizmo that is used for providing custom visualization and editing (handles) for 3D Spatial objects. See [EditorSpatialGizmoPlugin] for more information. + Custom gizmo that is used for providing custom visualization and editing (handles) for Node3D objects. See [EditorNode3DGizmoPlugin] for more information. </description> <tutorials> </tutorials> @@ -124,17 +124,17 @@ </description> </method> <method name="get_plugin" qualifiers="const"> - <return type="EditorSpatialGizmoPlugin"> + <return type="EditorNode3DGizmoPlugin"> </return> <description> - Returns the [EditorSpatialGizmoPlugin] that owns this gizmo. It's useful to retrieve materials using [method EditorSpatialGizmoPlugin.get_material]. + Returns the [EditorNode3DGizmoPlugin] that owns this gizmo. It's useful to retrieve materials using [method EditorNode3DGizmoPlugin.get_material]. </description> </method> <method name="get_spatial_node" qualifiers="const"> - <return type="Spatial"> + <return type="Node3D"> </return> <description> - Returns the Spatial node associated with this gizmo. + Returns the Node3D node associated with this gizmo. </description> </method> <method name="is_handle_highlighted" qualifiers="virtual"> @@ -150,7 +150,7 @@ <return type="void"> </return> <description> - This function is called when the Spatial this gizmo refers to changes (the [method Spatial.update_gizmo] is called). + This function is called when the Node3D this gizmo refers to changes (the [method Node3D.update_gizmo] is called). </description> </method> <method name="set_handle" qualifiers="virtual"> @@ -158,13 +158,13 @@ </return> <argument index="0" name="index" type="int"> </argument> - <argument index="1" name="camera" type="Camera"> + <argument index="1" name="camera" type="Camera3D"> </argument> <argument index="2" name="point" type="Vector2"> </argument> <description> This function is used when the user drags a gizmo handle (previously added with [method add_handles]) in screen coordinates. - The [Camera] is also provided so screen coordinates can be converted to raycasts. + The [Camera3D] is also provided so screen coordinates can be converted to raycasts. </description> </method> <method name="set_hidden"> diff --git a/doc/classes/EditorSpatialGizmoPlugin.xml b/doc/classes/EditorNode3DGizmoPlugin.xml index b1a4a25a5f..ca75b47fbf 100644 --- a/doc/classes/EditorSpatialGizmoPlugin.xml +++ b/doc/classes/EditorNode3DGizmoPlugin.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="EditorSpatialGizmoPlugin" inherits="Resource" version="4.0"> +<class name="EditorNode3DGizmoPlugin" inherits="Resource" version="4.0"> <brief_description> - Used by the editor to define Spatial gizmo types. + Used by the editor to define Node3D gizmo types. </brief_description> <description> - EditorSpatialGizmoPlugin allows you to define a new type of Gizmo. There are two main ways to do so: extending [EditorSpatialGizmoPlugin] for the simpler gizmos, or creating a new [EditorSpatialGizmo] type. See the tutorial in the documentation for more info. + EditorNode3DGizmoPlugin allows you to define a new type of Gizmo. There are two main ways to do so: extending [EditorNode3DGizmoPlugin] for the simpler gizmos, or creating a new [EditorNode3DGizmo] type. See the tutorial in the documentation for more info. </description> <tutorials> <link>https://docs.godotengine.org/en/latest/tutorials/plugins/editor/spatial_gizmos.html</link> @@ -31,7 +31,7 @@ <method name="commit_handle" qualifiers="virtual"> <return type="void"> </return> - <argument index="0" name="gizmo" type="EditorSpatialGizmo"> + <argument index="0" name="gizmo" type="EditorNode3DGizmo"> </argument> <argument index="1" name="index" type="int"> </argument> @@ -44,12 +44,12 @@ </description> </method> <method name="create_gizmo" qualifiers="virtual"> - <return type="EditorSpatialGizmo"> + <return type="EditorNode3DGizmo"> </return> - <argument index="0" name="spatial" type="Spatial"> + <argument index="0" name="spatial" type="Node3D"> </argument> <description> - Override this method to return a custom [EditorSpatialGizmo] for the spatial nodes of your choice, return [code]null[/code] for the rest of nodes. See also [method has_gizmo]. + Override this method to return a custom [EditorNode3DGizmo] for the spatial nodes of your choice, return [code]null[/code] for the rest of nodes. See also [method has_gizmo]. </description> </method> <method name="create_handle_material"> @@ -60,7 +60,7 @@ <argument index="1" name="billboard" type="bool" default="false"> </argument> <description> - Creates a handle material with its variants (selected and/or editable) and adds them to the internal material list. They can then be accessed with [method get_material] and used in [method EditorSpatialGizmo.add_handles]. Should not be overridden. + Creates a handle material with its variants (selected and/or editable) and adds them to the internal material list. They can then be accessed with [method get_material] and used in [method EditorNode3DGizmo.add_handles]. Should not be overridden. </description> </method> <method name="create_icon_material"> @@ -75,7 +75,7 @@ <argument index="3" name="color" type="Color" default="Color( 1, 1, 1, 1 )"> </argument> <description> - Creates an icon material with its variants (selected and/or editable) and adds them to the internal material list. They can then be accessed with [method get_material] and used in [method EditorSpatialGizmo.add_unscaled_billboard]. Should not be overridden. + Creates an icon material with its variants (selected and/or editable) and adds them to the internal material list. They can then be accessed with [method get_material] and used in [method EditorNode3DGizmo.add_unscaled_billboard]. Should not be overridden. </description> </method> <method name="create_material"> @@ -92,13 +92,13 @@ <argument index="4" name="use_vertex_color" type="bool" default="false"> </argument> <description> - Creates an unshaded material with its variants (selected and/or editable) and adds them to the internal material list. They can then be accessed with [method get_material] and used in [method EditorSpatialGizmo.add_mesh] and [method EditorSpatialGizmo.add_lines]. Should not be overridden. + Creates an unshaded material with its variants (selected and/or editable) and adds them to the internal material list. They can then be accessed with [method get_material] and used in [method EditorNode3DGizmo.add_mesh] and [method EditorNode3DGizmo.add_lines]. Should not be overridden. </description> </method> <method name="get_handle_name" qualifiers="virtual"> <return type="String"> </return> - <argument index="0" name="gizmo" type="EditorSpatialGizmo"> + <argument index="0" name="gizmo" type="EditorNode3DGizmo"> </argument> <argument index="1" name="index" type="int"> </argument> @@ -109,7 +109,7 @@ <method name="get_handle_value" qualifiers="virtual"> <return type="Variant"> </return> - <argument index="0" name="gizmo" type="EditorSpatialGizmo"> + <argument index="0" name="gizmo" type="EditorNode3DGizmo"> </argument> <argument index="1" name="index" type="int"> </argument> @@ -122,10 +122,10 @@ </return> <argument index="0" name="name" type="String"> </argument> - <argument index="1" name="gizmo" type="EditorSpatialGizmo"> + <argument index="1" name="gizmo" type="EditorNode3DGizmo"> </argument> <description> - Gets material from the internal list of materials. If an [EditorSpatialGizmo] is provided, it will try to get the corresponding variant (selected and/or editable). + Gets material from the internal list of materials. If an [EditorNode3DGizmo] is provided, it will try to get the corresponding variant (selected and/or editable). </description> </method> <method name="get_name" qualifiers="virtual"> @@ -144,16 +144,16 @@ <method name="has_gizmo" qualifiers="virtual"> <return type="bool"> </return> - <argument index="0" name="spatial" type="Spatial"> + <argument index="0" name="spatial" type="Node3D"> </argument> <description> - Override this method to define which Spatial nodes have a gizmo from this plugin. Whenever a [Spatial] node is added to a scene this method is called, if it returns [code]true[/code] the node gets a generic [EditorSpatialGizmo] assigned and is added to this plugin's list of active gizmos. + Override this method to define which Node3D nodes have a gizmo from this plugin. Whenever a [Node3D] node is added to a scene this method is called, if it returns [code]true[/code] the node gets a generic [EditorNode3DGizmo] assigned and is added to this plugin's list of active gizmos. </description> </method> <method name="is_handle_highlighted" qualifiers="virtual"> <return type="bool"> </return> - <argument index="0" name="gizmo" type="EditorSpatialGizmo"> + <argument index="0" name="gizmo" type="EditorNode3DGizmo"> </argument> <argument index="1" name="index" type="int"> </argument> @@ -165,13 +165,13 @@ <return type="bool"> </return> <description> - Override this method to define whether Spatial with this gizmo should be selecteble even when the gizmo is hidden. + Override this method to define whether Node3D with this gizmo should be selecteble even when the gizmo is hidden. </description> </method> <method name="redraw" qualifiers="virtual"> <return type="void"> </return> - <argument index="0" name="gizmo" type="EditorSpatialGizmo"> + <argument index="0" name="gizmo" type="EditorNode3DGizmo"> </argument> <description> Callback to redraw the provided gizmo. Called for this plugin's active gizmos. @@ -180,11 +180,11 @@ <method name="set_handle" qualifiers="virtual"> <return type="void"> </return> - <argument index="0" name="gizmo" type="EditorSpatialGizmo"> + <argument index="0" name="gizmo" type="EditorNode3DGizmo"> </argument> <argument index="1" name="index" type="int"> </argument> - <argument index="2" name="camera" type="Camera"> + <argument index="2" name="camera" type="Camera3D"> </argument> <argument index="3" name="point" type="Vector2"> </argument> diff --git a/doc/classes/EditorPlugin.xml b/doc/classes/EditorPlugin.xml index 587fd51f1e..19583fca28 100644 --- a/doc/classes/EditorPlugin.xml +++ b/doc/classes/EditorPlugin.xml @@ -71,7 +71,7 @@ </argument> <description> Adds a custom type, which will appear in the list of nodes or resources. An icon can be optionally passed. - When given node or resource is selected, the base type will be instanced (e.g. "Spatial", "Control", "Resource"), then the script will be loaded and set to this object. + When given node or resource is selected, the base type will be instanced (e.g. "Node3D", "Control", "Resource"), then the script will be loaded and set to this object. You can use the virtual method [method handles] to check if your custom object is being edited by checking the script or using the [code]is[/code] keyword. During run-time, this will be a simple object with a script so this function does not need to be called then. </description> @@ -111,7 +111,7 @@ <method name="add_spatial_gizmo_plugin"> <return type="void"> </return> - <argument index="0" name="plugin" type="EditorSpatialGizmoPlugin"> + <argument index="0" name="plugin" type="EditorNode3DGizmoPlugin"> </argument> <description> </description> @@ -229,7 +229,7 @@ <method name="forward_spatial_gui_input" qualifiers="virtual"> <return type="bool"> </return> - <argument index="0" name="camera" type="Camera"> + <argument index="0" name="camera" type="Camera3D"> </argument> <argument index="1" name="event" type="InputEvent"> </argument> @@ -450,7 +450,7 @@ <method name="remove_spatial_gizmo_plugin"> <return type="void"> </return> - <argument index="0" name="plugin" type="EditorSpatialGizmoPlugin"> + <argument index="0" name="plugin" type="EditorNode3DGizmoPlugin"> </argument> <description> </description> diff --git a/doc/classes/Environment.xml b/doc/classes/Environment.xml index f5c04b3947..18d1fc8eca 100644 --- a/doc/classes/Environment.xml +++ b/doc/classes/Environment.xml @@ -108,7 +108,7 @@ If [code]true[/code], the depth fog effect is enabled. When enabled, fog will appear in the distance (relative to the camera). </member> <member name="fog_depth_end" type="float" setter="set_fog_depth_end" getter="get_fog_depth_end" default="100.0"> - The fog's depth end distance from the camera. If this value is set to 0, it will be equal to the current camera's [member Camera.far] value. + The fog's depth end distance from the camera. If this value is set to 0, it will be equal to the current camera's [member Camera3D.far] value. </member> <member name="fog_enabled" type="bool" setter="set_fog_enabled" getter="is_fog_enabled" default="false"> If [code]true[/code], fog effects are enabled. [member fog_height_enabled] and/or [member fog_depth_enabled] must be set to [code]true[/code] to actually display fog. @@ -126,7 +126,7 @@ The Y coordinate where the height fog will be the least intense. If this value is greater than [member fog_height_max], fog will be displayed from top to bottom. Otherwise, it will be displayed from bottom to top. </member> <member name="fog_sun_amount" type="float" setter="set_fog_sun_amount" getter="get_fog_sun_amount" default="0.0"> - The intensity of the depth fog color transition when looking towards the sun. The sun's direction is determined automatically using the DirectionalLight node in the scene. + The intensity of the depth fog color transition when looking towards the sun. The sun's direction is determined automatically using the DirectionalLight3D node in the scene. </member> <member name="fog_sun_color" type="Color" setter="set_fog_sun_color" getter="get_fog_sun_color" default="Color( 1, 0.9, 0.7, 1 )"> The depth fog's [Color] when looking towards the sun. @@ -137,10 +137,6 @@ <member name="fog_transmit_enabled" type="bool" setter="set_fog_transmit_enabled" getter="is_fog_transmit_enabled" default="false"> Enables fog's light transmission effect. If [code]true[/code], light will be more visible in the fog to simulate light scattering as in real life. </member> - <member name="glow_bicubic_upscale" type="bool" setter="set_glow_bicubic_upscale" getter="is_glow_bicubic_upscale_enabled" default="false"> - Smooths out the blockiness created by sampling higher levels, at the cost of performance. - [b]Note:[/b] When using the GLES2 renderer, this is only available if the GPU supports the [code]GL_EXT_gpu_shader4[/code] extension. - </member> <member name="glow_blend_mode" type="int" setter="set_glow_blend_mode" getter="get_glow_blend_mode" enum="Environment.GlowBlendMode" default="2"> The glow blending mode. </member> diff --git a/doc/classes/FileDialog.xml b/doc/classes/FileDialog.xml index 78fcec33ea..99563ee367 100644 --- a/doc/classes/FileDialog.xml +++ b/doc/classes/FileDialog.xml @@ -68,19 +68,19 @@ The currently selected file path of the file dialog. </member> <member name="dialog_hide_on_ok" type="bool" setter="set_hide_on_ok" getter="get_hide_on_ok" override="true" default="false" /> + <member name="file_mode" type="int" setter="set_file_mode" getter="get_file_mode" enum="FileDialog.FileMode" default="4"> + The dialog's open or save mode, which affects the selection behavior. See [enum FileMode]. + </member> <member name="filters" type="PackedStringArray" setter="set_filters" getter="get_filters" default="PackedStringArray( )"> The available file type filters. For example, this shows only [code].png[/code] and [code].gd[/code] files: [code]set_filters(PackedStringArray(["*.png ; PNG Images","*.gd ; GDScript Files"]))[/code]. </member> - <member name="mode" type="int" setter="set_mode" getter="get_mode" enum="FileDialog.Mode" default="4"> - The dialog's open or save mode, which affects the selection behavior. See enum [code]Mode[/code] constants. - </member> <member name="mode_overrides_title" type="bool" setter="set_mode_overrides_title" getter="is_mode_overriding_title" default="true"> - If [code]true[/code], changing the [code]Mode[/code] property will set the window title accordingly (e.g. setting mode to [constant MODE_OPEN_FILE] will change the window title to "Open a File"). + If [code]true[/code], changing the [code]Mode[/code] property will set the window title accordingly (e.g. setting mode to [constant FILE_MODE_OPEN_FILE] will change the window title to "Open a File"). </member> <member name="show_hidden_files" type="bool" setter="set_show_hidden_files" getter="is_showing_hidden_files" default="false"> If [code]true[/code], the dialog will show hidden files. </member> - <member name="window_title" type="String" setter="set_title" getter="get_title" override="true" default=""Save a File"" /> + <member name="title" type="String" setter="set_title" getter="get_title" override="true" default=""Save a File"" /> </members> <signals> <signal name="dir_selected"> @@ -106,19 +106,19 @@ </signal> </signals> <constants> - <constant name="MODE_OPEN_FILE" value="0" enum="Mode"> + <constant name="FILE_MODE_OPEN_FILE" value="0" enum="FileMode"> The dialog allows selecting one, and only one file. </constant> - <constant name="MODE_OPEN_FILES" value="1" enum="Mode"> + <constant name="FILE_MODE_OPEN_FILES" value="1" enum="FileMode"> The dialog allows selecting multiple files. </constant> - <constant name="MODE_OPEN_DIR" value="2" enum="Mode"> + <constant name="FILE_MODE_OPEN_DIR" value="2" enum="FileMode"> The dialog only allows selecting a directory, disallowing the selection of any file. </constant> - <constant name="MODE_OPEN_ANY" value="3" enum="Mode"> + <constant name="FILE_MODE_OPEN_ANY" value="3" enum="FileMode"> The dialog allows selecting one file or directory. </constant> - <constant name="MODE_SAVE_FILE" value="4" enum="Mode"> + <constant name="FILE_MODE_SAVE_FILE" value="4" enum="FileMode"> The dialog will warn when a file exists. </constant> <constant name="ACCESS_RESOURCES" value="0" enum="Access"> diff --git a/doc/classes/GIProbe.xml b/doc/classes/GIProbe.xml index 322143ea9e..df50244c77 100644 --- a/doc/classes/GIProbe.xml +++ b/doc/classes/GIProbe.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="GIProbe" inherits="VisualInstance" version="4.0"> +<class name="GIProbe" inherits="VisualInstance3D" version="4.0"> <brief_description> Real-time global illumination (GI) probe. </brief_description> @@ -19,7 +19,7 @@ <argument index="1" name="create_visual_debug" type="bool" default="false"> </argument> <description> - Bakes the effect from all [GeometryInstance]s marked with [member GeometryInstance.use_in_baked_light] and [Light]s marked with either [constant Light.BAKE_INDIRECT] or [constant Light.BAKE_ALL]. If [code]create_visual_debug[/code] is [code]true[/code], after baking the light, this will generate a [MultiMesh] that has a cube representing each solid cell with each cube colored to the cell's albedo color. This can be used to visualize the [GIProbe]'s data and debug any issues that may be occurring. + Bakes the effect from all [GeometryInstance3D]s marked with [member GeometryInstance3D.use_in_baked_light] and [Light3D]s marked with either [constant Light3D.BAKE_INDIRECT] or [constant Light3D.BAKE_ALL]. If [code]create_visual_debug[/code] is [code]true[/code], after baking the light, this will generate a [MultiMesh] that has a cube representing each solid cell with each cube colored to the cell's albedo color. This can be used to visualize the [GIProbe]'s data and debug any issues that may be occurring. </description> </method> <method name="debug_bake"> diff --git a/doc/classes/Particles2D.xml b/doc/classes/GPUParticles2D.xml index 50fc3680bc..64a2522f2f 100644 --- a/doc/classes/Particles2D.xml +++ b/doc/classes/GPUParticles2D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Particles2D" inherits="Node2D" version="4.0"> +<class name="GPUParticles2D" inherits="Node2D" version="4.0"> <brief_description> 2D particle emitter. </brief_description> <description> - 2D particle node used to create a variety of particle systems and effects. [Particles2D] features an emitter that generates some number of particles at a given rate. + 2D particle node used to create a variety of particle systems and effects. [GPUParticles2D] features an emitter that generates some number of particles at a given rate. Use the [code]process_material[/code] property to add a [ParticlesMaterial] to configure particle appearance and behavior. Alternatively, you can add a [ShaderMaterial] which will be applied to all particles. </description> <tutorials> @@ -30,7 +30,7 @@ <member name="amount" type="int" setter="set_amount" getter="get_amount" default="8"> Number of particles emitted in one emission cycle. </member> - <member name="draw_order" type="int" setter="set_draw_order" getter="get_draw_order" enum="Particles2D.DrawOrder" default="0"> + <member name="draw_order" type="int" setter="set_draw_order" getter="get_draw_order" enum="GPUParticles2D.DrawOrder" default="0"> Particle draw order. Uses [enum DrawOrder] values. </member> <member name="emitting" type="bool" setter="set_emitting" getter="is_emitting" default="false"> diff --git a/doc/classes/Particles.xml b/doc/classes/GPUParticles3D.xml index 74651ddd2f..add8f28bf8 100644 --- a/doc/classes/Particles.xml +++ b/doc/classes/GPUParticles3D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Particles" inherits="GeometryInstance" version="4.0"> +<class name="GPUParticles3D" inherits="GeometryInstance3D" version="4.0"> <brief_description> 3D particle emitter. </brief_description> <description> - 3D particle node used to create a variety of particle systems and effects. [Particles] features an emitter that generates some number of particles at a given rate. + 3D particle node used to create a variety of particle systems and effects. [GPUParticles3D] features an emitter that generates some number of particles at a given rate. Use the [code]process_material[/code] property to add a [ParticlesMaterial] to configure particle appearance and behavior. Alternatively, you can add a [ShaderMaterial] which will be applied to all particles. </description> <tutorials> @@ -50,7 +50,7 @@ <member name="amount" type="int" setter="set_amount" getter="get_amount" default="8"> Number of particles to emit. </member> - <member name="draw_order" type="int" setter="set_draw_order" getter="get_draw_order" enum="Particles.DrawOrder" default="0"> + <member name="draw_order" type="int" setter="set_draw_order" getter="get_draw_order" enum="GPUParticles3D.DrawOrder" default="0"> Particle draw order. Uses [enum DrawOrder] values. </member> <member name="draw_pass_1" type="Mesh" setter="set_draw_pass_mesh" getter="get_draw_pass_mesh"> diff --git a/doc/classes/Generic6DOFJoint.xml b/doc/classes/Generic6DOFJoint3D.xml index 29ebf9f5d6..fae567dc58 100644 --- a/doc/classes/Generic6DOFJoint.xml +++ b/doc/classes/Generic6DOFJoint3D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Generic6DOFJoint" inherits="Joint" version="4.0"> +<class name="Generic6DOFJoint3D" inherits="Joint3D" version="4.0"> <brief_description> The generic 6-degrees-of-freedom joint can implement a variety of joint types by locking certain axes' rotation or translation. </brief_description> @@ -12,7 +12,7 @@ <method name="get_flag_x" qualifiers="const"> <return type="bool"> </return> - <argument index="0" name="flag" type="int" enum="Generic6DOFJoint.Flag"> + <argument index="0" name="flag" type="int" enum="Generic6DOFJoint3D.Flag"> </argument> <description> </description> @@ -20,7 +20,7 @@ <method name="get_flag_y" qualifiers="const"> <return type="bool"> </return> - <argument index="0" name="flag" type="int" enum="Generic6DOFJoint.Flag"> + <argument index="0" name="flag" type="int" enum="Generic6DOFJoint3D.Flag"> </argument> <description> </description> @@ -28,7 +28,7 @@ <method name="get_flag_z" qualifiers="const"> <return type="bool"> </return> - <argument index="0" name="flag" type="int" enum="Generic6DOFJoint.Flag"> + <argument index="0" name="flag" type="int" enum="Generic6DOFJoint3D.Flag"> </argument> <description> </description> @@ -36,7 +36,7 @@ <method name="get_param_x" qualifiers="const"> <return type="float"> </return> - <argument index="0" name="param" type="int" enum="Generic6DOFJoint.Param"> + <argument index="0" name="param" type="int" enum="Generic6DOFJoint3D.Param"> </argument> <description> </description> @@ -44,7 +44,7 @@ <method name="get_param_y" qualifiers="const"> <return type="float"> </return> - <argument index="0" name="param" type="int" enum="Generic6DOFJoint.Param"> + <argument index="0" name="param" type="int" enum="Generic6DOFJoint3D.Param"> </argument> <description> </description> @@ -52,7 +52,7 @@ <method name="get_param_z" qualifiers="const"> <return type="float"> </return> - <argument index="0" name="param" type="int" enum="Generic6DOFJoint.Param"> + <argument index="0" name="param" type="int" enum="Generic6DOFJoint3D.Param"> </argument> <description> </description> @@ -60,7 +60,7 @@ <method name="set_flag_x"> <return type="void"> </return> - <argument index="0" name="flag" type="int" enum="Generic6DOFJoint.Flag"> + <argument index="0" name="flag" type="int" enum="Generic6DOFJoint3D.Flag"> </argument> <argument index="1" name="value" type="bool"> </argument> @@ -70,7 +70,7 @@ <method name="set_flag_y"> <return type="void"> </return> - <argument index="0" name="flag" type="int" enum="Generic6DOFJoint.Flag"> + <argument index="0" name="flag" type="int" enum="Generic6DOFJoint3D.Flag"> </argument> <argument index="1" name="value" type="bool"> </argument> @@ -80,7 +80,7 @@ <method name="set_flag_z"> <return type="void"> </return> - <argument index="0" name="flag" type="int" enum="Generic6DOFJoint.Flag"> + <argument index="0" name="flag" type="int" enum="Generic6DOFJoint3D.Flag"> </argument> <argument index="1" name="value" type="bool"> </argument> @@ -90,7 +90,7 @@ <method name="set_param_x"> <return type="void"> </return> - <argument index="0" name="param" type="int" enum="Generic6DOFJoint.Param"> + <argument index="0" name="param" type="int" enum="Generic6DOFJoint3D.Param"> </argument> <argument index="1" name="value" type="float"> </argument> @@ -100,7 +100,7 @@ <method name="set_param_y"> <return type="void"> </return> - <argument index="0" name="param" type="int" enum="Generic6DOFJoint.Param"> + <argument index="0" name="param" type="int" enum="Generic6DOFJoint3D.Param"> </argument> <argument index="1" name="value" type="float"> </argument> @@ -110,7 +110,7 @@ <method name="set_param_z"> <return type="void"> </return> - <argument index="0" name="param" type="int" enum="Generic6DOFJoint.Param"> + <argument index="0" name="param" type="int" enum="Generic6DOFJoint3D.Param"> </argument> <argument index="1" name="value" type="float"> </argument> diff --git a/doc/classes/GeometryInstance.xml b/doc/classes/GeometryInstance3D.xml index 8259462531..7df5f0ea50 100644 --- a/doc/classes/GeometryInstance.xml +++ b/doc/classes/GeometryInstance3D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="GeometryInstance" inherits="VisualInstance" version="4.0"> +<class name="GeometryInstance3D" inherits="VisualInstance3D" version="4.0"> <brief_description> Base node for geometry-based visual instances. </brief_description> @@ -12,10 +12,10 @@ <method name="get_flag" qualifiers="const"> <return type="bool"> </return> - <argument index="0" name="flag" type="int" enum="GeometryInstance.Flags"> + <argument index="0" name="flag" type="int" enum="GeometryInstance3D.Flags"> </argument> <description> - Returns the [enum GeometryInstance.Flags] that have been set for this object. + Returns the [enum GeometryInstance3D.Flags] that have been set for this object. </description> </method> <method name="set_custom_aabb"> @@ -30,36 +30,36 @@ <method name="set_flag"> <return type="void"> </return> - <argument index="0" name="flag" type="int" enum="GeometryInstance.Flags"> + <argument index="0" name="flag" type="int" enum="GeometryInstance3D.Flags"> </argument> <argument index="1" name="value" type="bool"> </argument> <description> - Sets the [enum GeometryInstance.Flags] specified. See [enum GeometryInstance.Flags] for options. + Sets the [enum GeometryInstance3D.Flags] specified. See [enum GeometryInstance3D.Flags] for options. </description> </method> </methods> <members> - <member name="cast_shadow" type="int" setter="set_cast_shadows_setting" getter="get_cast_shadows_setting" enum="GeometryInstance.ShadowCastingSetting" default="1"> + <member name="cast_shadow" type="int" setter="set_cast_shadows_setting" getter="get_cast_shadows_setting" enum="GeometryInstance3D.ShadowCastingSetting" default="1"> The selected shadow casting flag. See [enum ShadowCastingSetting] for possible values. </member> <member name="extra_cull_margin" type="float" setter="set_extra_cull_margin" getter="get_extra_cull_margin" default="0.0"> - The extra distance added to the GeometryInstance's bounding box ([AABB]) to increase its cull box. + The extra distance added to the GeometryInstance3D's bounding box ([AABB]) to increase its cull box. </member> <member name="lod_max_distance" type="float" setter="set_lod_max_distance" getter="get_lod_max_distance" default="0.0"> - The GeometryInstance's max LOD distance. + The GeometryInstance3D's max LOD distance. [b]Note:[/b] This property currently has no effect. </member> <member name="lod_max_hysteresis" type="float" setter="set_lod_max_hysteresis" getter="get_lod_max_hysteresis" default="0.0"> - The GeometryInstance's max LOD margin. + The GeometryInstance3D's max LOD margin. [b]Note:[/b] This property currently has no effect. </member> <member name="lod_min_distance" type="float" setter="set_lod_min_distance" getter="get_lod_min_distance" default="0.0"> - The GeometryInstance's min LOD distance. + The GeometryInstance3D's min LOD distance. [b]Note:[/b] This property currently has no effect. </member> <member name="lod_min_hysteresis" type="float" setter="set_lod_min_hysteresis" getter="get_lod_min_hysteresis" default="0.0"> - The GeometryInstance's min LOD margin. + The GeometryInstance3D's min LOD margin. [b]Note:[/b] This property currently has no effect. </member> <member name="material_override" type="Material" setter="set_material_override" getter="get_material_override"> @@ -69,7 +69,7 @@ <member name="use_dynamic_gi" type="bool" setter="set_flag" getter="get_flag" default="false"> </member> <member name="use_in_baked_light" type="bool" setter="set_flag" getter="get_flag" default="false"> - If [code]true[/code], this GeometryInstance will be used when baking lights using a [GIProbe]. + If [code]true[/code], this GeometryInstance3D will be used when baking lights using a [GIProbe]. </member> </members> <constants> @@ -77,11 +77,11 @@ Will not cast any shadows. </constant> <constant name="SHADOW_CASTING_SETTING_ON" value="1" enum="ShadowCastingSetting"> - Will cast shadows from all visible faces in the GeometryInstance. + Will cast shadows from all visible faces in the GeometryInstance3D. Will take culling into account, so faces not being rendered will not be taken into account when shadow casting. </constant> <constant name="SHADOW_CASTING_SETTING_DOUBLE_SIDED" value="2" enum="ShadowCastingSetting"> - Will cast shadows from all visible faces in the GeometryInstance. + Will cast shadows from all visible faces in the GeometryInstance3D. Will not take culling into account, so all faces will be taken into account when shadow casting. </constant> <constant name="SHADOW_CASTING_SETTING_SHADOWS_ONLY" value="3" enum="ShadowCastingSetting"> @@ -89,12 +89,12 @@ In other words, the actual mesh will not be visible, only the shadows casted from the mesh will be. </constant> <constant name="FLAG_USE_BAKED_LIGHT" value="0" enum="Flags"> - Will allow the GeometryInstance to be used when baking lights using a [GIProbe]. + Will allow the GeometryInstance3D to be used when baking lights using a [GIProbe]. </constant> <constant name="FLAG_USE_DYNAMIC_GI" value="1" enum="Flags"> </constant> <constant name="FLAG_DRAW_NEXT_FRAME_IF_VISIBLE" value="2" enum="Flags"> - Unused in this class, exposed for consistency with [enum VisualServer.InstanceFlags]. + Unused in this class, exposed for consistency with [enum RenderingServer.InstanceFlags]. </constant> <constant name="FLAG_MAX" value="3" enum="Flags"> Represents the size of the [enum Flags] enum. diff --git a/doc/classes/HeightMapShape.xml b/doc/classes/HeightMapShape3D.xml index 029f3642d2..6d230bdab8 100644 --- a/doc/classes/HeightMapShape.xml +++ b/doc/classes/HeightMapShape3D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="HeightMapShape" inherits="Shape" version="4.0"> +<class name="HeightMapShape3D" inherits="Shape3D" version="4.0"> <brief_description> Height map shape for 3D physics (Bullet only). </brief_description> <description> - Height map shape resource, which can be added to a [PhysicsBody] or [Area]. + Height map shape resource, which can be added to a [PhysicsBody3D] or [Area3D]. </description> <tutorials> </tutorials> diff --git a/doc/classes/HingeJoint.xml b/doc/classes/HingeJoint3D.xml index 0d1b6ff0e0..2d4480cb20 100644 --- a/doc/classes/HingeJoint.xml +++ b/doc/classes/HingeJoint3D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="HingeJoint" inherits="Joint" version="4.0"> +<class name="HingeJoint3D" inherits="Joint3D" version="4.0"> <brief_description> A hinge between two 3D bodies. </brief_description> <description> - A HingeJoint normally uses the Z axis of body A as the hinge axis, another axis can be specified when adding it manually though. + A HingeJoint3D normally uses the Z axis of body A as the hinge axis, another axis can be specified when adding it manually though. </description> <tutorials> </tutorials> @@ -12,7 +12,7 @@ <method name="get_flag" qualifiers="const"> <return type="bool"> </return> - <argument index="0" name="flag" type="int" enum="HingeJoint.Flag"> + <argument index="0" name="flag" type="int" enum="HingeJoint3D.Flag"> </argument> <description> Returns the value of the specified flag. @@ -21,7 +21,7 @@ <method name="get_param" qualifiers="const"> <return type="float"> </return> - <argument index="0" name="param" type="int" enum="HingeJoint.Param"> + <argument index="0" name="param" type="int" enum="HingeJoint3D.Param"> </argument> <description> Returns the value of the specified parameter. @@ -30,7 +30,7 @@ <method name="set_flag"> <return type="void"> </return> - <argument index="0" name="flag" type="int" enum="HingeJoint.Flag"> + <argument index="0" name="flag" type="int" enum="HingeJoint3D.Flag"> </argument> <argument index="1" name="enabled" type="bool"> </argument> @@ -41,7 +41,7 @@ <method name="set_param"> <return type="void"> </return> - <argument index="0" name="param" type="int" enum="HingeJoint.Param"> + <argument index="0" name="param" type="int" enum="HingeJoint3D.Param"> </argument> <argument index="1" name="value" type="float"> </argument> diff --git a/doc/classes/ImmediateGeometry.xml b/doc/classes/ImmediateGeometry3D.xml index 710e929d1a..1c0831c922 100644 --- a/doc/classes/ImmediateGeometry.xml +++ b/doc/classes/ImmediateGeometry3D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ImmediateGeometry" inherits="GeometryInstance" version="4.0"> +<class name="ImmediateGeometry3D" inherits="GeometryInstance3D" version="4.0"> <brief_description> Draws simple geometry from code. </brief_description> diff --git a/doc/classes/InputDefault.xml b/doc/classes/InputDefault.xml deleted file mode 100644 index ea4d08c628..0000000000 --- a/doc/classes/InputDefault.xml +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<class name="InputDefault" inherits="Input" version="4.0"> - <brief_description> - Default implementation of the [Input] class. - </brief_description> - <description> - Default implementation of the [Input] class, used internally by the editor and games for default input management. - </description> - <tutorials> - </tutorials> - <methods> - </methods> - <constants> - </constants> -</class> diff --git a/doc/classes/InputEventFromWindow.xml b/doc/classes/InputEventFromWindow.xml new file mode 100644 index 0000000000..7cd5b7d179 --- /dev/null +++ b/doc/classes/InputEventFromWindow.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="InputEventFromWindow" inherits="InputEvent" version="4.0"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <methods> + </methods> + <members> + <member name="window_id" type="int" setter="set_window_id" getter="get_window_id" default="0"> + </member> + </members> + <constants> + </constants> +</class> diff --git a/doc/classes/InputEventKey.xml b/doc/classes/InputEventKey.xml index c8d0769b90..34afa90553 100644 --- a/doc/classes/InputEventKey.xml +++ b/doc/classes/InputEventKey.xml @@ -43,7 +43,7 @@ If [code]true[/code], the key's state is pressed. If [code]false[/code], the key's state is released. </member> <member name="unicode" type="int" setter="set_unicode" getter="get_unicode" default="0"> - The key Unicode identifier (when relevant). Unicode identifiers for the composite characters and complex scripts may not be available unless IME input mode is active. See [method OS.set_ime_active] for more information. + The key Unicode identifier (when relevant). Unicode identifiers for the composite characters and complex scripts may not be available unless IME input mode is active. See [method Window.set_ime_active] for more information. </member> </members> <constants> diff --git a/doc/classes/InputEventScreenDrag.xml b/doc/classes/InputEventScreenDrag.xml index d7e0c2454c..a315e4ddfb 100644 --- a/doc/classes/InputEventScreenDrag.xml +++ b/doc/classes/InputEventScreenDrag.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="InputEventScreenDrag" inherits="InputEvent" version="4.0"> +<class name="InputEventScreenDrag" inherits="InputEventFromWindow" version="4.0"> <brief_description> Input event type for screen drag events. Only available on mobile devices. </brief_description> diff --git a/doc/classes/InputEventScreenTouch.xml b/doc/classes/InputEventScreenTouch.xml index 4a5cd36423..16a3cf8353 100644 --- a/doc/classes/InputEventScreenTouch.xml +++ b/doc/classes/InputEventScreenTouch.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="InputEventScreenTouch" inherits="InputEvent" version="4.0"> +<class name="InputEventScreenTouch" inherits="InputEventFromWindow" version="4.0"> <brief_description> Input event type for screen touch events. (only available on mobile devices) diff --git a/doc/classes/InputEventWithModifiers.xml b/doc/classes/InputEventWithModifiers.xml index 63465ad28c..34faf18e24 100644 --- a/doc/classes/InputEventWithModifiers.xml +++ b/doc/classes/InputEventWithModifiers.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="InputEventWithModifiers" inherits="InputEvent" version="4.0"> +<class name="InputEventWithModifiers" inherits="InputEventFromWindow" version="4.0"> <brief_description> Base class for keys events with modifiers. </brief_description> diff --git a/doc/classes/Input.xml b/doc/classes/InputFilter.xml index 0f212e7498..54184ae8a3 100644 --- a/doc/classes/Input.xml +++ b/doc/classes/InputFilter.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Input" inherits="Object" version="4.0"> +<class name="InputFilter" inherits="Object" version="4.0"> <brief_description> A singleton that deals with inputs. </brief_description> @@ -68,7 +68,7 @@ </description> </method> <method name="get_current_cursor_shape" qualifiers="const"> - <return type="int" enum="Input.CursorShape"> + <return type="int" enum="InputFilter.CursorShape"> </return> <description> Returns the currently assigned cursor shape (see [enum CursorShape]). @@ -193,7 +193,7 @@ </description> </method> <method name="get_mouse_mode" qualifiers="const"> - <return type="int" enum="Input.MouseMode"> + <return type="int" enum="InputFilter.MouseMode"> </return> <description> Returns the mouse mode. See the constants for more information. @@ -277,7 +277,7 @@ <argument index="3" name="guid" type="String"> </argument> <description> - Notifies the [Input] singleton that a connection has changed, to update the state for the [code]device[/code] index. + Notifies the [InputFilter] singleton that a connection has changed, to update the state for the [code]device[/code] index. This is used internally and should not have to be called from user scripts. See [signal joy_connection_changed] for the signal emitted when this is triggered internally. </description> </method> @@ -293,7 +293,7 @@ var a = InputEventAction.new() a.action = "ui_cancel" a.pressed = true - Input.parse_input_event(a) + InputFilter.parse_input_event(a) [/codeblock] </description> </method> @@ -311,7 +311,7 @@ </return> <argument index="0" name="image" type="Resource"> </argument> - <argument index="1" name="shape" type="int" enum="Input.CursorShape" default="0"> + <argument index="1" name="shape" type="int" enum="InputFilter.CursorShape" default="0"> </argument> <argument index="2" name="hotspot" type="Vector2" default="Vector2( 0, 0 )"> </argument> @@ -326,7 +326,7 @@ <method name="set_default_cursor_shape"> <return type="void"> </return> - <argument index="0" name="shape" type="int" enum="Input.CursorShape" default="0"> + <argument index="0" name="shape" type="int" enum="InputFilter.CursorShape" default="0"> </argument> <description> Sets the default cursor shape to be used in the viewport instead of [constant CURSOR_ARROW]. @@ -337,7 +337,7 @@ <method name="set_mouse_mode"> <return type="void"> </return> - <argument index="0" name="mode" type="int" enum="Input.MouseMode"> + <argument index="0" name="mode" type="int" enum="InputFilter.MouseMode"> </argument> <description> Sets the mouse mode. See the constants for more information. diff --git a/doc/classes/InterpolatedCamera.xml b/doc/classes/InterpolatedCamera.xml deleted file mode 100644 index 66df7e9531..0000000000 --- a/doc/classes/InterpolatedCamera.xml +++ /dev/null @@ -1,36 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<class name="InterpolatedCamera" inherits="Camera" version="4.0"> - <brief_description> - Camera which moves toward another node. - </brief_description> - <description> - InterpolatedCamera is a [Camera] which smoothly moves to match a target node's position and rotation. - If it is not [member enabled] or does not have a valid target set, InterpolatedCamera acts like a normal Camera. - </description> - <tutorials> - </tutorials> - <methods> - <method name="set_target"> - <return type="void"> - </return> - <argument index="0" name="target" type="Object"> - </argument> - <description> - Sets the node to move toward and orient with. - </description> - </method> - </methods> - <members> - <member name="enabled" type="bool" setter="set_interpolation_enabled" getter="is_interpolation_enabled" default="false"> - If [code]true[/code], and a target is set, the camera will move automatically. - </member> - <member name="speed" type="float" setter="set_speed" getter="get_speed" default="1.0"> - How quickly the camera moves toward its target. Higher values will result in tighter camera motion. - </member> - <member name="target" type="NodePath" setter="set_target_path" getter="get_target_path" default="NodePath("")"> - The target's [NodePath]. - </member> - </members> - <constants> - </constants> -</class> diff --git a/doc/classes/Joint.xml b/doc/classes/Joint3D.xml index 34da997292..15bef960f6 100644 --- a/doc/classes/Joint.xml +++ b/doc/classes/Joint3D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Joint" inherits="Spatial" version="4.0"> +<class name="Joint3D" inherits="Node3D" version="4.0"> <brief_description> Base class for all 3D joints. </brief_description> diff --git a/doc/classes/KinematicBody.xml b/doc/classes/KinematicBody3D.xml index 4ccbc679bf..5f9b36f97d 100644 --- a/doc/classes/KinematicBody.xml +++ b/doc/classes/KinematicBody3D.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="KinematicBody" inherits="PhysicsBody" version="4.0"> +<class name="KinematicBody3D" inherits="PhysicsBody3D" version="4.0"> <brief_description> Kinematic body 3D node. </brief_description> <description> Kinematic bodies are special types of bodies that are meant to be user-controlled. They are not affected by physics at all; to other types of bodies, such as a character or a rigid body, these are the same as a static body. However, they have two main uses: [b]Simulated motion:[/b] When these bodies are moved manually, either from code or from an [AnimationPlayer] (with [member AnimationPlayer.playback_process_mode] set to "physics"), the physics will automatically compute an estimate of their linear and angular velocity. This makes them very useful for moving platforms or other AnimationPlayer-controlled objects (like a door, a bridge that opens, etc). - [b]Kinematic characters:[/b] KinematicBody also has an API for moving objects (the [method move_and_collide] and [method move_and_slide] methods) while performing collision tests. This makes them really useful to implement characters that collide against a world, but that don't require advanced physics. + [b]Kinematic characters:[/b] KinematicBody3D also has an API for moving objects (the [method move_and_collide] and [method move_and_slide] methods) while performing collision tests. This makes them really useful to implement characters that collide against a world, but that don't require advanced physics. </description> <tutorials> <link>https://docs.godotengine.org/en/latest/tutorials/physics/kinematic_character_2d.html</link> @@ -15,7 +15,7 @@ <method name="get_axis_lock" qualifiers="const"> <return type="bool"> </return> - <argument index="0" name="axis" type="int" enum="PhysicsServer.BodyAxis"> + <argument index="0" name="axis" type="int" enum="PhysicsServer3D.BodyAxis"> </argument> <description> Returns [code]true[/code] if the specified [code]axis[/code] is locked. See also [member move_lock_x], [member move_lock_y] and [member move_lock_z]. @@ -36,12 +36,12 @@ </description> </method> <method name="get_slide_collision"> - <return type="KinematicCollision"> + <return type="KinematicCollision3D"> </return> <argument index="0" name="slide_idx" type="int"> </argument> <description> - Returns a [KinematicCollision], which contains information about a collision that occurred during the last [method move_and_slide] call. Since the body can collide several times in a single call to [method move_and_slide], you must specify the index of the collision in the range 0 to ([method get_slide_count] - 1). + Returns a [KinematicCollision3D], which contains information about a collision that occurred during the last [method move_and_slide] call. Since the body can collide several times in a single call to [method move_and_slide], you must specify the index of the collision in the range 0 to ([method get_slide_count] - 1). </description> </method> <method name="get_slide_count" qualifiers="const"> @@ -73,7 +73,7 @@ </description> </method> <method name="move_and_collide"> - <return type="KinematicCollision"> + <return type="KinematicCollision3D"> </return> <argument index="0" name="rel_vec" type="Vector3"> </argument> @@ -84,7 +84,7 @@ <argument index="3" name="test_only" type="bool" default="false"> </argument> <description> - Moves the body along the vector [code]rel_vec[/code]. The body will stop if it collides. Returns a [KinematicCollision], which contains information about the collision. + Moves the body along the vector [code]rel_vec[/code]. The body will stop if it collides. Returns a [KinematicCollision3D], which contains information about the collision. If [code]test_only[/code] is [code]true[/code], the body does not move but the would-be collision information is given. </description> </method> @@ -104,14 +104,14 @@ <argument index="5" name="infinite_inertia" type="bool" default="true"> </argument> <description> - Moves the body along a vector. If the body collides with another, it will slide along the other body rather than stop immediately. If the other body is a [KinematicBody] or [RigidBody], it will also be affected by the motion of the other body. You can use this to make moving or rotating platforms, or to make nodes push other nodes. + Moves the body along a vector. If the body collides with another, it will slide along the other body rather than stop immediately. If the other body is a [KinematicBody3D] or [RigidBody3D], it will also be affected by the motion of the other body. You can use this to make moving or rotating platforms, or to make nodes push other nodes. This method should be used in [method Node._physics_process] (or in a method called by [method Node._physics_process]), as it uses the physics step's [code]delta[/code] value automatically in calculations. Otherwise, the simulation will run at an incorrect speed. [code]linear_velocity[/code] is the velocity vector (typically meters per second). Unlike in [method move_and_collide], you should [i]not[/i] multiply it by [code]delta[/code] — the physics engine handles applying the velocity. [code]up_direction[/code] is the up direction, used to determine what is a wall and what is a floor or a ceiling. If set to the default value of [code]Vector3(0, 0, 0)[/code], everything is considered a wall. If [code]stop_on_slope[/code] is [code]true[/code], body will not slide on slopes if you include gravity in [code]linear_velocity[/code]. If the body collides, it will change direction a maximum of [code]max_slides[/code] times before it stops. [code]floor_max_angle[/code] is the maximum angle (in radians) where a slope is still considered a floor (or a ceiling), rather than a wall. The default value equals 45 degrees. - If [code]infinite_inertia[/code] is [code]true[/code], body will be able to push [RigidBody] nodes, but it won't also detect any collisions with them. If [code]false[/code], it will interact with [RigidBody] nodes like with [StaticBody]. + If [code]infinite_inertia[/code] is [code]true[/code], body will be able to push [RigidBody3D] nodes, but it won't also detect any collisions with them. If [code]false[/code], it will interact with [RigidBody3D] nodes like with [StaticBody3D]. Returns the [code]linear_velocity[/code] vector, rotated and/or scaled if a slide collision occurred. To get detailed information about collisions that occurred, use [method get_slide_collision]. </description> </method> @@ -140,7 +140,7 @@ <method name="set_axis_lock"> <return type="void"> </return> - <argument index="0" name="axis" type="int" enum="PhysicsServer.BodyAxis"> + <argument index="0" name="axis" type="int" enum="PhysicsServer3D.BodyAxis"> </argument> <argument index="1" name="lock" type="bool"> </argument> diff --git a/doc/classes/KinematicCollision.xml b/doc/classes/KinematicCollision3D.xml index 858a1e69c0..f3248a9ca1 100644 --- a/doc/classes/KinematicCollision.xml +++ b/doc/classes/KinematicCollision3D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="KinematicCollision" inherits="Reference" version="4.0"> +<class name="KinematicCollision3D" inherits="Reference" version="4.0"> <brief_description> - Collision data for [KinematicBody] collisions. + Collision data for [KinematicBody3D] collisions. </brief_description> <description> - Contains collision data for [KinematicBody] collisions. When a [KinematicBody] is moved using [method KinematicBody.move_and_collide], it stops if it detects a collision with another body. If a collision is detected, a KinematicCollision object is returned. + Contains collision data for [KinematicBody3D] collisions. When a [KinematicBody3D] is moved using [method KinematicBody3D.move_and_collide], it stops if it detects a collision with another body. If a collision is detected, a KinematicCollision3D object is returned. This object contains information about the collision, including the colliding object, the remaining motion, and the collision position. This information can be used to calculate a collision response. </description> <tutorials> @@ -25,7 +25,7 @@ The colliding body's shape. </member> <member name="collider_shape_index" type="int" setter="" getter="get_collider_shape_index" default="0"> - The colliding shape's index. See [CollisionObject]. + The colliding shape's index. See [CollisionObject3D]. </member> <member name="collider_velocity" type="Vector3" setter="" getter="get_collider_velocity" default="Vector3( 0, 0, 0 )"> The colliding object's velocity. diff --git a/doc/classes/Light.xml b/doc/classes/Light3D.xml index a2867a50d2..4e48a24951 100644 --- a/doc/classes/Light.xml +++ b/doc/classes/Light3D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Light" inherits="VisualInstance" version="4.0"> +<class name="Light3D" inherits="VisualInstance3D" version="4.0"> <brief_description> Provides a base class for different kinds of light nodes. </brief_description> <description> - Light is the abstract base class for light nodes, so it shouldn't be used directly (it can't be instanced). Other types of light nodes inherit from it. Light contains the common variables and parameters used for lighting. + Light3D is the abstract base class for light nodes, so it shouldn't be used directly (it can't be instanced). Other types of light nodes inherit from it. Light3D contains the common variables and parameters used for lighting. </description> <tutorials> <link>https://docs.godotengine.org/en/latest/tutorials/3d/lights_and_shadows.html</link> @@ -13,21 +13,21 @@ <method name="get_param" qualifiers="const"> <return type="float"> </return> - <argument index="0" name="param" type="int" enum="Light.Param"> + <argument index="0" name="param" type="int" enum="Light3D.Param"> </argument> <description> - Returns the value of the specified [enum Light.Param] parameter. + Returns the value of the specified [enum Light3D.Param] parameter. </description> </method> <method name="set_param"> <return type="void"> </return> - <argument index="0" name="param" type="int" enum="Light.Param"> + <argument index="0" name="param" type="int" enum="Light3D.Param"> </argument> <argument index="1" name="value" type="float"> </argument> <description> - Sets the value of the specified [enum Light.Param] parameter. + Sets the value of the specified [enum Light3D.Param] parameter. </description> </method> </methods> @@ -35,7 +35,7 @@ <member name="editor_only" type="bool" setter="set_editor_only" getter="is_editor_only" default="false"> If [code]true[/code], the light only appears in the editor and will not be visible at runtime. </member> - <member name="light_bake_mode" type="int" setter="set_bake_mode" getter="get_bake_mode" enum="Light.BakeMode" default="1"> + <member name="light_bake_mode" type="int" setter="set_bake_mode" getter="get_bake_mode" enum="Light3D.BakeMode" default="1"> The light's bake mode. See [enum BakeMode]. </member> <member name="light_color" type="Color" setter="set_color" getter="get_color" default="Color( 1, 1, 1, 1 )"> @@ -69,7 +69,7 @@ If [code]true[/code], the light will cast shadows. </member> <member name="shadow_reverse_cull_face" type="bool" setter="set_shadow_reverse_cull_face" getter="get_shadow_reverse_cull_face" default="false"> - If [code]true[/code], reverses the backface culling of the mesh. This can be useful when you have a flat mesh that has a light behind it. If you need to cast a shadow on both sides of the mesh, set the mesh to use double-sided shadows with [constant GeometryInstance.SHADOW_CASTING_SETTING_DOUBLE_SIDED]. + If [code]true[/code], reverses the backface culling of the mesh. This can be useful when you have a flat mesh that has a light behind it. If you need to cast a shadow on both sides of the mesh, set the mesh to use double-sided shadows with [constant GeometryInstance3D.SHADOW_CASTING_SETTING_DOUBLE_SIDED]. </member> </members> <constants> @@ -83,42 +83,42 @@ Constant for accessing [member light_specular]. </constant> <constant name="PARAM_RANGE" value="3" enum="Param"> - Constant for accessing [member OmniLight.omni_range] or [member SpotLight.spot_range]. + Constant for accessing [member OmniLight3D.omni_range] or [member SpotLight3D.spot_range]. </constant> <constant name="PARAM_ATTENUATION" value="4" enum="Param"> - Constant for accessing [member OmniLight.omni_attenuation] or [member SpotLight.spot_attenuation]. + Constant for accessing [member OmniLight3D.omni_attenuation] or [member SpotLight3D.spot_attenuation]. </constant> <constant name="PARAM_SPOT_ANGLE" value="5" enum="Param"> - Constant for accessing [member SpotLight.spot_angle]. + Constant for accessing [member SpotLight3D.spot_angle]. </constant> <constant name="PARAM_SPOT_ATTENUATION" value="6" enum="Param"> - Constant for accessing [member SpotLight.spot_angle_attenuation]. + Constant for accessing [member SpotLight3D.spot_angle_attenuation]. </constant> <constant name="PARAM_CONTACT_SHADOW_SIZE" value="7" enum="Param"> Constant for accessing [member shadow_contact]. </constant> <constant name="PARAM_SHADOW_MAX_DISTANCE" value="8" enum="Param"> - Constant for accessing [member DirectionalLight.directional_shadow_max_distance]. + Constant for accessing [member DirectionalLight3D.directional_shadow_max_distance]. </constant> <constant name="PARAM_SHADOW_SPLIT_1_OFFSET" value="9" enum="Param"> - Constant for accessing [member DirectionalLight.directional_shadow_split_1]. + Constant for accessing [member DirectionalLight3D.directional_shadow_split_1]. </constant> <constant name="PARAM_SHADOW_SPLIT_2_OFFSET" value="10" enum="Param"> - Constant for accessing [member DirectionalLight.directional_shadow_split_2]. + Constant for accessing [member DirectionalLight3D.directional_shadow_split_2]. </constant> <constant name="PARAM_SHADOW_SPLIT_3_OFFSET" value="11" enum="Param"> - Constant for accessing [member DirectionalLight.directional_shadow_split_3]. + Constant for accessing [member DirectionalLight3D.directional_shadow_split_3]. </constant> <constant name="PARAM_SHADOW_FADE_START" value="12" enum="Param"> </constant> <constant name="PARAM_SHADOW_NORMAL_BIAS" value="13" enum="Param"> - Constant for accessing [member DirectionalLight.directional_shadow_normal_bias]. + Constant for accessing [member DirectionalLight3D.directional_shadow_normal_bias]. </constant> <constant name="PARAM_SHADOW_BIAS" value="14" enum="Param"> Constant for accessing [member shadow_bias]. </constant> <constant name="PARAM_SHADOW_BIAS_SPLIT_SCALE" value="15" enum="Param"> - Constant for accessing [member DirectionalLight.directional_shadow_bias_split_scale]. + Constant for accessing [member DirectionalLight3D.directional_shadow_bias_split_scale]. </constant> <constant name="PARAM_MAX" value="16" enum="Param"> Represents the size of the [enum Param] enum. diff --git a/doc/classes/Listener.xml b/doc/classes/Listener3D.xml index 72bbfa29d4..998ea757ff 100644 --- a/doc/classes/Listener.xml +++ b/doc/classes/Listener3D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Listener" inherits="Spatial" version="4.0"> +<class name="Listener3D" inherits="Node3D" version="4.0"> <brief_description> Overrides the location sounds are heard from. </brief_description> <description> - Once added to the scene tree and enabled using [method make_current], this node will override the location sounds are heard from. This can be used to listen from a location different from the [Camera]. + Once added to the scene tree and enabled using [method make_current], this node will override the location sounds are heard from. This can be used to listen from a location different from the [Camera3D]. [b]Note:[/b] There is no 2D equivalent for this node yet. </description> <tutorials> @@ -29,7 +29,7 @@ </return> <description> Returns [code]true[/code] if the listener was made current using [method make_current], [code]false[/code] otherwise. - [b]Note:[/b] There may be more than one Listener marked as "current" in the scene tree, but only the one that was made current last will be used. + [b]Note:[/b] There may be more than one Listener3D marked as "current" in the scene tree, but only the one that was made current last will be used. </description> </method> <method name="make_current"> diff --git a/doc/classes/MainLoop.xml b/doc/classes/MainLoop.xml index af71c30936..7bb478fce2 100644 --- a/doc/classes/MainLoop.xml +++ b/doc/classes/MainLoop.xml @@ -7,6 +7,7 @@ [MainLoop] is the abstract base class for a Godot project's game loop. It is inherited by [SceneTree], which is the default game loop implementation used in Godot projects, though it is also possible to write and use one's own [MainLoop] subclass instead of the scene tree. Upon the application start, a [MainLoop] implementation must be provided to the OS; otherwise, the application will exit. This happens automatically (and a [SceneTree] is created) unless a main [Script] is provided from the command line (with e.g. [code]godot -s my_loop.gd[/code], which should then be a [MainLoop] implementation. Here is an example script implementing a simple [MainLoop]: + [b]FIXME:[/b] No longer valid after DisplayServer split and Input refactoring. [codeblock] extends MainLoop @@ -43,17 +44,6 @@ <tutorials> </tutorials> <methods> - <method name="_drop_files" qualifiers="virtual"> - <return type="void"> - </return> - <argument index="0" name="files" type="PackedStringArray"> - </argument> - <argument index="1" name="from_screen" type="int"> - </argument> - <description> - Called when files are dragged from the OS file manager and dropped in the game window. The arguments are a list of file paths and the identifier of the screen where the drag originated. - </description> - </method> <method name="_finalize" qualifiers="virtual"> <return type="void"> </return> @@ -61,17 +51,6 @@ Called before the program exits. </description> </method> - <method name="_global_menu_action" qualifiers="virtual"> - <return type="void"> - </return> - <argument index="0" name="id" type="Variant"> - </argument> - <argument index="1" name="meta" type="Variant"> - </argument> - <description> - Called when the user performs an action in the system global menu (e.g. the Mac OS menu bar). - </description> - </method> <method name="_idle" qualifiers="virtual"> <return type="bool"> </return> @@ -89,24 +68,6 @@ Called once during initialization. </description> </method> - <method name="_input_event" qualifiers="virtual"> - <return type="void"> - </return> - <argument index="0" name="event" type="InputEvent"> - </argument> - <description> - Called whenever an [InputEvent] is received by the main loop. - </description> - </method> - <method name="_input_text" qualifiers="virtual"> - <return type="void"> - </return> - <argument index="0" name="text" type="String"> - </argument> - <description> - Deprecated callback, does not do anything. Use [method _input_event] to parse text input. Will be removed in Godot 4.0. - </description> - </method> <method name="_iteration" qualifiers="virtual"> <return type="bool"> </return> @@ -140,24 +101,6 @@ Should not be called manually, override [method _initialize] instead. Will be removed in Godot 4.0. </description> </method> - <method name="input_event"> - <return type="void"> - </return> - <argument index="0" name="event" type="InputEvent"> - </argument> - <description> - Should not be called manually, override [method _input_event] instead. Will be removed in Godot 4.0. - </description> - </method> - <method name="input_text"> - <return type="void"> - </return> - <argument index="0" name="text" type="String"> - </argument> - <description> - Should not be called manually, override [method _input_text] instead. Will be removed in Godot 4.0. - </description> - </method> <method name="iteration"> <return type="bool"> </return> @@ -180,58 +123,30 @@ </signal> </signals> <constants> - <constant name="NOTIFICATION_WM_MOUSE_ENTER" value="1002"> - Notification received from the OS when the mouse enters the game window. - Implemented on desktop and web platforms. - </constant> - <constant name="NOTIFICATION_WM_MOUSE_EXIT" value="1003"> - Notification received from the OS when the mouse leaves the game window. - Implemented on desktop and web platforms. - </constant> - <constant name="NOTIFICATION_WM_FOCUS_IN" value="1004"> - Notification received from the OS when the game window is focused. - Implemented on all platforms. - </constant> - <constant name="NOTIFICATION_WM_FOCUS_OUT" value="1005"> - Notification received from the OS when the game window is unfocused. - Implemented on all platforms. - </constant> - <constant name="NOTIFICATION_WM_QUIT_REQUEST" value="1006"> - Notification received from the OS when a quit request is sent (e.g. closing the window with a "Close" button or Alt+F4). - Implemented on desktop platforms. - </constant> - <constant name="NOTIFICATION_WM_GO_BACK_REQUEST" value="1007"> - Notification received from the OS when a go back request is sent (e.g. pressing the "Back" button on Android). - Specific to the Android platform. - </constant> - <constant name="NOTIFICATION_WM_UNFOCUS_REQUEST" value="1008"> - Notification received from the OS when an unfocus request is sent (e.g. another OS window wants to take the focus). - No supported platforms currently send this notification. - </constant> - <constant name="NOTIFICATION_OS_MEMORY_WARNING" value="1009"> + <constant name="NOTIFICATION_OS_MEMORY_WARNING" value="2009"> Notification received from the OS when the application is exceeding its allocated memory. Specific to the iOS platform. </constant> - <constant name="NOTIFICATION_TRANSLATION_CHANGED" value="1010"> + <constant name="NOTIFICATION_TRANSLATION_CHANGED" value="2010"> Notification received when translations may have changed. Can be triggered by the user changing the locale. Can be used to respond to language changes, for example to change the UI strings on the fly. Useful when working with the built-in translation support, like [method Object.tr]. </constant> - <constant name="NOTIFICATION_WM_ABOUT" value="1011"> + <constant name="NOTIFICATION_WM_ABOUT" value="2011"> Notification received from the OS when a request for "About" information is sent. Specific to the macOS platform. </constant> - <constant name="NOTIFICATION_CRASH" value="1012"> + <constant name="NOTIFICATION_CRASH" value="2012"> Notification received from Godot's crash handler when the engine is about to crash. Implemented on desktop platforms if the crash handler is enabled. </constant> - <constant name="NOTIFICATION_OS_IME_UPDATE" value="1013"> + <constant name="NOTIFICATION_OS_IME_UPDATE" value="2013"> Notification received from the OS when an update of the Input Method Engine occurs (e.g. change of IME cursor position or composition string). Specific to the macOS platform. </constant> - <constant name="NOTIFICATION_APP_RESUMED" value="1014"> + <constant name="NOTIFICATION_APP_RESUMED" value="2014"> Notification received from the OS when the app is resumed. Specific to the Android platform. </constant> - <constant name="NOTIFICATION_APP_PAUSED" value="1015"> + <constant name="NOTIFICATION_APP_PAUSED" value="2015"> Notification received from the OS when the app is paused. Specific to the Android platform. </constant> diff --git a/doc/classes/Material.xml b/doc/classes/Material.xml index a0c1979646..a37c8127f0 100644 --- a/doc/classes/Material.xml +++ b/doc/classes/Material.xml @@ -4,7 +4,7 @@ Abstract base [Resource] for coloring and shading geometry. </brief_description> <description> - Material is a base [Resource] used for coloring and shading geometry. All materials inherit from it and almost all [VisualInstance] derived nodes carry a Material. A few flags and parameters are shared between all material types and are configured here. + Material is a base [Resource] used for coloring and shading geometry. All materials inherit from it and almost all [VisualInstance3D] derived nodes carry a Material. A few flags and parameters are shared between all material types and are configured here. </description> <tutorials> </tutorials> diff --git a/doc/classes/MenuButton.xml b/doc/classes/MenuButton.xml index 6ec9d60df4..316315f777 100644 --- a/doc/classes/MenuButton.xml +++ b/doc/classes/MenuButton.xml @@ -38,9 +38,9 @@ <member name="toggle_mode" type="bool" setter="set_toggle_mode" getter="is_toggle_mode" override="true" default="true" /> </members> <signals> - <signal name="about_to_show"> + <signal name="about_to_popup"> <description> - Emitted when [PopupMenu] of this MenuButton is about to show. + Emitted when the [PopupMenu] of this MenuButton is about to show. </description> </signal> </signals> diff --git a/doc/classes/Mesh.xml b/doc/classes/Mesh.xml index dc7ffc8934..6958c815a6 100644 --- a/doc/classes/Mesh.xml +++ b/doc/classes/Mesh.xml @@ -10,10 +10,10 @@ </tutorials> <methods> <method name="create_convex_shape" qualifiers="const"> - <return type="Shape"> + <return type="Shape3D"> </return> <description> - Calculate a [ConvexPolygonShape] from the mesh. + Calculate a [ConvexPolygonShape3D] from the mesh. </description> </method> <method name="create_outline" qualifiers="const"> @@ -27,10 +27,10 @@ </description> </method> <method name="create_trimesh_shape" qualifiers="const"> - <return type="Shape"> + <return type="Shape3D"> </return> <description> - Calculate a [ConcavePolygonShape] from the mesh. + Calculate a [ConcavePolygonShape3D] from the mesh. </description> </method> <method name="generate_triangle_mesh" qualifiers="const"> diff --git a/doc/classes/MeshInstance.xml b/doc/classes/MeshInstance.xml deleted file mode 100644 index 6123dfa37a..0000000000 --- a/doc/classes/MeshInstance.xml +++ /dev/null @@ -1,74 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<class name="MeshInstance" inherits="GeometryInstance" version="4.0"> - <brief_description> - Node that instances meshes into a scenario. - </brief_description> - <description> - MeshInstance is a node that takes a [Mesh] resource and adds it to the current scenario by creating an instance of it. This is the class most often used to get 3D geometry rendered and can be used to instance a single [Mesh] in many places. This allows to reuse geometry and save on resources. When a [Mesh] has to be instanced more than thousands of times at close proximity, consider using a [MultiMesh] in a [MultiMeshInstance] instead. - </description> - <tutorials> - </tutorials> - <methods> - <method name="create_convex_collision"> - <return type="void"> - </return> - <description> - This helper creates a [StaticBody] child node with a [ConvexPolygonShape] collision shape calculated from the mesh geometry. It's mainly used for testing. - </description> - </method> - <method name="create_debug_tangents"> - <return type="void"> - </return> - <description> - This helper creates a [MeshInstance] child node with gizmos at every vertex calculated from the mesh geometry. It's mainly used for testing. - </description> - </method> - <method name="create_trimesh_collision"> - <return type="void"> - </return> - <description> - This helper creates a [StaticBody] child node with a [ConcavePolygonShape] collision shape calculated from the mesh geometry. It's mainly used for testing. - </description> - </method> - <method name="get_surface_material" qualifiers="const"> - <return type="Material"> - </return> - <argument index="0" name="surface" type="int"> - </argument> - <description> - Returns the [Material] for a surface of the [Mesh] resource. - </description> - </method> - <method name="get_surface_material_count" qualifiers="const"> - <return type="int"> - </return> - <description> - Returns the number of surface materials. - </description> - </method> - <method name="set_surface_material"> - <return type="void"> - </return> - <argument index="0" name="surface" type="int"> - </argument> - <argument index="1" name="material" type="Material"> - </argument> - <description> - Sets the [Material] for a surface of the [Mesh] resource. - </description> - </method> - </methods> - <members> - <member name="mesh" type="Mesh" setter="set_mesh" getter="get_mesh"> - The [Mesh] resource for the instance. - </member> - <member name="skeleton" type="NodePath" setter="set_skeleton_path" getter="get_skeleton_path" default="NodePath("..")"> - [NodePath] to the [Skeleton] associated with the instance. - </member> - <member name="skin" type="Skin" setter="set_skin" getter="get_skin"> - Sets the skin to be used by this instance. - </member> - </members> - <constants> - </constants> -</class> diff --git a/doc/classes/MeshInstance2D.xml b/doc/classes/MeshInstance2D.xml index 2781dd4626..0cfc8deb0a 100644 --- a/doc/classes/MeshInstance2D.xml +++ b/doc/classes/MeshInstance2D.xml @@ -4,7 +4,7 @@ Node used for displaying a [Mesh] in 2D. </brief_description> <description> - Node used for displaying a [Mesh] in 2D. Can be constructed from an existing [Sprite] via a tool in the editor toolbar. Select "Sprite" then "Convert to Mesh2D", select settings in popup and press "Create Mesh2D". + Node used for displaying a [Mesh] in 2D. Can be constructed from an existing [Sprite2D] via a tool in the editor toolbar. Select "Sprite2D" then "Convert to Mesh2D", select settings in popup and press "Create Mesh2D". </description> <tutorials> <link>https://docs.godotengine.org/en/latest/tutorials/2d/2d_meshes.html</link> diff --git a/doc/classes/MeshInstance3D.xml b/doc/classes/MeshInstance3D.xml new file mode 100644 index 0000000000..c569da2df1 --- /dev/null +++ b/doc/classes/MeshInstance3D.xml @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="MeshInstance3D" inherits="GeometryInstance3D" version="4.0"> + <brief_description> + Node that instances meshes into a scenario. + </brief_description> + <description> + MeshInstance3D is a node that takes a [Mesh] resource and adds it to the current scenario by creating an instance of it. This is the class most often used render 3D geometry and can be used to instance a single [Mesh] in many places. This allows reuse of geometry which can save on resources. When a [Mesh] has to be instanced more than thousands of times at close proximity, consider using a [MultiMesh] in a [MultiMeshInstance3D] instead. + </description> + <tutorials> + </tutorials> + <methods> + <method name="create_convex_collision"> + <return type="void"> + </return> + <description> + This helper creates a [StaticBody3D] child node with a [ConvexPolygonShape3D] collision shape calculated from the mesh geometry. It's mainly used for testing. + </description> + </method> + <method name="create_debug_tangents"> + <return type="void"> + </return> + <description> + This helper creates a [MeshInstance3D] child node with gizmos at every vertex calculated from the mesh geometry. It's mainly used for testing. + </description> + </method> + <method name="create_trimesh_collision"> + <return type="void"> + </return> + <description> + This helper creates a [StaticBody3D] child node with a [ConcavePolygonShape3D] collision shape calculated from the mesh geometry. It's mainly used for testing. + </description> + </method> + <method name="get_active_material" qualifiers="const"> + <return type="Material"> + </return> + <argument index="0" name="surface" type="int"> + </argument> + <description> + Returns the [Material] that will be used by the [Mesh] when drawing. This can return the [member GeometryInstance3D.material_override], the surface override [Material] defined in this [MeshInstance3D], or the surface [Material] defined in the [Mesh]. For example, if [member GeometryInstance3D.material_override] is used, all surfaces will return the override material. + </description> + </method> + <method name="get_surface_material" qualifiers="const"> + <return type="Material"> + </return> + <argument index="0" name="surface" type="int"> + </argument> + <description> + Returns the override [Material] for the specified surface of the [Mesh] resource. + </description> + </method> + <method name="get_surface_material_count" qualifiers="const"> + <return type="int"> + </return> + <description> + Returns the number of surface materials. + </description> + </method> + <method name="set_surface_material"> + <return type="void"> + </return> + <argument index="0" name="surface" type="int"> + </argument> + <argument index="1" name="material" type="Material"> + </argument> + <description> + Sets the override [Material] for the specified surface of the [Mesh] resource. This material is associated with this [MeshInstance3D] rather than with the [Mesh] resource. + </description> + </method> + </methods> + <members> + <member name="mesh" type="Mesh" setter="set_mesh" getter="get_mesh"> + The [Mesh] resource for the instance. + </member> + <member name="skeleton" type="NodePath" setter="set_skeleton_path" getter="get_skeleton_path" default="NodePath("..")"> + [NodePath] to the [Skeleton3D] associated with the instance. + </member> + <member name="skin" type="Skin" setter="set_skin" getter="get_skin"> + Sets the skin to be used by this instance. + </member> + </members> + <constants> + </constants> +</class> diff --git a/doc/classes/MeshLibrary.xml b/doc/classes/MeshLibrary.xml index a96f6d7231..ccf6172017 100644 --- a/doc/classes/MeshLibrary.xml +++ b/doc/classes/MeshLibrary.xml @@ -94,7 +94,7 @@ </argument> <description> Returns an item's collision shapes. - The array consists of each [Shape] followed by its [Transform]. + The array consists of each [Shape3D] followed by its [Transform]. </description> </method> <method name="get_last_unused_item_id" qualifiers="const"> @@ -178,7 +178,7 @@ </argument> <description> Sets an item's collision shapes. - The array should consist of [Shape] objects, each followed by a [Transform] that will be applied to it. For shapes that should not have a transform, use [constant Transform.IDENTITY]. + The array should consist of [Shape3D] objects, each followed by a [Transform] that will be applied to it. For shapes that should not have a transform, use [constant Transform.IDENTITY]. </description> </method> </methods> diff --git a/doc/classes/MultiMesh.xml b/doc/classes/MultiMesh.xml index 2a1d270990..0f56ab4b95 100644 --- a/doc/classes/MultiMesh.xml +++ b/doc/classes/MultiMesh.xml @@ -4,7 +4,7 @@ Provides high-performance mesh instancing. </brief_description> <description> - MultiMesh provides low-level mesh instancing. Drawing thousands of [MeshInstance] nodes can be slow, since each object is submitted to the GPU then drawn individually. + MultiMesh provides low-level mesh instancing. Drawing thousands of [MeshInstance3D] nodes can be slow, since each object is submitted to the GPU then drawn individually. MultiMesh is much faster as it can draw thousands of instances with a single draw call, resulting in less API overhead. As a drawback, if the instances are too far away of each other, performance may be reduced as every single instance will always rendered (they are spatially indexed as one, for the whole object). Since instances may have any behavior, the AABB used for visibility must be provided by the user. diff --git a/doc/classes/MultiMeshInstance2D.xml b/doc/classes/MultiMeshInstance2D.xml index 2fe5447a27..07f21514ef 100644 --- a/doc/classes/MultiMeshInstance2D.xml +++ b/doc/classes/MultiMeshInstance2D.xml @@ -5,7 +5,7 @@ </brief_description> <description> [MultiMeshInstance2D] is a specialized node to instance a [MultiMesh] resource in 2D. - Usage is the same as [MultiMeshInstance]. + Usage is the same as [MultiMeshInstance3D]. </description> <tutorials> </tutorials> diff --git a/doc/classes/MultiMeshInstance.xml b/doc/classes/MultiMeshInstance3D.xml index 6cbc0a8e04..cab17c952e 100644 --- a/doc/classes/MultiMeshInstance.xml +++ b/doc/classes/MultiMeshInstance3D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="MultiMeshInstance" inherits="GeometryInstance" version="4.0"> +<class name="MultiMeshInstance3D" inherits="GeometryInstance3D" version="4.0"> <brief_description> Node that instances a [MultiMesh]. </brief_description> <description> - [MultiMeshInstance] is a specialized node to instance [GeometryInstance]s based on a [MultiMesh] resource. + [MultiMeshInstance3D] is a specialized node to instance [GeometryInstance3D]s based on a [MultiMesh] resource. This is useful to optimize the rendering of a high amount of instances of a given mesh (for example trees in a forest or grass strands). </description> <tutorials> @@ -16,7 +16,7 @@ </methods> <members> <member name="multimesh" type="MultiMesh" setter="set_multimesh" getter="get_multimesh"> - The [MultiMesh] resource that will be used and shared among all instances of the [MultiMeshInstance]. + The [MultiMesh] resource that will be used and shared among all instances of the [MultiMeshInstance3D]. </member> </members> <constants> diff --git a/doc/classes/Navigation.xml b/doc/classes/Navigation3D.xml index 93170bca4a..807f0ad309 100644 --- a/doc/classes/Navigation.xml +++ b/doc/classes/Navigation3D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Navigation" inherits="Spatial" version="4.0"> +<class name="Navigation3D" inherits="Node3D" version="4.0"> <brief_description> Mesh-based navigation and pathfinding node. </brief_description> <description> - Provides navigation and pathfinding within a collection of [NavigationMesh]es. These will be automatically collected from child [NavigationRegion] nodes. In addition to basic pathfinding, this class also assists with aligning navigation agents with the meshes they are navigating on. + Provides navigation and pathfinding within a collection of [NavigationMesh]es. These will be automatically collected from child [NavigationRegion3D] nodes. In addition to basic pathfinding, this class also assists with aligning navigation agents with the meshes they are navigating on. </description> <tutorials> </tutorials> diff --git a/doc/classes/NavigationAgent.xml b/doc/classes/NavigationAgent3D.xml index c6c9abec13..f9df1d390b 100644 --- a/doc/classes/NavigationAgent.xml +++ b/doc/classes/NavigationAgent3D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="NavigationAgent" inherits="Node" version="4.0"> +<class name="NavigationAgent3D" inherits="Node" version="4.0"> <brief_description> 3D Agent used in navigation for collision avoidance. </brief_description> <description> - 3D Agent that is used in navigation to reach a location while avoiding static and dynamic obstacles. The dynamic obstacles are avoided using RVO collision avoidance. The agent needs navigation data to work correctly. This can be done by having the agent as a child of a [Navigation] node, or using [method set_navigation]. [NavigationAgent] is physics safe. + 3D Agent that is used in navigation to reach a location while avoiding static and dynamic obstacles. The dynamic obstacles are avoided using RVO collision avoidance. The agent needs navigation data to work correctly. This can be done by having the agent as a child of a [Navigation3D] node, or using [method set_navigation]. [NavigationAgent3D] is physics safe. </description> <tutorials> </tutorials> @@ -41,7 +41,7 @@ <return type="Node"> </return> <description> - Returns the [Navigation] node that the agent is using for its navigation system. + Returns the [Navigation3D] node that the agent is using for its navigation system. </description> </method> <method name="get_next_location"> @@ -85,7 +85,7 @@ <argument index="0" name="navigation" type="Node"> </argument> <description> - Sets the [Navigation] node used by the agent. Useful when you don't want to make the agent a child of a [Navigation] node. + Sets the [Navigation3D] node used by the agent. Useful when you don't want to make the agent a child of a [Navigation3D] node. </description> </method> <method name="set_target_location"> diff --git a/doc/classes/NavigationObstacle2D.xml b/doc/classes/NavigationObstacle2D.xml index 4d12b985e0..ddd96975f1 100644 --- a/doc/classes/NavigationObstacle2D.xml +++ b/doc/classes/NavigationObstacle2D.xml @@ -4,7 +4,7 @@ 2D Obstacle used in navigation for collision avoidance. </brief_description> <description> - 2D Obstacle used in navigation for collision avoidance. The obstacle needs navigation data to work correctly. This can be done by having the obstacle as a child of a [Navigation2D] node, or using [method set_navigation]. [NavigationObstacle] is physics safe. + 2D Obstacle used in navigation for collision avoidance. The obstacle needs navigation data to work correctly. This can be done by having the obstacle as a child of a [Navigation2D] node, or using [method set_navigation]. [NavigationObstacle2D] is physics safe. </description> <tutorials> </tutorials> diff --git a/doc/classes/NavigationObstacle.xml b/doc/classes/NavigationObstacle3D.xml index 31cf01793a..e01a40ed73 100644 --- a/doc/classes/NavigationObstacle.xml +++ b/doc/classes/NavigationObstacle3D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="NavigationObstacle" inherits="Node" version="4.0"> +<class name="NavigationObstacle3D" inherits="Node" version="4.0"> <brief_description> 3D Obstacle used in navigation for collision avoidance. </brief_description> <description> - 3D Obstacle used in navigation for collision avoidance. The obstacle needs navigation data to work correctly. This can be done by having the obstacle as a child of a [Navigation] node, or using [method set_navigation]. [NavigationObstacle] is physics safe. + 3D Obstacle used in navigation for collision avoidance. The obstacle needs navigation data to work correctly. This can be done by having the obstacle as a child of a [Navigation3D] node, or using [method set_navigation]. [NavigationObstacle3D] is physics safe. </description> <tutorials> </tutorials> @@ -13,7 +13,7 @@ <return type="Node"> </return> <description> - Returns the [Navigation] node that the obstacle is using for its navigation system. + Returns the [Navigation3D] node that the obstacle is using for its navigation system. </description> </method> <method name="set_navigation"> @@ -22,7 +22,7 @@ <argument index="0" name="navigation" type="Node"> </argument> <description> - Sets the [Navigation] node used by the obstacle. Useful when you don't want to make the obstacle a child of a [Navigation] node. + Sets the [Navigation3D] node used by the obstacle. Useful when you don't want to make the obstacle a child of a [Navigation3D] node. </description> </method> </methods> diff --git a/doc/classes/NavigationRegion.xml b/doc/classes/NavigationRegion3D.xml index a32ded2878..b70bfb6596 100644 --- a/doc/classes/NavigationRegion.xml +++ b/doc/classes/NavigationRegion3D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="NavigationRegion" inherits="Spatial" version="4.0"> +<class name="NavigationRegion3D" inherits="Node3D" version="4.0"> <brief_description> A region of the navigation map. </brief_description> <description> - A region of the navigation map. It tells the [Navigation] node what can be navigated and what cannot, based on the [NavigationMesh] resource. This should be a child of a [Navigation] node (even not a direct child). + A region of the navigation map. It tells the [Navigation3D] node what can be navigated and what cannot, based on the [NavigationMesh] resource. This should be a child of a [Navigation3D] node (even not a direct child). </description> <tutorials> </tutorials> @@ -19,7 +19,7 @@ </methods> <members> <member name="enabled" type="bool" setter="set_enabled" getter="is_enabled" default="true"> - Determines if the [NavigationRegion] is enabled or disabled. + Determines if the [NavigationRegion3D] is enabled or disabled. </member> <member name="navmesh" type="NavigationMesh" setter="set_navigation_mesh" getter="get_navigation_mesh"> The [NavigationMesh] resource to use. diff --git a/doc/classes/Navigation2DServer.xml b/doc/classes/NavigationServer2D.xml index 110844c492..1b9099336c 100644 --- a/doc/classes/Navigation2DServer.xml +++ b/doc/classes/NavigationServer2D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Navigation2DServer" inherits="Object" version="4.0"> +<class name="NavigationServer2D" inherits="Object" version="4.0"> <brief_description> Server interface for low-level 2D navigation access </brief_description> <description> - Navigation2DServer is the server responsible for all 2D navigation. It creates the agents, maps, and regions for navigation to work as expected. This keeps tracks of any call and executes them during the sync phase. This means that you can request any change to the map, using any thread, without worrying. + NavigationServer2D is the server responsible for all 2D navigation. It creates the agents, maps, and regions for navigation to work as expected. This keeps tracks of any call and executes them during the sync phase. This means that you can request any change to the map, using any thread, without worrying. </description> <tutorials> </tutorials> diff --git a/doc/classes/NavigationServer.xml b/doc/classes/NavigationServer3D.xml index 1b534b8458..1f621c3c81 100644 --- a/doc/classes/NavigationServer.xml +++ b/doc/classes/NavigationServer3D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="NavigationServer" inherits="Object" version="4.0"> +<class name="NavigationServer3D" inherits="Object" version="4.0"> <brief_description> Server interface for low-level 3D navigation access </brief_description> <description> - NavigationServer is the server responsible for all 3D navigation. It creates the agents, maps, and regions for navigation to work as expected. This keeps tracks of any call and executes them during the sync phase. This means that you can request any change to the map, using any thread, without worrying. + NavigationServer3D is the server responsible for all 3D navigation. It creates the agents, maps, and regions for navigation to work as expected. This keeps tracks of any call and executes them during the sync phase. This means that you can request any change to the map, using any thread, without worrying. </description> <tutorials> </tutorials> diff --git a/doc/classes/Node.xml b/doc/classes/Node.xml index 717130728d..d7bff83575 100644 --- a/doc/classes/Node.xml +++ b/doc/classes/Node.xml @@ -53,7 +53,7 @@ <description> Called when there is an input event. The input event propagates up through the node tree until a node consumes it. It is only called if input processing is enabled, which is done automatically if this method is overridden, and can be toggled with [method set_process_input]. - To consume the input event and stop it propagating further to other nodes, [method SceneTree.set_input_as_handled] can be called. + To consume the input event and stop it propagating further to other nodes, [method Viewport.set_input_as_handled] can be called. For gameplay input, [method _unhandled_input] and [method _unhandled_key_input] are usually a better fit as they allow the GUI to intercept the events first. </description> </method> @@ -97,7 +97,7 @@ <description> Called when an [InputEvent] hasn't been consumed by [method _input] or any GUI. The input event propagates up through the node tree until a node consumes it. It is only called if unhandled input processing is enabled, which is done automatically if this method is overridden, and can be toggled with [method set_process_unhandled_input]. - To consume the input event and stop it propagating further to other nodes, [method SceneTree.set_input_as_handled] can be called. + To consume the input event and stop it propagating further to other nodes, [method Viewport.set_input_as_handled] can be called. For gameplay input, this and [method _unhandled_key_input] are usually a better fit than [method _input] as they allow the GUI to intercept the events first. </description> </method> @@ -109,7 +109,7 @@ <description> Called when an [InputEventKey] hasn't been consumed by [method _input] or any GUI. The input event propagates up through the node tree until a node consumes it. It is only called if unhandled key input processing is enabled, which is done automatically if this method is overridden, and can be toggled with [method set_process_unhandled_key_input]. - To consume the input event and stop it propagating further to other nodes, [method SceneTree.set_input_as_handled] can be called. + To consume the input event and stop it propagating further to other nodes, [method Viewport.set_input_as_handled] can be called. For gameplay input, this and [method _unhandled_input] are usually a better fit than [method _input] as they allow the GUI to intercept the events first. </description> </method> @@ -938,42 +938,40 @@ Notification received from the OS when the game window is unfocused. Implemented on all platforms. </constant> - <constant name="NOTIFICATION_WM_QUIT_REQUEST" value="1006"> - Notification received from the OS when a quit request is sent (e.g. closing the window with a "Close" button or Alt+F4). + <constant name="NOTIFICATION_WM_CLOSE_REQUEST" value="1006"> + Notification received from the OS when a close request is sent (e.g. closing the window with a "Close" button or Alt+F4). Implemented on desktop platforms. </constant> <constant name="NOTIFICATION_WM_GO_BACK_REQUEST" value="1007"> Notification received from the OS when a go back request is sent (e.g. pressing the "Back" button on Android). Specific to the Android platform. </constant> - <constant name="NOTIFICATION_WM_UNFOCUS_REQUEST" value="1008"> - Notification received from the OS when an unfocus request is sent (e.g. another OS window wants to take the focus). - No supported platforms currently send this notification. + <constant name="NOTIFICATION_WM_SIZE_CHANGED" value="1008"> </constant> - <constant name="NOTIFICATION_OS_MEMORY_WARNING" value="1009"> + <constant name="NOTIFICATION_OS_MEMORY_WARNING" value="2009"> Notification received from the OS when the application is exceeding its allocated memory. Specific to the iOS platform. </constant> - <constant name="NOTIFICATION_TRANSLATION_CHANGED" value="1010"> + <constant name="NOTIFICATION_TRANSLATION_CHANGED" value="2010"> Notification received when translations may have changed. Can be triggered by the user changing the locale. Can be used to respond to language changes, for example to change the UI strings on the fly. Useful when working with the built-in translation support, like [method Object.tr]. </constant> - <constant name="NOTIFICATION_WM_ABOUT" value="1011"> + <constant name="NOTIFICATION_WM_ABOUT" value="2011"> Notification received from the OS when a request for "About" information is sent. Specific to the macOS platform. </constant> - <constant name="NOTIFICATION_CRASH" value="1012"> + <constant name="NOTIFICATION_CRASH" value="2012"> Notification received from Godot's crash handler when the engine is about to crash. Implemented on desktop platforms if the crash handler is enabled. </constant> - <constant name="NOTIFICATION_OS_IME_UPDATE" value="1013"> + <constant name="NOTIFICATION_OS_IME_UPDATE" value="2013"> Notification received from the OS when an update of the Input Method Engine occurs (e.g. change of IME cursor position or composition string). Specific to the macOS platform. </constant> - <constant name="NOTIFICATION_APP_RESUMED" value="1014"> + <constant name="NOTIFICATION_APP_RESUMED" value="2014"> Notification received from the OS when the app is resumed. Specific to the Android platform. </constant> - <constant name="NOTIFICATION_APP_PAUSED" value="1015"> + <constant name="NOTIFICATION_APP_PAUSED" value="2015"> Notification received from the OS when the app is paused. Specific to the Android platform. </constant> diff --git a/doc/classes/Spatial.xml b/doc/classes/Node3D.xml index d057db8519..ef24f638fb 100644 --- a/doc/classes/Spatial.xml +++ b/doc/classes/Node3D.xml @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Spatial" inherits="Node" version="4.0"> +<class name="Node3D" inherits="Node" version="4.0"> <brief_description> Most basic 3D game object, parent of all 3D-related nodes. </brief_description> <description> - Most basic 3D game object, with a 3D [Transform] and visibility settings. All other 3D game objects inherit from Spatial. Use [Spatial] as a parent node to move, scale, rotate and show/hide children in a 3D project. - Affine operations (rotate, scale, translate) happen in parent's local coordinate system, unless the [Spatial] object is set as top-level. Affine operations in this coordinate system correspond to direct affine operations on the [Spatial]'s transform. The word local below refers to this coordinate system. The coordinate system that is attached to the [Spatial] object itself is referred to as object-local coordinate system. + Most basic 3D game object, with a 3D [Transform] and visibility settings. All other 3D game objects inherit from Node3D. Use [Node3D] as a parent node to move, scale, rotate and show/hide children in a 3D project. + Affine operations (rotate, scale, translate) happen in parent's local coordinate system, unless the [Node3D] object is set as top-level. Affine operations in this coordinate system correspond to direct affine operations on the [Node3D]'s transform. The word local below refers to this coordinate system. The coordinate system that is attached to the [Node3D] object itself is referred to as object-local coordinate system. </description> <tutorials> <link>https://docs.godotengine.org/en/latest/tutorials/3d/introduction_to_3d.html</link> @@ -19,17 +19,17 @@ </description> </method> <method name="get_parent_spatial" qualifiers="const"> - <return type="Spatial"> + <return type="Node3D"> </return> <description> - Returns the parent [Spatial], or an empty [Object] if no parent exists or parent is not of type [Spatial]. + Returns the parent [Node3D], or an empty [Object] if no parent exists or parent is not of type [Node3D]. </description> </method> <method name="get_world" qualifiers="const"> - <return type="World"> + <return type="World3D"> </return> <description> - Returns the current [World] resource this [Spatial] node is registered to. + Returns the current [World3D] resource this [Node3D] node is registered to. </description> </method> <method name="global_rotate"> @@ -72,7 +72,7 @@ <return type="bool"> </return> <description> - Returns whether node notifies about its local transformation changes. [Spatial] will not propagate this by default. + Returns whether node notifies about its local transformation changes. [Node3D] will not propagate this by default. </description> </method> <method name="is_scale_disabled" qualifiers="const"> @@ -93,7 +93,7 @@ <return type="bool"> </return> <description> - Returns whether the node notifies about its global and local transformation changes. [Spatial] will not propagate this by default. + Returns whether the node notifies about its global and local transformation changes. [Node3D] will not propagate this by default. </description> </method> <method name="is_visible_in_tree" qualifiers="const"> @@ -234,7 +234,7 @@ <argument index="0" name="enable" type="bool"> </argument> <description> - Sets whether the node notifies about its local transformation changes. [Spatial] will not propagate this by default. + Sets whether the node notifies about its local transformation changes. [Node3D] will not propagate this by default. </description> </method> <method name="set_notify_transform"> @@ -243,7 +243,7 @@ <argument index="0" name="enable" type="bool"> </argument> <description> - Sets whether the node notifies about its global and local transformation changes. [Spatial] will not propagate this by default. + Sets whether the node notifies about its global and local transformation changes. [Node3D] will not propagate this by default. </description> </method> <method name="show"> @@ -294,16 +294,16 @@ <return type="void"> </return> <description> - Updates the [SpatialGizmo] of this node. + Updates the [Node3DGizmo] of this node. </description> </method> </methods> <members> - <member name="gizmo" type="SpatialGizmo" setter="set_gizmo" getter="get_gizmo"> - The [SpatialGizmo] for this node. Used for example in [EditorSpatialGizmo] as custom visualization and editing handles in Editor. + <member name="gizmo" type="Node3DGizmo" setter="set_gizmo" getter="get_gizmo"> + The [Node3DGizmo] for this node. Used for example in [EditorNode3DGizmo] as custom visualization and editing handles in Editor. </member> <member name="global_transform" type="Transform" setter="set_global_transform" getter="get_global_transform"> - World space (global) [Transform] of this node. + World3D space (global) [Transform] of this node. </member> <member name="rotation" type="Vector3" setter="set_rotation" getter="get_rotation"> Rotation part of the local transformation in radians, specified in terms of YXZ-Euler angles in the format (X angle, Y angle, Z angle). @@ -334,17 +334,17 @@ </signals> <constants> <constant name="NOTIFICATION_TRANSFORM_CHANGED" value="2000"> - Spatial nodes receives this notification when their global transform changes. This means that either the current or a parent node changed its transform. + Node3D nodes receives this notification when their global transform changes. This means that either the current or a parent node changed its transform. In order for [constant NOTIFICATION_TRANSFORM_CHANGED] to work, users first need to ask for it, with [method set_notify_transform]. </constant> <constant name="NOTIFICATION_ENTER_WORLD" value="41"> - Spatial nodes receives this notification when they are registered to new [World] resource. + Node3D nodes receives this notification when they are registered to new [World3D] resource. </constant> <constant name="NOTIFICATION_EXIT_WORLD" value="42"> - Spatial nodes receives this notification when they are unregistered from current [World] resource. + Node3D nodes receives this notification when they are unregistered from current [World3D] resource. </constant> <constant name="NOTIFICATION_VISIBILITY_CHANGED" value="43"> - Spatial nodes receives this notification when their visibility changes. + Node3D nodes receives this notification when their visibility changes. </constant> </constants> </class> diff --git a/doc/classes/SpatialGizmo.xml b/doc/classes/Node3DGizmo.xml index 5260eaa8a3..55080614fc 100644 --- a/doc/classes/SpatialGizmo.xml +++ b/doc/classes/Node3DGizmo.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="SpatialGizmo" inherits="Reference" version="4.0"> +<class name="Node3DGizmo" inherits="Reference" version="4.0"> <brief_description> </brief_description> <description> diff --git a/doc/classes/NodePath.xml b/doc/classes/NodePath.xml index e8ab3e536e..dc7fd1be3f 100644 --- a/doc/classes/NodePath.xml +++ b/doc/classes/NodePath.xml @@ -4,7 +4,7 @@ Pre-parsed scene tree path. </brief_description> <description> - A pre-parsed relative or absolute path in a scene tree, for use with [method Node.get_node] and similar functions. It can reference a node, a resource within a node, or a property of a node or resource. For instance, [code]"Path2D/PathFollow2D/Sprite:texture:size"[/code] would refer to the [code]size[/code] property of the [code]texture[/code] resource on the node named [code]"Sprite"[/code] which is a child of the other named nodes in the path. + A pre-parsed relative or absolute path in a scene tree, for use with [method Node.get_node] and similar functions. It can reference a node, a resource within a node, or a property of a node or resource. For instance, [code]"Path2D/PathFollow2D/Sprite2D:texture:size"[/code] would refer to the [code]size[/code] property of the [code]texture[/code] resource on the node named [code]"Sprite2D"[/code] which is a child of the other named nodes in the path. You will usually just pass a string to [method Node.get_node] and it will be automatically converted, but you may occasionally want to parse a path ahead of time with [NodePath] or the literal syntax [code]@"path"[/code]. Exporting a [NodePath] variable will give you a node selection widget in the properties panel of the editor, which can often be useful. A [NodePath] is composed of a list of slash-separated node names (like a filesystem path) and an optional colon-separated list of "subnames" which can be resources or properties. Some examples of NodePaths include the following: @@ -30,20 +30,20 @@ <argument index="0" name="from" type="String"> </argument> <description> - Creates a NodePath from a string, e.g. [code]"Path2D/PathFollow2D/Sprite:texture:size"[/code]. A path is absolute if it starts with a slash. Absolute paths are only valid in the global scene tree, not within individual scenes. In a relative path, [code]"."[/code] and [code]".."[/code] indicate the current node and its parent. + Creates a NodePath from a string, e.g. [code]"Path2D/PathFollow2D/Sprite2D:texture:size"[/code]. A path is absolute if it starts with a slash. Absolute paths are only valid in the global scene tree, not within individual scenes. In a relative path, [code]"."[/code] and [code]".."[/code] indicate the current node and its parent. The "subnames" optionally included after the path to the target node can point to resources or properties, and can also be nested. Examples of valid NodePaths (assuming that those nodes exist and have the referenced resources or properties): [codeblock] - # Points to the Sprite node - "Path2D/PathFollow2D/Sprite" - # Points to the Sprite node and its "texture" resource. - # get_node() would retrieve "Sprite", while get_node_and_resource() - # would retrieve both the Sprite node and the "texture" resource. - "Path2D/PathFollow2D/Sprite:texture" - # Points to the Sprite node and its "position" property. - "Path2D/PathFollow2D/Sprite:position" - # Points to the Sprite node and the "x" component of its "position" property. - "Path2D/PathFollow2D/Sprite:position:x" + # Points to the Sprite2D node + "Path2D/PathFollow2D/Sprite2D" + # Points to the Sprite2D node and its "texture" resource. + # get_node() would retrieve "Sprite2D", while get_node_and_resource() + # would retrieve both the Sprite2D node and the "texture" resource. + "Path2D/PathFollow2D/Sprite2D:texture" + # Points to the Sprite2D node and its "position" property. + "Path2D/PathFollow2D/Sprite2D:position" + # Points to the Sprite2D node and the "x" component of its "position" property. + "Path2D/PathFollow2D/Sprite2D:position:x" # Absolute path (from "root") "/root/Level/Path2D" [/codeblock] @@ -69,7 +69,7 @@ <description> Returns all subnames concatenated with a colon character ([code]:[/code]) as separator, i.e. the right side of the first colon in a node path. [codeblock] - var nodepath = NodePath("Path2D/PathFollow2D/Sprite:texture:load_path") + var nodepath = NodePath("Path2D/PathFollow2D/Sprite2D:texture:load_path") print(nodepath.get_concatenated_subnames()) # texture:load_path [/codeblock] </description> @@ -82,7 +82,7 @@ <description> Gets the node name indicated by [code]idx[/code] (0 to [method get_name_count]). [codeblock] - var node_path = NodePath("Path2D/PathFollow2D/Sprite") + var node_path = NodePath("Path2D/PathFollow2D/Sprite2D") print(node_path.get_name(0)) # Path2D print(node_path.get_name(1)) # PathFollow2D print(node_path.get_name(2)) # Sprite @@ -94,7 +94,7 @@ </return> <description> Gets the number of node names which make up the path. Subnames (see [method get_subname_count]) are not included. - For example, [code]"Path2D/PathFollow2D/Sprite"[/code] has 3 names. + For example, [code]"Path2D/PathFollow2D/Sprite2D"[/code] has 3 names. </description> </method> <method name="get_subname"> @@ -105,7 +105,7 @@ <description> Gets the resource or property name indicated by [code]idx[/code] (0 to [method get_subname_count]). [codeblock] - var node_path = NodePath("Path2D/PathFollow2D/Sprite:texture:load_path") + var node_path = NodePath("Path2D/PathFollow2D/Sprite2D:texture:load_path") print(node_path.get_subname(0)) # texture print(node_path.get_subname(1)) # load_path [/codeblock] @@ -116,7 +116,7 @@ </return> <description> Gets the number of resource or property names ("subnames") in the path. Each subname is listed after a colon character ([code]:[/code]) in the node path. - For example, [code]"Path2D/PathFollow2D/Sprite:texture:load_path"[/code] has 2 subnames. + For example, [code]"Path2D/PathFollow2D/Sprite2D:texture:load_path"[/code] has 2 subnames. </description> </method> <method name="is_absolute"> diff --git a/doc/classes/OS.xml b/doc/classes/OS.xml index d43c395433..db79ee7765 100644 --- a/doc/classes/OS.xml +++ b/doc/classes/OS.xml @@ -9,24 +9,6 @@ <tutorials> </tutorials> <methods> - <method name="alert"> - <return type="void"> - </return> - <argument index="0" name="text" type="String"> - </argument> - <argument index="1" name="title" type="String" default=""Alert!""> - </argument> - <description> - Displays a modal dialog box using the host OS' facilities. Execution is blocked until the dialog is closed. - </description> - </method> - <method name="can_draw" qualifiers="const"> - <return type="bool"> - </return> - <description> - Returns [code]true[/code] if the host OS allows drawing. - </description> - </method> <method name="can_use_threads" qualifiers="const"> <return type="bool"> </return> @@ -34,13 +16,6 @@ Returns [code]true[/code] if the current host platform is using multiple threads. </description> </method> - <method name="center_window"> - <return type="void"> - </return> - <description> - Centers the window on the screen if in windowed mode. - </description> - </method> <method name="close_midi_inputs"> <return type="void"> </return> @@ -133,22 +108,6 @@ Returns the keycode of the given string (e.g. "Escape"). </description> </method> - <method name="get_audio_driver_count" qualifiers="const"> - <return type="int"> - </return> - <description> - Returns the total number of available audio drivers. - </description> - </method> - <method name="get_audio_driver_name" qualifiers="const"> - <return type="String"> - </return> - <argument index="0" name="driver" type="int"> - </argument> - <description> - Returns the audio driver name for the given index. - </description> - </method> <method name="get_cmdline_args"> <return type="PackedStringArray"> </return> @@ -165,13 +124,6 @@ [b]Note:[/b] This method is implemented on Linux, macOS and Windows. </description> </method> - <method name="get_current_video_driver" qualifiers="const"> - <return type="int" enum="OS.VideoDriver"> - </return> - <description> - Returns the currently used video driver, using one of the values from [enum VideoDriver]. - </description> - </method> <method name="get_date" qualifiers="const"> <return type="Dictionary"> </return> @@ -224,24 +176,6 @@ [b]Note:[/b] This method is implemented on Android. </description> </method> - <method name="get_ime_selection" qualifiers="const"> - <return type="Vector2"> - </return> - <description> - Returns the IME cursor position (the currently-edited portion of the string) relative to the characters in the composition string. - [constant MainLoop.NOTIFICATION_OS_IME_UPDATE] is sent to the application to notify it of changes to the IME cursor position. - [b]Note:[/b] This method is implemented on macOS. - </description> - </method> - <method name="get_ime_text" qualifiers="const"> - <return type="String"> - </return> - <description> - Returns the IME intermediate composition string. - [constant MainLoop.NOTIFICATION_OS_IME_UPDATE] is sent to the application to notify it of changes to the IME composition string. - [b]Note:[/b] This method is implemented on macOS. - </description> - </method> <method name="get_keycode_string" qualifiers="const"> <return type="String"> </return> @@ -252,15 +186,6 @@ See also [member InputEventKey.keycode] and [method InputEventKey.get_keycode_with_modifiers]. </description> </method> - <method name="get_latin_keyboard_variant" qualifiers="const"> - <return type="String"> - </return> - <description> - Returns the current latin keyboard variant as a String. - Possible return values are: [code]"QWERTY"[/code], [code]"AZERTY"[/code], [code]"QZERTY"[/code], [code]"DVORAK"[/code], [code]"NEO"[/code], [code]"COLEMAK"[/code] or [code]"ERROR"[/code]. - [b]Note:[/b] This method is implemented on Linux, macOS and Windows. Returns [code]"QWERTY"[/code] on unsupported platforms. - </description> - </method> <method name="get_locale" qualifiers="const"> <return type="String"> </return> @@ -298,57 +223,6 @@ Returns the number of threads available on the host machine. </description> </method> - <method name="get_real_window_size" qualifiers="const"> - <return type="Vector2"> - </return> - <description> - Returns the window size including decorations like window borders. - </description> - </method> - <method name="get_screen_count" qualifiers="const"> - <return type="int"> - </return> - <description> - Returns the number of displays attached to the host machine. - </description> - </method> - <method name="get_screen_dpi" qualifiers="const"> - <return type="int"> - </return> - <argument index="0" name="screen" type="int" default="-1"> - </argument> - <description> - Returns the dots per inch density of the specified screen. If [code]screen[/code] is [/code]-1[/code] (the default value), the current screen will be used. - On Android devices, the actual screen densities are grouped into six generalized densities: - [codeblock] - ldpi - 120 dpi - mdpi - 160 dpi - hdpi - 240 dpi - xhdpi - 320 dpi - xxhdpi - 480 dpi - xxxhdpi - 640 dpi - [/codeblock] - [b]Note:[/b] This method is implemented on Android, Linux, macOS and Windows. Returns [code]72[/code] on unsupported platforms. - </description> - </method> - <method name="get_screen_position" qualifiers="const"> - <return type="Vector2"> - </return> - <argument index="0" name="screen" type="int" default="-1"> - </argument> - <description> - Returns the position of the specified screen by index. If [code]screen[/code] is [/code]-1[/code] (the default value), the current screen will be used. - </description> - </method> - <method name="get_screen_size" qualifiers="const"> - <return type="Vector2"> - </return> - <argument index="0" name="screen" type="int" default="-1"> - </argument> - <description> - Returns the dimensions in pixels of the specified screen. If [code]screen[/code] is [/code]-1[/code] (the default value), the current screen will be used. - </description> - </method> <method name="get_splash_tick_msec" qualifiers="const"> <return type="int"> </return> @@ -461,84 +335,6 @@ If the project name is empty, [code]user://[/code] falls back to [code]res://[/code]. </description> </method> - <method name="get_video_driver_count" qualifiers="const"> - <return type="int"> - </return> - <description> - Returns the number of video drivers supported on the current platform. - </description> - </method> - <method name="get_video_driver_name" qualifiers="const"> - <return type="String"> - </return> - <argument index="0" name="driver" type="int" enum="OS.VideoDriver"> - </argument> - <description> - Returns the name of the video driver matching the given [code]driver[/code] index. This index is a value from [enum VideoDriver], and you can use [method get_current_video_driver] to get the current backend's index. - </description> - </method> - <method name="get_virtual_keyboard_height"> - <return type="int"> - </return> - <description> - Returns the on-screen keyboard's height in pixels. Returns 0 if there is no keyboard or if it is currently hidden. - </description> - </method> - <method name="get_window_safe_area" qualifiers="const"> - <return type="Rect2"> - </return> - <description> - Returns unobscured area of the window where interactive controls should be rendered. - </description> - </method> - <method name="global_menu_add_item"> - <return type="void"> - </return> - <argument index="0" name="menu" type="String"> - </argument> - <argument index="1" name="label" type="String"> - </argument> - <argument index="2" name="id" type="Variant"> - </argument> - <argument index="3" name="meta" type="Variant"> - </argument> - <description> - Add a new item with text "label" to global menu. Use "_dock" menu to add item to the macOS dock icon menu. - [b]Note:[/b] This method is implemented on macOS. - </description> - </method> - <method name="global_menu_add_separator"> - <return type="void"> - </return> - <argument index="0" name="menu" type="String"> - </argument> - <description> - Add a separator between items. Separators also occupy an index. - [b]Note:[/b] This method is implemented on macOS. - </description> - </method> - <method name="global_menu_clear"> - <return type="void"> - </return> - <argument index="0" name="menu" type="String"> - </argument> - <description> - Clear the global menu, in effect removing all items. - [b]Note:[/b] This method is implemented on macOS. - </description> - </method> - <method name="global_menu_remove_item"> - <return type="void"> - </return> - <argument index="0" name="menu" type="String"> - </argument> - <argument index="1" name="idx" type="int"> - </argument> - <description> - Removes the item at index "idx" from the global menu. Note that the indexes of items after the removed item are going to be shifted by one. - [b]Note:[/b] This method is implemented on macOS. - </description> - </method> <method name="has_environment" qualifiers="const"> <return type="bool"> </return> @@ -558,27 +354,6 @@ [b]Note:[/b] Tag names are case-sensitive. </description> </method> - <method name="has_touchscreen_ui_hint" qualifiers="const"> - <return type="bool"> - </return> - <description> - Returns [code]true[/code] if the device has a touchscreen or emulates one. - </description> - </method> - <method name="has_virtual_keyboard" qualifiers="const"> - <return type="bool"> - </return> - <description> - Returns [code]true[/code] if the platform has a virtual keyboard, [code]false[/code] otherwise. - </description> - </method> - <method name="hide_virtual_keyboard"> - <return type="void"> - </return> - <description> - Hides the virtual keyboard if it is shown, does nothing otherwise. - </description> - </method> <method name="is_debug_build" qualifiers="const"> <return type="bool"> </return> @@ -597,13 +372,6 @@ Returns [code]true[/code] if the input keycode corresponds to a Unicode character. </description> </method> - <method name="is_ok_left_and_cancel_right" qualifiers="const"> - <return type="bool"> - </return> - <description> - Returns [code]true[/code] if the [b]OK[/b] button should appear on the left and [b]Cancel[/b] on the right. - </description> - </method> <method name="is_stdout_verbose" qualifiers="const"> <return type="bool"> </return> @@ -618,21 +386,6 @@ If [code]true[/code], the [code]user://[/code] file system is persistent, so that its state is the same after a player quits and starts the game again. Relevant to the HTML5 platform, where this persistence may be unavailable. </description> </method> - <method name="is_window_always_on_top" qualifiers="const"> - <return type="bool"> - </return> - <description> - Returns [code]true[/code] if the window should always be on top of other windows. - </description> - </method> - <method name="is_window_focused" qualifiers="const"> - <return type="bool"> - </return> - <description> - Returns [code]true[/code] if the window is currently focused. - [b]Note:[/b] Only implemented on desktop platforms. On other platforms, it will always return [code]true[/code]. - </description> - </method> <method name="kill"> <return type="int" enum="Error"> </return> @@ -644,62 +397,6 @@ [b]Note:[/b] This method is implemented on Android, iOS, Linux, macOS and Windows. </description> </method> - <method name="move_window_to_foreground"> - <return type="void"> - </return> - <description> - Moves the window to the front. - [b]Note:[/b] This method is implemented on Linux, macOS and Windows. - </description> - </method> - <method name="native_video_is_playing"> - <return type="bool"> - </return> - <description> - Returns [code]true[/code] if native video is playing. - [b]Note:[/b] This method is implemented on Android and iOS. - </description> - </method> - <method name="native_video_pause"> - <return type="void"> - </return> - <description> - Pauses native video playback. - [b]Note:[/b] This method is implemented on Android and iOS. - </description> - </method> - <method name="native_video_play"> - <return type="int" enum="Error"> - </return> - <argument index="0" name="path" type="String"> - </argument> - <argument index="1" name="volume" type="float"> - </argument> - <argument index="2" name="audio_track" type="String"> - </argument> - <argument index="3" name="subtitle_track" type="String"> - </argument> - <description> - Plays native video from the specified path, at the given volume and with audio and subtitle tracks. - [b]Note:[/b] This method is implemented on Android and iOS, and the current Android implementation does not support the [code]volume[/code], [code]audio_track[/code] and [code]subtitle_track[/code] options. - </description> - </method> - <method name="native_video_stop"> - <return type="void"> - </return> - <description> - Stops native video playback. - [b]Note:[/b] This method is implemented on Android and iOS. - </description> - </method> - <method name="native_video_unpause"> - <return type="void"> - </return> - <description> - Resumes native video playback. - [b]Note:[/b] This method is implemented on Android and iOS. - </description> - </method> <method name="open_midi_inputs"> <return type="void"> </return> @@ -742,14 +439,6 @@ Shows all resources currently used by the game. </description> </method> - <method name="request_attention"> - <return type="void"> - </return> - <description> - Request the user attention to the window. It'll flash the taskbar button on Windows or bounce the dock icon on OSX. - [b]Note:[/b] This method is implemented on Linux, macOS and Windows. - </description> - </method> <method name="request_permission"> <return type="bool"> </return> @@ -767,51 +456,6 @@ [b]Note:[/b] This method is implemented on Android. </description> </method> - <method name="set_icon"> - <return type="void"> - </return> - <argument index="0" name="icon" type="Image"> - </argument> - <description> - Sets the game's icon using an [Image] resource. - The same image is used for window caption, taskbar/dock and window selection dialog. Image is scaled as needed. - [b]Note:[/b] This method is implemented on HTML5, Linux, macOS and Windows. - </description> - </method> - <method name="set_ime_active"> - <return type="void"> - </return> - <argument index="0" name="active" type="bool"> - </argument> - <description> - Sets whether IME input mode should be enabled. - If active IME handles key events before the application and creates an composition string and suggestion list. - Application can retrieve the composition status by using [method get_ime_selection] and [method get_ime_text] functions. - Completed composition string is committed when input is finished. - [b]Note:[/b] This method is implemented on Linux, macOS and Windows. - </description> - </method> - <method name="set_ime_position"> - <return type="void"> - </return> - <argument index="0" name="position" type="Vector2"> - </argument> - <description> - Sets position of IME suggestion list popup (in window coordinates). - [b]Note:[/b] This method is implemented on Linux, macOS and Windows. - </description> - </method> - <method name="set_native_icon"> - <return type="void"> - </return> - <argument index="0" name="filename" type="String"> - </argument> - <description> - Sets the game's icon using a multi-size platform-specific icon file ([code]*.ico[/code] on Windows and [code]*.icns[/code] on macOS). - Appropriate size sub-icons are used for window caption, taskbar/dock and window selection dialog. - [b]Note:[/b] This method is implemented on macOS and Windows. - </description> - </method> <method name="set_thread_name"> <return type="int" enum="Error"> </return> @@ -830,27 +474,6 @@ Enables backup saves if [code]enabled[/code] is [code]true[/code]. </description> </method> - <method name="set_window_always_on_top"> - <return type="void"> - </return> - <argument index="0" name="enabled" type="bool"> - </argument> - <description> - Sets whether the window should always be on top. - [b]Note:[/b] This method is implemented on Linux, macOS and Windows. - </description> - </method> - <method name="set_window_title"> - <return type="void"> - </return> - <argument index="0" name="title" type="String"> - </argument> - <description> - Sets the window title to the specified string. - [b]Note:[/b] This should be used sporadically. Don't set this every frame, as that will negatively affect performance on some window managers. - [b]Note:[/b] This method is implemented on HTML5, Linux, macOS and Windows. - </description> - </method> <method name="shell_open"> <return type="int" enum="Error"> </return> @@ -864,82 +487,18 @@ [b]Note:[/b] This method is implemented on Android, iOS, HTML5, Linux, macOS and Windows. </description> </method> - <method name="show_virtual_keyboard"> - <return type="void"> - </return> - <argument index="0" name="existing_text" type="String" default=""""> - </argument> - <description> - Shows the virtual keyboard if the platform has one. The [code]existing_text[/code] parameter is useful for implementing your own LineEdit, as it tells the virtual keyboard what text has already been typed (the virtual keyboard uses it for auto-correct and predictions). - [b]Note:[/b] This method is implemented on Android, iOS and UWP. - </description> - </method> </methods> <members> - <member name="clipboard" type="String" setter="set_clipboard" getter="get_clipboard" default=""""> - The clipboard from the host OS. Might be unavailable on some platforms. - </member> - <member name="current_screen" type="int" setter="set_current_screen" getter="get_current_screen" default="0"> - The current screen index (starting from 0). - </member> <member name="exit_code" type="int" setter="set_exit_code" getter="get_exit_code" default="0"> The exit code passed to the OS when the main loop exits. By convention, an exit code of [code]0[/code] indicates success whereas a non-zero exit code indicates an error. For portability reasons, the exit code should be set between 0 and 125 (inclusive). [b]Note:[/b] This value will be ignored if using [method SceneTree.quit] with an [code]exit_code[/code] argument passed. </member> - <member name="keep_screen_on" type="bool" setter="set_keep_screen_on" getter="is_keep_screen_on" default="true"> - If [code]true[/code], the engine tries to keep the screen on while the game is running. Useful on mobile. - </member> <member name="low_processor_usage_mode" type="bool" setter="set_low_processor_usage_mode" getter="is_in_low_processor_usage_mode" default="false"> If [code]true[/code], the engine optimizes for low processor usage by only refreshing the screen if needed. Can improve battery consumption on mobile. </member> <member name="low_processor_usage_mode_sleep_usec" type="int" setter="set_low_processor_usage_mode_sleep_usec" getter="get_low_processor_usage_mode_sleep_usec" default="6900"> The amount of sleeping between frames when the low-processor usage mode is enabled (in microseconds). Higher values will result in lower CPU usage. </member> - <member name="max_window_size" type="Vector2" setter="set_max_window_size" getter="get_max_window_size" default="Vector2( 0, 0 )"> - The maximum size of the window (without counting window manager decorations). Does not affect fullscreen mode. Set to [code](0, 0)[/code] to reset to the system default value. - </member> - <member name="min_window_size" type="Vector2" setter="set_min_window_size" getter="get_min_window_size" default="Vector2( 0, 0 )"> - The minimum size of the window (without counting window manager decorations). Does not affect fullscreen mode. Set to [code](0, 0)[/code] to reset to the system default value. - </member> - <member name="screen_orientation" type="int" setter="set_screen_orientation" getter="get_screen_orientation" enum="_OS.ScreenOrientation" default="0"> - The current screen orientation. - </member> - <member name="vsync_enabled" type="bool" setter="set_use_vsync" getter="is_vsync_enabled" default="true"> - If [code]true[/code], vertical synchronization (Vsync) is enabled. - </member> - <member name="vsync_via_compositor" type="bool" setter="set_vsync_via_compositor" getter="is_vsync_via_compositor_enabled" default="false"> - If [code]true[/code] and [code]vsync_enabled[/code] is true, the operating system's window compositor will be used for vsync when the compositor is enabled and the game is in windowed mode. - [b]Note:[/b] This option is experimental and meant to alleviate stutter experienced by some users. However, some users have experienced a Vsync framerate halving (e.g. from 60 FPS to 30 FPS) when using it. - [b]Note:[/b] This property is only implemented on Windows. - </member> - <member name="window_borderless" type="bool" setter="set_borderless_window" getter="get_borderless_window" default="false"> - If [code]true[/code], removes the window frame. - [b]Note:[/b] Setting [code]window_borderless[/code] to [code]false[/code] disables per-pixel transparency. - </member> - <member name="window_fullscreen" type="bool" setter="set_window_fullscreen" getter="is_window_fullscreen" default="false"> - If [code]true[/code], the window is fullscreen. - </member> - <member name="window_maximized" type="bool" setter="set_window_maximized" getter="is_window_maximized" default="false"> - If [code]true[/code], the window is maximized. - </member> - <member name="window_minimized" type="bool" setter="set_window_minimized" getter="is_window_minimized" default="false"> - If [code]true[/code], the window is minimized. - </member> - <member name="window_per_pixel_transparency_enabled" type="bool" setter="set_window_per_pixel_transparency_enabled" getter="get_window_per_pixel_transparency_enabled" default="false"> - If [code]true[/code], the window background is transparent and window frame is removed. - Use [code]get_tree().get_root().set_transparent_background(true)[/code] to disable main viewport background rendering. - [b]Note:[/b] This property has no effect if [b]Project > Project Settings > Display > Window > Per-pixel transparency > Allowed[/b] setting is disabled. - [b]Note:[/b] This property is implemented on HTML5, Linux, macOS and Windows. - </member> - <member name="window_position" type="Vector2" setter="set_window_position" getter="get_window_position" default="Vector2( 0, 0 )"> - The window position relative to the screen, the origin is the top left corner, +Y axis goes to the bottom and +X axis goes to the right. - </member> - <member name="window_resizable" type="bool" setter="set_window_resizable" getter="is_window_resizable" default="true"> - If [code]true[/code], the window is resizable by the user. - </member> - <member name="window_size" type="Vector2" setter="set_window_size" getter="get_window_size" default="Vector2( 0, 0 )"> - The size of the window (without counting window manager decorations). - </member> </members> <constants> <constant name="VIDEO_DRIVER_GLES2" value="0" enum="VideoDriver"> @@ -1005,27 +564,6 @@ <constant name="MONTH_DECEMBER" value="12" enum="Month"> December. </constant> - <constant name="SCREEN_ORIENTATION_LANDSCAPE" value="0" enum="ScreenOrientation"> - Landscape screen orientation. - </constant> - <constant name="SCREEN_ORIENTATION_PORTRAIT" value="1" enum="ScreenOrientation"> - Portrait screen orientation. - </constant> - <constant name="SCREEN_ORIENTATION_REVERSE_LANDSCAPE" value="2" enum="ScreenOrientation"> - Reverse landscape screen orientation. - </constant> - <constant name="SCREEN_ORIENTATION_REVERSE_PORTRAIT" value="3" enum="ScreenOrientation"> - Reverse portrait screen orientation. - </constant> - <constant name="SCREEN_ORIENTATION_SENSOR_LANDSCAPE" value="4" enum="ScreenOrientation"> - Uses landscape or reverse landscape based on the hardware sensor. - </constant> - <constant name="SCREEN_ORIENTATION_SENSOR_PORTRAIT" value="5" enum="ScreenOrientation"> - Uses portrait or reverse portrait based on the hardware sensor. - </constant> - <constant name="SCREEN_ORIENTATION_SENSOR" value="6" enum="ScreenOrientation"> - Uses most suitable orientation based on the hardware sensor. - </constant> <constant name="SYSTEM_DIR_DESKTOP" value="0" enum="SystemDir"> Desktop directory path. </constant> diff --git a/doc/classes/Object.xml b/doc/classes/Object.xml index 33f5fc0f35..35e87d1a2a 100644 --- a/doc/classes/Object.xml +++ b/doc/classes/Object.xml @@ -314,7 +314,7 @@ <method name="has_signal" qualifiers="const"> <return type="bool"> </return> - <argument index="0" name="signal" type="String"> + <argument index="0" name="signal" type="StringName"> </argument> <description> Returns [code]true[/code] if the given [code]signal[/code] exists. diff --git a/doc/classes/OmniLight.xml b/doc/classes/OmniLight3D.xml index dc57efd3f9..0bbc987156 100644 --- a/doc/classes/OmniLight.xml +++ b/doc/classes/OmniLight3D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="OmniLight" inherits="Light" version="4.0"> +<class name="OmniLight3D" inherits="Light3D" version="4.0"> <brief_description> Omnidirectional light, such as a light bulb or a candle. </brief_description> <description> - An Omnidirectional light is a type of [Light] that emits light in all directions. The light is attenuated by distance and this attenuation can be configured by changing its energy, radius, and attenuation parameters. + An Omnidirectional light is a type of [Light3D] that emits light in all directions. The light is attenuated by distance and this attenuation can be configured by changing its energy, radius, and attenuation parameters. </description> <tutorials> <link>https://docs.godotengine.org/en/latest/tutorials/3d/lights_and_shadows.html</link> @@ -18,7 +18,7 @@ <member name="omni_range" type="float" setter="set_param" getter="get_param" default="5.0"> The light's radius. </member> - <member name="omni_shadow_mode" type="int" setter="set_shadow_mode" getter="get_shadow_mode" enum="OmniLight.ShadowMode" default="1"> + <member name="omni_shadow_mode" type="int" setter="set_shadow_mode" getter="get_shadow_mode" enum="OmniLight3D.ShadowMode" default="1"> See [enum ShadowMode]. </member> </members> diff --git a/doc/classes/Panel.xml b/doc/classes/Panel.xml index a3f6a0be8f..7285bc9e2e 100644 --- a/doc/classes/Panel.xml +++ b/doc/classes/Panel.xml @@ -10,11 +10,21 @@ </tutorials> <methods> </methods> + <members> + <member name="mode" type="int" setter="set_mode" getter="get_mode" enum="Panel.Mode" default="0"> + </member> + </members> <constants> + <constant name="MODE_BACKGROUND" value="0" enum="Mode"> + </constant> + <constant name="MODE_FOREGROUND" value="1" enum="Mode"> + </constant> </constants> <theme_items> <theme_item name="panel" type="StyleBox"> The style of this [Panel]. </theme_item> + <theme_item name="panel_fg" type="StyleBox"> + </theme_item> </theme_items> </class> diff --git a/doc/classes/ParticlesMaterial.xml b/doc/classes/ParticlesMaterial.xml index 1e90214e47..d04ac5bdce 100644 --- a/doc/classes/ParticlesMaterial.xml +++ b/doc/classes/ParticlesMaterial.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="ParticlesMaterial" inherits="Material" version="4.0"> <brief_description> - Particle properties for [Particles] and [Particles2D] nodes. + Particle properties for [GPUParticles3D] and [GPUParticles2D] nodes. </brief_description> <description> - ParticlesMaterial defines particle properties and behavior. It is used in the [code]process_material[/code] of [Particles] and [Particles2D] emitter nodes. + ParticlesMaterial defines particle properties and behavior. It is used in the [code]process_material[/code] of [GPUParticles3D] and [GPUParticles2D] emitter nodes. Some of this material's properties are applied to each particle when emitted, while others can have a [CurveTexture] applied to vary values over the lifetime of the particle. When a randomness ratio is applied to a property it is used to scale that property by a random amount. The random ratio is used to interpolate between [code]1.0[/code] and a random number less than one, the result is multiplied by the property to obtain the randomized property. For example a random ratio of [code]0.4[/code] would scale the original property between [code]0.4-1.0[/code] of its original value. </description> @@ -132,7 +132,7 @@ Animation speed randomness ratio. </member> <member name="color" type="Color" setter="set_color" getter="get_color" default="Color( 1, 1, 1, 1 )"> - Each particle's initial color. If the [Particles2D]'s [code]texture[/code] is defined, it will be multiplied by this color. To have particle display color in a [BaseMaterial3D] make sure to set [member BaseMaterial3D.vertex_color_use_as_albedo] to [code]true[/code]. + Each particle's initial color. If the [GPUParticles2D]'s [code]texture[/code] is defined, it will be multiplied by this color. To have particle display color in a [BaseMaterial3D] make sure to set [member BaseMaterial3D.vertex_color_use_as_albedo] to [code]true[/code]. </member> <member name="color_ramp" type="Texture2D" setter="set_color_ramp" getter="get_color_ramp"> Each particle's color will vary along this [GradientTexture]. diff --git a/doc/classes/Path.xml b/doc/classes/Path3D.xml index 801e86ff9e..b97e7efd5d 100644 --- a/doc/classes/Path.xml +++ b/doc/classes/Path3D.xml @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Path" inherits="Spatial" version="4.0"> +<class name="Path3D" inherits="Node3D" version="4.0"> <brief_description> - Contains a [Curve3D] path for [PathFollow] nodes to follow. + Contains a [Curve3D] path for [PathFollow3D] nodes to follow. </brief_description> <description> - Can have [PathFollow] child nodes moving along the [Curve3D]. See [PathFollow] for more information on the usage. - Note that the path is considered as relative to the moved nodes (children of [PathFollow]). As such, the curve should usually start with a zero vector [code](0, 0, 0)[/code]. + Can have [PathFollow3D] child nodes moving along the [Curve3D]. See [PathFollow3D] for more information on the usage. + Note that the path is considered as relative to the moved nodes (children of [PathFollow3D]). As such, the curve should usually start with a zero vector [code](0, 0, 0)[/code]. </description> <tutorials> </tutorials> diff --git a/doc/classes/PathFollow.xml b/doc/classes/PathFollow3D.xml index 85ca5b787f..f405bdedfc 100644 --- a/doc/classes/PathFollow.xml +++ b/doc/classes/PathFollow3D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PathFollow" inherits="Spatial" version="4.0"> +<class name="PathFollow3D" inherits="Node3D" version="4.0"> <brief_description> - Point sampler for a [Path]. + Point sampler for a [Path3D]. </brief_description> <description> - This node takes its parent [Path], and returns the coordinates of a point within it, given a distance from the first vertex. + This node takes its parent [Path3D], and returns the coordinates of a point within it, given a distance from the first vertex. It is useful for making other nodes follow a path, without coding the movement pattern. For that, the nodes must be children of this node. The descendant nodes will then move accordingly when setting an offset in this node. </description> <tutorials> @@ -14,7 +14,7 @@ <members> <member name="cubic_interp" type="bool" setter="set_cubic_interpolation" getter="get_cubic_interpolation" default="true"> If [code]true[/code], the position between two cached points is interpolated cubically, and linearly otherwise. - The points along the [Curve3D] of the [Path] are precomputed before use, for faster calculations. The point at the requested offset is then calculated interpolating between two adjacent cached points. This may present a problem if the curve makes sharp turns, as the cached points may not follow the curve closely enough. + The points along the [Curve3D] of the [Path3D] are precomputed before use, for faster calculations. The point at the requested offset is then calculated interpolating between two adjacent cached points. This may present a problem if the curve makes sharp turns, as the cached points may not follow the curve closely enough. There are two answers to this problem: either increase the number of cached points and increase memory consumption, or make a cubic interpolation between two points at the cost of (slightly) slower calculations. </member> <member name="h_offset" type="float" setter="set_h_offset" getter="get_h_offset" default="0.0"> @@ -26,7 +26,7 @@ <member name="offset" type="float" setter="set_offset" getter="get_offset" default="0.0"> The distance from the first vertex, measured in 3D units along the path. This sets this node's position to a point within the path. </member> - <member name="rotation_mode" type="int" setter="set_rotation_mode" getter="get_rotation_mode" enum="PathFollow.RotationMode" default="3"> + <member name="rotation_mode" type="int" setter="set_rotation_mode" getter="get_rotation_mode" enum="PathFollow3D.RotationMode" default="3"> Allows or forbids rotation on one or more axes, depending on the [enum RotationMode] constants being used. </member> <member name="unit_offset" type="float" setter="set_unit_offset" getter="get_unit_offset" default="0.0"> @@ -38,19 +38,19 @@ </members> <constants> <constant name="ROTATION_NONE" value="0" enum="RotationMode"> - Forbids the PathFollow to rotate. + Forbids the PathFollow3D to rotate. </constant> <constant name="ROTATION_Y" value="1" enum="RotationMode"> - Allows the PathFollow to rotate in the Y axis only. + Allows the PathFollow3D to rotate in the Y axis only. </constant> <constant name="ROTATION_XY" value="2" enum="RotationMode"> - Allows the PathFollow to rotate in both the X, and Y axes. + Allows the PathFollow3D to rotate in both the X, and Y axes. </constant> <constant name="ROTATION_XYZ" value="3" enum="RotationMode"> - Allows the PathFollow to rotate in any axis. + Allows the PathFollow3D to rotate in any axis. </constant> <constant name="ROTATION_ORIENTED" value="4" enum="RotationMode"> - Uses the up vector information in a [Curve3D] to enforce orientation. This rotation mode requires the [Path]'s [member Curve3D.up_vector_enabled] property to be set to [code]true[/code]. + Uses the up vector information in a [Curve3D] to enforce orientation. This rotation mode requires the [Path3D]'s [member Curve3D.up_vector_enabled] property to be set to [code]true[/code]. </constant> </constants> </class> diff --git a/doc/classes/Performance.xml b/doc/classes/Performance.xml index 378b165644..2a0c153267 100644 --- a/doc/classes/Performance.xml +++ b/doc/classes/Performance.xml @@ -95,7 +95,7 @@ Number of islands in the 2D physics engine. </constant> <constant name="PHYSICS_3D_ACTIVE_OBJECTS" value="23" enum="Monitor"> - Number of active [RigidBody] and [VehicleBody] nodes in the game. + Number of active [RigidBody3D] and [VehicleBody3D] nodes in the game. </constant> <constant name="PHYSICS_3D_COLLISION_PAIRS" value="24" enum="Monitor"> Number of collision pairs in the 3D physics engine. diff --git a/doc/classes/PhysicalBone.xml b/doc/classes/PhysicalBone3D.xml index bb31f03c18..d45c72ee87 100644 --- a/doc/classes/PhysicalBone.xml +++ b/doc/classes/PhysicalBone3D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PhysicalBone" inherits="PhysicsBody" version="4.0"> +<class name="PhysicalBone3D" inherits="PhysicsBody3D" version="4.0"> <brief_description> </brief_description> <description> @@ -55,7 +55,7 @@ </member> <member name="joint_offset" type="Transform" setter="set_joint_offset" getter="get_joint_offset" default="Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )"> </member> - <member name="joint_type" type="int" setter="set_joint_type" getter="get_joint_type" enum="PhysicalBone.JointType" default="0"> + <member name="joint_type" type="int" setter="set_joint_type" getter="get_joint_type" enum="PhysicalBone3D.JointType" default="0"> </member> <member name="mass" type="float" setter="set_mass" getter="get_mass" default="1.0"> </member> diff --git a/doc/classes/PhysicalSkyMaterial.xml b/doc/classes/PhysicalSkyMaterial.xml index 705c063257..89b43158dc 100644 --- a/doc/classes/PhysicalSkyMaterial.xml +++ b/doc/classes/PhysicalSkyMaterial.xml @@ -5,7 +5,7 @@ </brief_description> <description> The [PhysicalSkyMaterial] uses the Preetham analytic daylight model to draw a sky based on physical properties. This results in a substantially more realistic sky than the [ProceduralSkyMaterial], but it is slightly slower and less flexible. - The [PhysicalSkyMaterial] only supports one sun. The color, energy, and direction of the sun are taken from the first [DirectionalLight] in the scene tree. + The [PhysicalSkyMaterial] only supports one sun. The color, energy, and direction of the sun are taken from the first [DirectionalLight3D] in the scene tree. As it is based on a daylight model, the sky fades to black as the sunset ends. If you want a full day/night cycle, you will have to add a night sky by converting this to a [ShaderMaterial] and adding a night sky directly into the resulting shader. </description> <tutorials> diff --git a/doc/classes/Physics2DDirectBodyStateSW.xml b/doc/classes/Physics2DDirectBodyStateSW.xml deleted file mode 100644 index 11f1140ca8..0000000000 --- a/doc/classes/Physics2DDirectBodyStateSW.xml +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<class name="Physics2DDirectBodyStateSW" inherits="Physics2DDirectBodyState" version="4.0"> - <brief_description> - Software implementation of [Physics2DDirectBodyState]. - </brief_description> - <description> - Software implementation of [Physics2DDirectBodyState]. This object exposes no new methods or properties and should not be used, as [Physics2DDirectBodyState] selects the best implementation available. - </description> - <tutorials> - </tutorials> - <methods> - </methods> - <constants> - </constants> -</class> diff --git a/doc/classes/PhysicsBody.xml b/doc/classes/PhysicsBody3D.xml index c0927a5b53..f0ba2a7f5f 100644 --- a/doc/classes/PhysicsBody.xml +++ b/doc/classes/PhysicsBody3D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PhysicsBody" inherits="CollisionObject" version="4.0"> +<class name="PhysicsBody3D" inherits="CollisionObject3D" version="4.0"> <brief_description> Base class for all objects affected by physics in 3D space. </brief_description> <description> - PhysicsBody is an abstract base class for implementing a physics body. All *Body types inherit from it. + PhysicsBody3D is an abstract base class for implementing a physics body. All *Body types inherit from it. </description> <tutorials> <link>https://docs.godotengine.org/en/latest/tutorials/physics/physics_introduction.html</link> diff --git a/doc/classes/Physics2DDirectBodyState.xml b/doc/classes/PhysicsDirectBodyState2D.xml index d9d402ac9a..46205fecd1 100644 --- a/doc/classes/Physics2DDirectBodyState.xml +++ b/doc/classes/PhysicsDirectBodyState2D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Physics2DDirectBodyState" inherits="Object" version="4.0"> +<class name="PhysicsDirectBodyState2D" inherits="Object" version="4.0"> <brief_description> - Direct access object to a physics body in the [Physics2DServer]. + Direct access object to a physics body in the [PhysicsServer2D]. </brief_description> <description> - Provides direct access to a physics body in the [Physics2DServer], allowing safe changes to physics properties. This object is passed via the direct state callback of rigid/character bodies, and is intended for changing the direct state of that body. See [method RigidBody2D._integrate_forces]. + Provides direct access to a physics body in the [PhysicsServer2D], allowing safe changes to physics properties. This object is passed via the direct state callback of rigid/character bodies, and is intended for changing the direct state of that body. See [method RigidBody2D._integrate_forces]. </description> <tutorials> <link>https://docs.godotengine.org/en/latest/tutorials/physics/ray-casting.html</link> @@ -119,7 +119,7 @@ <argument index="0" name="contact_idx" type="int"> </argument> <description> - Returns the collided shape's metadata. This metadata is different from [method Object.get_meta], and is set with [method Physics2DServer.shape_set_data]. + Returns the collided shape's metadata. This metadata is different from [method Object.get_meta], and is set with [method PhysicsServer2D.shape_set_data]. </description> </method> <method name="get_contact_collider_velocity_at_position" qualifiers="const"> @@ -167,7 +167,7 @@ </description> </method> <method name="get_space_state"> - <return type="Physics2DDirectSpaceState"> + <return type="PhysicsDirectSpaceState2D"> </return> <description> Returns the current state of the space, useful for queries. diff --git a/doc/classes/PhysicsDirectBodyState2DSW.xml b/doc/classes/PhysicsDirectBodyState2DSW.xml new file mode 100644 index 0000000000..94fc4213b7 --- /dev/null +++ b/doc/classes/PhysicsDirectBodyState2DSW.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="PhysicsDirectBodyState2DSW" inherits="PhysicsDirectBodyState2D" version="4.0"> + <brief_description> + Software implementation of [PhysicsDirectBodyState2D]. + </brief_description> + <description> + Software implementation of [PhysicsDirectBodyState2D]. This object exposes no new methods or properties and should not be used, as [PhysicsDirectBodyState2D] selects the best implementation available. + </description> + <tutorials> + </tutorials> + <methods> + </methods> + <constants> + </constants> +</class> diff --git a/doc/classes/PhysicsDirectBodyState.xml b/doc/classes/PhysicsDirectBodyState3D.xml index 24cf4961be..1ee520fe5f 100644 --- a/doc/classes/PhysicsDirectBodyState.xml +++ b/doc/classes/PhysicsDirectBodyState3D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PhysicsDirectBodyState" inherits="Object" version="4.0"> +<class name="PhysicsDirectBodyState3D" inherits="Object" version="4.0"> <brief_description> - Direct access object to a physics body in the [PhysicsServer]. + Direct access object to a physics body in the [PhysicsServer3D]. </brief_description> <description> - Provides direct access to a physics body in the [PhysicsServer], allowing safe changes to physics properties. This object is passed via the direct state callback of rigid/character bodies, and is intended for changing the direct state of that body. See [method RigidBody._integrate_forces]. + Provides direct access to a physics body in the [PhysicsServer3D], allowing safe changes to physics properties. This object is passed via the direct state callback of rigid/character bodies, and is intended for changing the direct state of that body. See [method RigidBody3D._integrate_forces]. </description> <tutorials> </tutorials> @@ -128,7 +128,7 @@ </return> <description> Returns the number of contacts this body has with other bodies. - [b]Note:[/b] By default, this returns 0 unless bodies are configured to monitor contacts. See [member RigidBody.contact_monitor]. + [b]Note:[/b] By default, this returns 0 unless bodies are configured to monitor contacts. See [member RigidBody3D.contact_monitor]. </description> </method> <method name="get_contact_impulse" qualifiers="const"> @@ -168,7 +168,7 @@ </description> </method> <method name="get_space_state"> - <return type="PhysicsDirectSpaceState"> + <return type="PhysicsDirectSpaceState3D"> </return> <description> Returns the current state of the space, useful for queries. diff --git a/doc/classes/Physics2DDirectSpaceState.xml b/doc/classes/PhysicsDirectSpaceState2D.xml index 662a823d84..d85d7794dd 100644 --- a/doc/classes/Physics2DDirectSpaceState.xml +++ b/doc/classes/PhysicsDirectSpaceState2D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Physics2DDirectSpaceState" inherits="Object" version="4.0"> +<class name="PhysicsDirectSpaceState2D" inherits="Object" version="4.0"> <brief_description> - Direct access object to a space in the [Physics2DServer]. + Direct access object to a space in the [PhysicsServer2D]. </brief_description> <description> - Direct access object to a space in the [Physics2DServer]. It's used mainly to do queries against objects and areas residing in a given space. + Direct access object to a space in the [PhysicsServer2D]. It's used mainly to do queries against objects and areas residing in a given space. </description> <tutorials> <link>https://docs.godotengine.org/en/latest/tutorials/physics/ray-casting.html</link> @@ -13,35 +13,35 @@ <method name="cast_motion"> <return type="Array"> </return> - <argument index="0" name="shape" type="Physics2DShapeQueryParameters"> + <argument index="0" name="shape" type="PhysicsShapeQueryParameters2D"> </argument> <description> Checks how far the shape can travel toward a point. If the shape can not move, the array will be empty. - [b]Note:[/b] Both the shape and the motion are supplied through a [Physics2DShapeQueryParameters] object. The method will return an array with two floats between 0 and 1, both representing a fraction of [code]motion[/code]. The first is how far the shape can move without triggering a collision, and the second is the point at which a collision will occur. If no collision is detected, the returned array will be [code][1, 1][/code]. + [b]Note:[/b] Both the shape and the motion are supplied through a [PhysicsShapeQueryParameters2D] object. The method will return an array with two floats between 0 and 1, both representing a fraction of [code]motion[/code]. The first is how far the shape can move without triggering a collision, and the second is the point at which a collision will occur. If no collision is detected, the returned array will be [code][1, 1][/code]. </description> </method> <method name="collide_shape"> <return type="Array"> </return> - <argument index="0" name="shape" type="Physics2DShapeQueryParameters"> + <argument index="0" name="shape" type="PhysicsShapeQueryParameters2D"> </argument> <argument index="1" name="max_results" type="int" default="32"> </argument> <description> - Checks the intersections of a shape, given through a [Physics2DShapeQueryParameters] object, against the space. The resulting array contains a list of points where the shape intersects another. Like with [method intersect_shape], the number of returned results can be limited to save processing time. + Checks the intersections of a shape, given through a [PhysicsShapeQueryParameters2D] object, against the space. The resulting array contains a list of points where the shape intersects another. Like with [method intersect_shape], the number of returned results can be limited to save processing time. </description> </method> <method name="get_rest_info"> <return type="Dictionary"> </return> - <argument index="0" name="shape" type="Physics2DShapeQueryParameters"> + <argument index="0" name="shape" type="PhysicsShapeQueryParameters2D"> </argument> <description> - Checks the intersections of a shape, given through a [Physics2DShapeQueryParameters] object, against the space. If it collides with more than one shape, the nearest one is selected. If the shape did not intersect anything, then an empty dictionary is returned instead. + Checks the intersections of a shape, given through a [PhysicsShapeQueryParameters2D] object, against the space. If it collides with more than one shape, the nearest one is selected. If the shape did not intersect anything, then an empty dictionary is returned instead. [b]Note:[/b] This method does not take into account the [code]motion[/code] property of the object. The returned object is a dictionary containing the following fields: [code]collider_id[/code]: The colliding object's ID. [code]linear_velocity[/code]: The colliding object's velocity [Vector2]. If the object is an [Area2D], the result is [code](0, 0)[/code]. - [code]metadata[/code]: The intersecting shape's metadata. This metadata is different from [method Object.get_meta], and is set with [method Physics2DServer.shape_set_data]. + [code]metadata[/code]: The intersecting shape's metadata. This metadata is different from [method Object.get_meta], and is set with [method PhysicsServer2D.shape_set_data]. [code]normal[/code]: The object's surface normal at the intersection point. [code]point[/code]: The intersection point. [code]rid[/code]: The intersecting object's [RID]. @@ -67,10 +67,10 @@ Checks whether a point is inside any shape. The shapes the point is inside of are returned in an array containing dictionaries with the following fields: [code]collider[/code]: The colliding object. [code]collider_id[/code]: The colliding object's ID. - [code]metadata[/code]: The intersecting shape's metadata. This metadata is different from [method Object.get_meta], and is set with [method Physics2DServer.shape_set_data]. + [code]metadata[/code]: The intersecting shape's metadata. This metadata is different from [method Object.get_meta], and is set with [method PhysicsServer2D.shape_set_data]. [code]rid[/code]: The intersecting object's [RID]. [code]shape[/code]: The shape index of the colliding shape. - Additionally, the method can take an [code]exclude[/code] array of objects or [RID]s that are to be excluded from collisions, a [code]collision_mask[/code] bitmask representing the physics layers to check in, or booleans to determine if the ray should collide with [PhysicsBody]s or [Area]s, respectively. + Additionally, the method can take an [code]exclude[/code] array of objects or [RID]s that are to be excluded from collisions, a [code]collision_mask[/code] bitmask representing the physics layers to check in, or booleans to determine if the ray should collide with [PhysicsBody2D]s or [Area2D]s, respectively. </description> </method> <method name="intersect_point_on_canvas"> @@ -112,28 +112,28 @@ Intersects a ray in a given space. The returned object is a dictionary with the following fields: [code]collider[/code]: The colliding object. [code]collider_id[/code]: The colliding object's ID. - [code]metadata[/code]: The intersecting shape's metadata. This metadata is different from [method Object.get_meta], and is set with [method Physics2DServer.shape_set_data]. + [code]metadata[/code]: The intersecting shape's metadata. This metadata is different from [method Object.get_meta], and is set with [method PhysicsServer2D.shape_set_data]. [code]normal[/code]: The object's surface normal at the intersection point. [code]position[/code]: The intersection point. [code]rid[/code]: The intersecting object's [RID]. [code]shape[/code]: The shape index of the colliding shape. If the ray did not intersect anything, then an empty dictionary is returned instead. - Additionally, the method can take an [code]exclude[/code] array of objects or [RID]s that are to be excluded from collisions, a [code]collision_mask[/code] bitmask representing the physics layers to check in, or booleans to determine if the ray should collide with [PhysicsBody]s or [Area]s, respectively. + Additionally, the method can take an [code]exclude[/code] array of objects or [RID]s that are to be excluded from collisions, a [code]collision_mask[/code] bitmask representing the physics layers to check in, or booleans to determine if the ray should collide with [PhysicsBody2D]s or [Area2D]s, respectively. </description> </method> <method name="intersect_shape"> <return type="Array"> </return> - <argument index="0" name="shape" type="Physics2DShapeQueryParameters"> + <argument index="0" name="shape" type="PhysicsShapeQueryParameters2D"> </argument> <argument index="1" name="max_results" type="int" default="32"> </argument> <description> - Checks the intersections of a shape, given through a [Physics2DShapeQueryParameters] object, against the space. + Checks the intersections of a shape, given through a [PhysicsShapeQueryParameters2D] object, against the space. [b]Note:[/b] This method does not take into account the [code]motion[/code] property of the object. The intersected shapes are returned in an array containing dictionaries with the following fields: [code]collider[/code]: The colliding object. [code]collider_id[/code]: The colliding object's ID. - [code]metadata[/code]: The intersecting shape's metadata. This metadata is different from [method Object.get_meta], and is set with [method Physics2DServer.shape_set_data]. + [code]metadata[/code]: The intersecting shape's metadata. This metadata is different from [method Object.get_meta], and is set with [method PhysicsServer2D.shape_set_data]. [code]rid[/code]: The intersecting object's [RID]. [code]shape[/code]: The shape index of the colliding shape. The number of intersections can be limited with the [code]max_results[/code] parameter, to reduce the processing time. diff --git a/doc/classes/PhysicsDirectSpaceState.xml b/doc/classes/PhysicsDirectSpaceState3D.xml index a6172805e9..09ee93732d 100644 --- a/doc/classes/PhysicsDirectSpaceState.xml +++ b/doc/classes/PhysicsDirectSpaceState3D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PhysicsDirectSpaceState" inherits="Object" version="4.0"> +<class name="PhysicsDirectSpaceState3D" inherits="Object" version="4.0"> <brief_description> - Direct access object to a space in the [PhysicsServer]. + Direct access object to a space in the [PhysicsServer3D]. </brief_description> <description> - Direct access object to a space in the [PhysicsServer]. It's used mainly to do queries against objects and areas residing in a given space. + Direct access object to a space in the [PhysicsServer3D]. It's used mainly to do queries against objects and areas residing in a given space. </description> <tutorials> <link>https://docs.godotengine.org/en/latest/tutorials/physics/ray-casting.html</link> @@ -13,7 +13,7 @@ <method name="cast_motion"> <return type="Array"> </return> - <argument index="0" name="shape" type="PhysicsShapeQueryParameters"> + <argument index="0" name="shape" type="PhysicsShapeQueryParameters3D"> </argument> <argument index="1" name="motion" type="Vector3"> </argument> @@ -25,23 +25,23 @@ <method name="collide_shape"> <return type="Array"> </return> - <argument index="0" name="shape" type="PhysicsShapeQueryParameters"> + <argument index="0" name="shape" type="PhysicsShapeQueryParameters3D"> </argument> <argument index="1" name="max_results" type="int" default="32"> </argument> <description> - Checks the intersections of a shape, given through a [PhysicsShapeQueryParameters] object, against the space. The resulting array contains a list of points where the shape intersects another. Like with [method intersect_shape], the number of returned results can be limited to save processing time. + Checks the intersections of a shape, given through a [PhysicsShapeQueryParameters3D] object, against the space. The resulting array contains a list of points where the shape intersects another. Like with [method intersect_shape], the number of returned results can be limited to save processing time. </description> </method> <method name="get_rest_info"> <return type="Dictionary"> </return> - <argument index="0" name="shape" type="PhysicsShapeQueryParameters"> + <argument index="0" name="shape" type="PhysicsShapeQueryParameters3D"> </argument> <description> - Checks the intersections of a shape, given through a [PhysicsShapeQueryParameters] object, against the space. If it collides with more than one shape, the nearest one is selected. The returned object is a dictionary containing the following fields: + Checks the intersections of a shape, given through a [PhysicsShapeQueryParameters3D] object, against the space. If it collides with more than one shape, the nearest one is selected. The returned object is a dictionary containing the following fields: [code]collider_id[/code]: The colliding object's ID. - [code]linear_velocity[/code]: The colliding object's velocity [Vector3]. If the object is an [Area], the result is [code](0, 0, 0)[/code]. + [code]linear_velocity[/code]: The colliding object's velocity [Vector3]. If the object is an [Area3D], the result is [code](0, 0, 0)[/code]. [code]normal[/code]: The object's surface normal at the intersection point. [code]point[/code]: The intersection point. [code]rid[/code]: The intersecting object's [RID]. @@ -73,18 +73,18 @@ [code]rid[/code]: The intersecting object's [RID]. [code]shape[/code]: The shape index of the colliding shape. If the ray did not intersect anything, then an empty dictionary is returned instead. - Additionally, the method can take an [code]exclude[/code] array of objects or [RID]s that are to be excluded from collisions, a [code]collision_mask[/code] bitmask representing the physics layers to check in, or booleans to determine if the ray should collide with [PhysicsBody]s or [Area]s, respectively. + Additionally, the method can take an [code]exclude[/code] array of objects or [RID]s that are to be excluded from collisions, a [code]collision_mask[/code] bitmask representing the physics layers to check in, or booleans to determine if the ray should collide with [PhysicsBody3D]s or [Area3D]s, respectively. </description> </method> <method name="intersect_shape"> <return type="Array"> </return> - <argument index="0" name="shape" type="PhysicsShapeQueryParameters"> + <argument index="0" name="shape" type="PhysicsShapeQueryParameters3D"> </argument> <argument index="1" name="max_results" type="int" default="32"> </argument> <description> - Checks the intersections of a shape, given through a [PhysicsShapeQueryParameters] object, against the space. The intersected shapes are returned in an array containing dictionaries with the following fields: + Checks the intersections of a shape, given through a [PhysicsShapeQueryParameters3D] object, against the space. The intersected shapes are returned in an array containing dictionaries with the following fields: [code]collider[/code]: The colliding object. [code]collider_id[/code]: The colliding object's ID. [code]rid[/code]: The intersecting object's [RID]. diff --git a/doc/classes/PhysicsMaterial.xml b/doc/classes/PhysicsMaterial.xml index 84e7f2b275..6410626496 100644 --- a/doc/classes/PhysicsMaterial.xml +++ b/doc/classes/PhysicsMaterial.xml @@ -4,7 +4,7 @@ A material for physics properties. </brief_description> <description> - Provides a means of modifying the collision properties of a [PhysicsBody]. + Provides a means of modifying the collision properties of a [PhysicsBody3D]. </description> <tutorials> </tutorials> diff --git a/doc/classes/Physics2DServer.xml b/doc/classes/PhysicsServer2D.xml index 45215253be..9da739e57a 100644 --- a/doc/classes/Physics2DServer.xml +++ b/doc/classes/PhysicsServer2D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Physics2DServer" inherits="Object" version="4.0"> +<class name="PhysicsServer2D" inherits="Object" version="4.0"> <brief_description> Server interface for low-level 2D physics access. </brief_description> <description> - Physics2DServer is the server responsible for all 2D physics. It can create many kinds of physics objects, but does not insert them on the node tree. + PhysicsServer2D is the server responsible for all 2D physics. It can create many kinds of physics objects, but does not insert them on the node tree. </description> <tutorials> </tutorials> @@ -83,7 +83,7 @@ </return> <argument index="0" name="area" type="RID"> </argument> - <argument index="1" name="param" type="int" enum="Physics2DServer.AreaParameter"> + <argument index="1" name="param" type="int" enum="PhysicsServer2D.AreaParameter"> </argument> <description> Returns an area parameter value. See [enum AreaParameter] for a list of available parameters. @@ -130,7 +130,7 @@ </description> </method> <method name="area_get_space_override_mode" qualifiers="const"> - <return type="int" enum="Physics2DServer.AreaSpaceOverrideMode"> + <return type="int" enum="PhysicsServer2D.AreaSpaceOverrideMode"> </return> <argument index="0" name="area" type="RID"> </argument> @@ -225,7 +225,7 @@ </return> <argument index="0" name="area" type="RID"> </argument> - <argument index="1" name="param" type="int" enum="Physics2DServer.AreaParameter"> + <argument index="1" name="param" type="int" enum="PhysicsServer2D.AreaParameter"> </argument> <argument index="2" name="value" type="Variant"> </argument> @@ -288,7 +288,7 @@ </return> <argument index="0" name="area" type="RID"> </argument> - <argument index="1" name="mode" type="int" enum="Physics2DServer.AreaSpaceOverrideMode"> + <argument index="1" name="mode" type="int" enum="PhysicsServer2D.AreaSpaceOverrideMode"> </argument> <description> Sets the space override mode for the area. See [enum AreaSpaceOverrideMode] for a list of available modes. @@ -461,7 +461,7 @@ </description> </method> <method name="body_get_continuous_collision_detection_mode" qualifiers="const"> - <return type="int" enum="Physics2DServer.CCDMode"> + <return type="int" enum="PhysicsServer2D.CCDMode"> </return> <argument index="0" name="body" type="RID"> </argument> @@ -470,12 +470,12 @@ </description> </method> <method name="body_get_direct_state"> - <return type="Physics2DDirectBodyState"> + <return type="PhysicsDirectBodyState2D"> </return> <argument index="0" name="body" type="RID"> </argument> <description> - Returns the [Physics2DDirectBodyState] of the body. + Returns the [PhysicsDirectBodyState2D] of the body. </description> </method> <method name="body_get_max_contacts_reported" qualifiers="const"> @@ -488,7 +488,7 @@ </description> </method> <method name="body_get_mode" qualifiers="const"> - <return type="int" enum="Physics2DServer.BodyMode"> + <return type="int" enum="PhysicsServer2D.BodyMode"> </return> <argument index="0" name="body" type="RID"> </argument> @@ -510,7 +510,7 @@ </return> <argument index="0" name="body" type="RID"> </argument> - <argument index="1" name="param" type="int" enum="Physics2DServer.BodyParameter"> + <argument index="1" name="param" type="int" enum="PhysicsServer2D.BodyParameter"> </argument> <description> Returns the value of a body parameter. See [enum BodyParameter] for a list of available parameters. @@ -572,7 +572,7 @@ </return> <argument index="0" name="body" type="RID"> </argument> - <argument index="1" name="state" type="int" enum="Physics2DServer.BodyState"> + <argument index="1" name="state" type="int" enum="PhysicsServer2D.BodyState"> </argument> <description> Returns a body state. @@ -647,7 +647,7 @@ </return> <argument index="0" name="body" type="RID"> </argument> - <argument index="1" name="mode" type="int" enum="Physics2DServer.CCDMode"> + <argument index="1" name="mode" type="int" enum="PhysicsServer2D.CCDMode"> </argument> <description> Sets the continuous collision detection mode using one of the [enum CCDMode] constants. @@ -685,7 +685,7 @@ </return> <argument index="0" name="body" type="RID"> </argument> - <argument index="1" name="mode" type="int" enum="Physics2DServer.BodyMode"> + <argument index="1" name="mode" type="int" enum="PhysicsServer2D.BodyMode"> </argument> <description> Sets the body mode using one of the [enum BodyMode] constants. @@ -707,7 +707,7 @@ </return> <argument index="0" name="body" type="RID"> </argument> - <argument index="1" name="param" type="int" enum="Physics2DServer.BodyParameter"> + <argument index="1" name="param" type="int" enum="PhysicsServer2D.BodyParameter"> </argument> <argument index="2" name="value" type="float"> </argument> @@ -798,7 +798,7 @@ </return> <argument index="0" name="body" type="RID"> </argument> - <argument index="1" name="state" type="int" enum="Physics2DServer.BodyState"> + <argument index="1" name="state" type="int" enum="PhysicsServer2D.BodyState"> </argument> <argument index="2" name="value" type="Variant"> </argument> @@ -819,10 +819,10 @@ </argument> <argument index="4" name="margin" type="float" default="0.08"> </argument> - <argument index="5" name="result" type="Physics2DTestMotionResult" default="null"> + <argument index="5" name="result" type="PhysicsTestMotionResult2D" default="null"> </argument> <description> - Returns [code]true[/code] if a collision would result from moving in the given direction from a given point in space. Margin increases the size of the shapes involved in the collision detection. [Physics2DTestMotionResult] can be passed to return additional information in. + Returns [code]true[/code] if a collision would result from moving in the given direction from a given point in space. Margin increases the size of the shapes involved in the collision detection. [PhysicsTestMotionResult2D] can be passed to return additional information in. </description> </method> <method name="capsule_shape_create"> @@ -869,7 +869,7 @@ </return> <argument index="0" name="joint" type="RID"> </argument> - <argument index="1" name="param" type="int" enum="Physics2DServer.DampedStringParam"> + <argument index="1" name="param" type="int" enum="PhysicsServer2D.DampedStringParam"> </argument> <description> Returns the value of a damped spring joint parameter. @@ -880,7 +880,7 @@ </return> <argument index="0" name="joint" type="RID"> </argument> - <argument index="1" name="param" type="int" enum="Physics2DServer.DampedStringParam"> + <argument index="1" name="param" type="int" enum="PhysicsServer2D.DampedStringParam"> </argument> <argument index="2" name="value" type="float"> </argument> @@ -894,13 +894,13 @@ <argument index="0" name="rid" type="RID"> </argument> <description> - Destroys any of the objects created by Physics2DServer. If the [RID] passed is not one of the objects that can be created by Physics2DServer, an error will be sent to the console. + Destroys any of the objects created by PhysicsServer2D. If the [RID] passed is not one of the objects that can be created by PhysicsServer2D, an error will be sent to the console. </description> </method> <method name="get_process_info"> <return type="int"> </return> - <argument index="0" name="process_info" type="int" enum="Physics2DServer.ProcessInfo"> + <argument index="0" name="process_info" type="int" enum="PhysicsServer2D.ProcessInfo"> </argument> <description> Returns information about the current state of the 2D physics engine. See [enum ProcessInfo] for a list of available states. @@ -928,14 +928,14 @@ </return> <argument index="0" name="joint" type="RID"> </argument> - <argument index="1" name="param" type="int" enum="Physics2DServer.JointParam"> + <argument index="1" name="param" type="int" enum="PhysicsServer2D.JointParam"> </argument> <description> Returns the value of a joint parameter. </description> </method> <method name="joint_get_type" qualifiers="const"> - <return type="int" enum="Physics2DServer.JointType"> + <return type="int" enum="PhysicsServer2D.JointType"> </return> <argument index="0" name="joint" type="RID"> </argument> @@ -948,7 +948,7 @@ </return> <argument index="0" name="joint" type="RID"> </argument> - <argument index="1" name="param" type="int" enum="Physics2DServer.JointParam"> + <argument index="1" name="param" type="int" enum="PhysicsServer2D.JointParam"> </argument> <argument index="2" name="value" type="float"> </argument> @@ -1012,7 +1012,7 @@ </description> </method> <method name="shape_get_type" qualifiers="const"> - <return type="int" enum="Physics2DServer.ShapeType"> + <return type="int" enum="PhysicsServer2D.ShapeType"> </return> <argument index="0" name="shape" type="RID"> </argument> @@ -1039,12 +1039,12 @@ </description> </method> <method name="space_get_direct_state"> - <return type="Physics2DDirectSpaceState"> + <return type="PhysicsDirectSpaceState2D"> </return> <argument index="0" name="space" type="RID"> </argument> <description> - Returns the state of a space, a [Physics2DDirectSpaceState]. This object can be used to make collision/intersection queries. + Returns the state of a space, a [PhysicsDirectSpaceState2D]. This object can be used to make collision/intersection queries. </description> </method> <method name="space_get_param" qualifiers="const"> @@ -1052,7 +1052,7 @@ </return> <argument index="0" name="space" type="RID"> </argument> - <argument index="1" name="param" type="int" enum="Physics2DServer.SpaceParameter"> + <argument index="1" name="param" type="int" enum="PhysicsServer2D.SpaceParameter"> </argument> <description> Returns the value of a space parameter. @@ -1083,7 +1083,7 @@ </return> <argument index="0" name="space" type="RID"> </argument> - <argument index="1" name="param" type="int" enum="Physics2DServer.SpaceParameter"> + <argument index="1" name="param" type="int" enum="PhysicsServer2D.SpaceParameter"> </argument> <argument index="2" name="value" type="float"> </argument> diff --git a/doc/classes/Physics2DServerSW.xml b/doc/classes/PhysicsServer2DSW.xml index 1e4531ed66..dac5e360f0 100644 --- a/doc/classes/Physics2DServerSW.xml +++ b/doc/classes/PhysicsServer2DSW.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Physics2DServerSW" inherits="Physics2DServer" version="4.0"> +<class name="PhysicsServer2DSW" inherits="PhysicsServer2D" version="4.0"> <brief_description> - Software implementation of [Physics2DServer]. + Software implementation of [PhysicsServer2D]. </brief_description> <description> - This class exposes no new methods or properties and should not be used, as [Physics2DServer] automatically selects the best implementation available. + This class exposes no new methods or properties and should not be used, as [PhysicsServer2D] automatically selects the best implementation available. </description> <tutorials> </tutorials> diff --git a/doc/classes/PhysicsServer.xml b/doc/classes/PhysicsServer3D.xml index 1b9ce80a1b..e9e1552c92 100644 --- a/doc/classes/PhysicsServer.xml +++ b/doc/classes/PhysicsServer3D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PhysicsServer" inherits="Object" version="4.0"> +<class name="PhysicsServer3D" inherits="Object" version="4.0"> <brief_description> Server interface for low-level physics access. </brief_description> <description> - PhysicsServer is the server responsible for all 3D physics. It can create many kinds of physics objects, but does not insert them on the node tree. + PhysicsServer3D is the server responsible for all 3D physics. It can create many kinds of physics objects, but does not insert them on the node tree. </description> <tutorials> </tutorials> @@ -48,7 +48,7 @@ <return type="RID"> </return> <description> - Creates an [Area]. + Creates an [Area3D]. </description> </method> <method name="area_get_object_instance_id" qualifiers="const"> @@ -65,7 +65,7 @@ </return> <argument index="0" name="area" type="RID"> </argument> - <argument index="1" name="param" type="int" enum="PhysicsServer.AreaParameter"> + <argument index="1" name="param" type="int" enum="PhysicsServer3D.AreaParameter"> </argument> <description> Returns an area parameter value. A list of available parameters is on the [enum AreaParameter] constants. @@ -112,7 +112,7 @@ </description> </method> <method name="area_get_space_override_mode" qualifiers="const"> - <return type="int" enum="PhysicsServer.AreaSpaceOverrideMode"> + <return type="int" enum="PhysicsServer3D.AreaSpaceOverrideMode"> </return> <argument index="0" name="area" type="RID"> </argument> @@ -216,7 +216,7 @@ </return> <argument index="0" name="area" type="RID"> </argument> - <argument index="1" name="param" type="int" enum="PhysicsServer.AreaParameter"> + <argument index="1" name="param" type="int" enum="PhysicsServer3D.AreaParameter"> </argument> <argument index="2" name="value" type="Variant"> </argument> @@ -289,7 +289,7 @@ </return> <argument index="0" name="area" type="RID"> </argument> - <argument index="1" name="mode" type="int" enum="PhysicsServer.AreaSpaceOverrideMode"> + <argument index="1" name="mode" type="int" enum="PhysicsServer3D.AreaSpaceOverrideMode"> </argument> <description> Sets the space override mode for the area. The modes are described in the [enum AreaSpaceOverrideMode] constants. @@ -421,7 +421,7 @@ <method name="body_create"> <return type="RID"> </return> - <argument index="0" name="mode" type="int" enum="PhysicsServer.BodyMode" default="2"> + <argument index="0" name="mode" type="int" enum="PhysicsServer3D.BodyMode" default="2"> </argument> <argument index="1" name="init_sleeping" type="bool" default="false"> </argument> @@ -449,12 +449,12 @@ </description> </method> <method name="body_get_direct_state"> - <return type="PhysicsDirectBodyState"> + <return type="PhysicsDirectBodyState3D"> </return> <argument index="0" name="body" type="RID"> </argument> <description> - Returns the [PhysicsDirectBodyState] of the body. + Returns the [PhysicsDirectBodyState3D] of the body. </description> </method> <method name="body_get_kinematic_safe_margin" qualifiers="const"> @@ -475,7 +475,7 @@ </description> </method> <method name="body_get_mode" qualifiers="const"> - <return type="int" enum="PhysicsServer.BodyMode"> + <return type="int" enum="PhysicsServer3D.BodyMode"> </return> <argument index="0" name="body" type="RID"> </argument> @@ -497,7 +497,7 @@ </return> <argument index="0" name="body" type="RID"> </argument> - <argument index="1" name="param" type="int" enum="PhysicsServer.BodyParameter"> + <argument index="1" name="param" type="int" enum="PhysicsServer3D.BodyParameter"> </argument> <description> Returns the value of a body parameter. A list of available parameters is on the [enum BodyParameter] constants. @@ -548,7 +548,7 @@ </return> <argument index="0" name="body" type="RID"> </argument> - <argument index="1" name="state" type="int" enum="PhysicsServer.BodyState"> + <argument index="1" name="state" type="int" enum="PhysicsServer3D.BodyState"> </argument> <description> Returns a body state. @@ -559,7 +559,7 @@ </return> <argument index="0" name="body" type="RID"> </argument> - <argument index="1" name="axis" type="int" enum="PhysicsServer.BodyAxis"> + <argument index="1" name="axis" type="int" enum="PhysicsServer3D.BodyAxis"> </argument> <description> </description> @@ -619,7 +619,7 @@ </return> <argument index="0" name="body" type="RID"> </argument> - <argument index="1" name="axis" type="int" enum="PhysicsServer.BodyAxis"> + <argument index="1" name="axis" type="int" enum="PhysicsServer3D.BodyAxis"> </argument> <argument index="2" name="lock" type="bool"> </argument> @@ -712,7 +712,7 @@ </return> <argument index="0" name="body" type="RID"> </argument> - <argument index="1" name="mode" type="int" enum="PhysicsServer.BodyMode"> + <argument index="1" name="mode" type="int" enum="PhysicsServer3D.BodyMode"> </argument> <description> Sets the body mode, from one of the [enum BodyMode] constants. @@ -734,7 +734,7 @@ </return> <argument index="0" name="body" type="RID"> </argument> - <argument index="1" name="param" type="int" enum="PhysicsServer.BodyParameter"> + <argument index="1" name="param" type="int" enum="PhysicsServer3D.BodyParameter"> </argument> <argument index="2" name="value" type="float"> </argument> @@ -807,7 +807,7 @@ </return> <argument index="0" name="body" type="RID"> </argument> - <argument index="1" name="state" type="int" enum="PhysicsServer.BodyState"> + <argument index="1" name="state" type="int" enum="PhysicsServer3D.BodyState"> </argument> <argument index="2" name="value" type="Variant"> </argument> @@ -820,7 +820,7 @@ </return> <argument index="0" name="joint" type="RID"> </argument> - <argument index="1" name="param" type="int" enum="PhysicsServer.ConeTwistJointParam"> + <argument index="1" name="param" type="int" enum="PhysicsServer3D.ConeTwistJointParam"> </argument> <description> Gets a cone_twist_joint parameter (see [enum ConeTwistJointParam] constants). @@ -831,7 +831,7 @@ </return> <argument index="0" name="joint" type="RID"> </argument> - <argument index="1" name="param" type="int" enum="PhysicsServer.ConeTwistJointParam"> + <argument index="1" name="param" type="int" enum="PhysicsServer3D.ConeTwistJointParam"> </argument> <argument index="2" name="value" type="float"> </argument> @@ -845,7 +845,7 @@ <argument index="0" name="rid" type="RID"> </argument> <description> - Destroys any of the objects created by PhysicsServer. If the [RID] passed is not one of the objects that can be created by PhysicsServer, an error will be sent to the console. + Destroys any of the objects created by PhysicsServer3D. If the [RID] passed is not one of the objects that can be created by PhysicsServer3D, an error will be sent to the console. </description> </method> <method name="generic_6dof_joint_get_flag"> @@ -855,7 +855,7 @@ </argument> <argument index="1" name="axis" type="int" enum="Vector3.Axis"> </argument> - <argument index="2" name="flag" type="int" enum="PhysicsServer.G6DOFJointAxisFlag"> + <argument index="2" name="flag" type="int" enum="PhysicsServer3D.G6DOFJointAxisFlag"> </argument> <description> Gets a generic_6_DOF_joint flag (see [enum G6DOFJointAxisFlag] constants). @@ -868,7 +868,7 @@ </argument> <argument index="1" name="axis" type="int" enum="Vector3.Axis"> </argument> - <argument index="2" name="param" type="int" enum="PhysicsServer.G6DOFJointAxisParam"> + <argument index="2" name="param" type="int" enum="PhysicsServer3D.G6DOFJointAxisParam"> </argument> <description> Gets a generic_6_DOF_joint parameter (see [enum G6DOFJointAxisParam] constants). @@ -881,7 +881,7 @@ </argument> <argument index="1" name="axis" type="int" enum="Vector3.Axis"> </argument> - <argument index="2" name="flag" type="int" enum="PhysicsServer.G6DOFJointAxisFlag"> + <argument index="2" name="flag" type="int" enum="PhysicsServer3D.G6DOFJointAxisFlag"> </argument> <argument index="3" name="enable" type="bool"> </argument> @@ -896,7 +896,7 @@ </argument> <argument index="1" name="axis" type="int" enum="Vector3.Axis"> </argument> - <argument index="2" name="param" type="int" enum="PhysicsServer.G6DOFJointAxisParam"> + <argument index="2" name="param" type="int" enum="PhysicsServer3D.G6DOFJointAxisParam"> </argument> <argument index="3" name="value" type="float"> </argument> @@ -907,7 +907,7 @@ <method name="get_process_info"> <return type="int"> </return> - <argument index="0" name="process_info" type="int" enum="PhysicsServer.ProcessInfo"> + <argument index="0" name="process_info" type="int" enum="PhysicsServer3D.ProcessInfo"> </argument> <description> Returns an Info defined by the [enum ProcessInfo] input given. @@ -918,7 +918,7 @@ </return> <argument index="0" name="joint" type="RID"> </argument> - <argument index="1" name="flag" type="int" enum="PhysicsServer.HingeJointFlag"> + <argument index="1" name="flag" type="int" enum="PhysicsServer3D.HingeJointFlag"> </argument> <description> Gets a hinge_joint flag (see [enum HingeJointFlag] constants). @@ -929,7 +929,7 @@ </return> <argument index="0" name="joint" type="RID"> </argument> - <argument index="1" name="param" type="int" enum="PhysicsServer.HingeJointParam"> + <argument index="1" name="param" type="int" enum="PhysicsServer3D.HingeJointParam"> </argument> <description> Gets a hinge_joint parameter (see [enum HingeJointParam]). @@ -940,7 +940,7 @@ </return> <argument index="0" name="joint" type="RID"> </argument> - <argument index="1" name="flag" type="int" enum="PhysicsServer.HingeJointFlag"> + <argument index="1" name="flag" type="int" enum="PhysicsServer3D.HingeJointFlag"> </argument> <argument index="2" name="enabled" type="bool"> </argument> @@ -953,7 +953,7 @@ </return> <argument index="0" name="joint" type="RID"> </argument> - <argument index="1" name="param" type="int" enum="PhysicsServer.HingeJointParam"> + <argument index="1" name="param" type="int" enum="PhysicsServer3D.HingeJointParam"> </argument> <argument index="2" name="value" type="float"> </argument> @@ -973,7 +973,7 @@ <argument index="3" name="local_ref_B" type="Transform"> </argument> <description> - Creates a [ConeTwistJoint]. + Creates a [ConeTwistJoint3D]. </description> </method> <method name="joint_create_generic_6dof"> @@ -988,7 +988,7 @@ <argument index="3" name="local_ref_B" type="Transform"> </argument> <description> - Creates a [Generic6DOFJoint]. + Creates a [Generic6DOFJoint3D]. </description> </method> <method name="joint_create_hinge"> @@ -1003,7 +1003,7 @@ <argument index="3" name="hinge_B" type="Transform"> </argument> <description> - Creates a [HingeJoint]. + Creates a [HingeJoint3D]. </description> </method> <method name="joint_create_pin"> @@ -1018,7 +1018,7 @@ <argument index="3" name="local_B" type="Vector3"> </argument> <description> - Creates a [PinJoint]. + Creates a [PinJoint3D]. </description> </method> <method name="joint_create_slider"> @@ -1033,7 +1033,7 @@ <argument index="3" name="local_ref_B" type="Transform"> </argument> <description> - Creates a [SliderJoint]. + Creates a [SliderJoint3D]. </description> </method> <method name="joint_get_solver_priority" qualifiers="const"> @@ -1042,16 +1042,16 @@ <argument index="0" name="joint" type="RID"> </argument> <description> - Gets the priority value of the Joint. + Gets the priority value of the Joint3D. </description> </method> <method name="joint_get_type" qualifiers="const"> - <return type="int" enum="PhysicsServer.JointType"> + <return type="int" enum="PhysicsServer3D.JointType"> </return> <argument index="0" name="joint" type="RID"> </argument> <description> - Returns the type of the Joint. + Returns the type of the Joint3D. </description> </method> <method name="joint_set_solver_priority"> @@ -1062,7 +1062,7 @@ <argument index="1" name="priority" type="int"> </argument> <description> - Sets the priority value of the Joint. + Sets the priority value of the Joint3D. </description> </method> <method name="pin_joint_get_local_a" qualifiers="const"> @@ -1088,7 +1088,7 @@ </return> <argument index="0" name="joint" type="RID"> </argument> - <argument index="1" name="param" type="int" enum="PhysicsServer.PinJointParam"> + <argument index="1" name="param" type="int" enum="PhysicsServer3D.PinJointParam"> </argument> <description> Gets a pin_joint parameter (see [enum PinJointParam] constants). @@ -1121,7 +1121,7 @@ </return> <argument index="0" name="joint" type="RID"> </argument> - <argument index="1" name="param" type="int" enum="PhysicsServer.PinJointParam"> + <argument index="1" name="param" type="int" enum="PhysicsServer3D.PinJointParam"> </argument> <argument index="2" name="value" type="float"> </argument> @@ -1141,7 +1141,7 @@ <method name="shape_create"> <return type="RID"> </return> - <argument index="0" name="type" type="int" enum="PhysicsServer.ShapeType"> + <argument index="0" name="type" type="int" enum="PhysicsServer3D.ShapeType"> </argument> <description> Creates a shape of a type from [enum ShapeType]. Does not assign it to a body or an area. To do so, you must use [method area_set_shape] or [method body_set_shape]. @@ -1157,7 +1157,7 @@ </description> </method> <method name="shape_get_type" qualifiers="const"> - <return type="int" enum="PhysicsServer.ShapeType"> + <return type="int" enum="PhysicsServer3D.ShapeType"> </return> <argument index="0" name="shape" type="RID"> </argument> @@ -1181,7 +1181,7 @@ </return> <argument index="0" name="joint" type="RID"> </argument> - <argument index="1" name="param" type="int" enum="PhysicsServer.SliderJointParam"> + <argument index="1" name="param" type="int" enum="PhysicsServer3D.SliderJointParam"> </argument> <description> Gets a slider_joint parameter (see [enum SliderJointParam] constants). @@ -1192,7 +1192,7 @@ </return> <argument index="0" name="joint" type="RID"> </argument> - <argument index="1" name="param" type="int" enum="PhysicsServer.SliderJointParam"> + <argument index="1" name="param" type="int" enum="PhysicsServer3D.SliderJointParam"> </argument> <argument index="2" name="value" type="float"> </argument> @@ -1208,12 +1208,12 @@ </description> </method> <method name="space_get_direct_state"> - <return type="PhysicsDirectSpaceState"> + <return type="PhysicsDirectSpaceState3D"> </return> <argument index="0" name="space" type="RID"> </argument> <description> - Returns the state of a space, a [PhysicsDirectSpaceState]. This object can be used to make collision/intersection queries. + Returns the state of a space, a [PhysicsDirectSpaceState3D]. This object can be used to make collision/intersection queries. </description> </method> <method name="space_get_param" qualifiers="const"> @@ -1221,7 +1221,7 @@ </return> <argument index="0" name="space" type="RID"> </argument> - <argument index="1" name="param" type="int" enum="PhysicsServer.SpaceParameter"> + <argument index="1" name="param" type="int" enum="PhysicsServer3D.SpaceParameter"> </argument> <description> Returns the value of a space parameter. @@ -1252,7 +1252,7 @@ </return> <argument index="0" name="space" type="RID"> </argument> - <argument index="1" name="param" type="int" enum="PhysicsServer.SpaceParameter"> + <argument index="1" name="param" type="int" enum="PhysicsServer3D.SpaceParameter"> </argument> <argument index="2" name="value" type="float"> </argument> @@ -1263,19 +1263,19 @@ </methods> <constants> <constant name="JOINT_PIN" value="0" enum="JointType"> - The [Joint] is a [PinJoint]. + The [Joint3D] is a [PinJoint3D]. </constant> <constant name="JOINT_HINGE" value="1" enum="JointType"> - The [Joint] is a [HingeJoint]. + The [Joint3D] is a [HingeJoint3D]. </constant> <constant name="JOINT_SLIDER" value="2" enum="JointType"> - The [Joint] is a [SliderJoint]. + The [Joint3D] is a [SliderJoint3D]. </constant> <constant name="JOINT_CONE_TWIST" value="3" enum="JointType"> - The [Joint] is a [ConeTwistJoint]. + The [Joint3D] is a [ConeTwistJoint3D]. </constant> <constant name="JOINT_6DOF" value="4" enum="JointType"> - The [Joint] is a [Generic6DOFJoint]. + The [Joint3D] is a [Generic6DOFJoint3D]. </constant> <constant name="PIN_JOINT_BIAS" value="0" enum="PinJointParam"> The strength with which the pinned objects try to stay in positional relation to each other. @@ -1286,7 +1286,7 @@ The higher, the stronger. </constant> <constant name="PIN_JOINT_IMPULSE_CLAMP" value="2" enum="PinJointParam"> - If above 0, this value is the maximum value for an impulse that this Joint puts on its ends. + If above 0, this value is the maximum value for an impulse that this Joint3D puts on its ends. </constant> <constant name="HINGE_JOINT_BIAS" value="0" enum="HingeJointParam"> The speed with which the two bodies get pulled together when they move in different directions. @@ -1389,7 +1389,7 @@ <constant name="CONE_TWIST_JOINT_SWING_SPAN" value="0" enum="ConeTwistJointParam"> Swing is rotation from side to side, around the axis perpendicular to the twist axis. The swing span defines, how much rotation will not get corrected along the swing axis. - Could be defined as looseness in the [ConeTwistJoint]. + Could be defined as looseness in the [ConeTwistJoint3D]. If below 0.05, this behavior is locked. </constant> <constant name="CONE_TWIST_JOINT_TWIST_SPAN" value="1" enum="ConeTwistJointParam"> @@ -1401,7 +1401,7 @@ The higher, the faster. </constant> <constant name="CONE_TWIST_JOINT_SOFTNESS" value="3" enum="ConeTwistJointParam"> - The ease with which the Joint twists, if it's too low, it takes more force to twist the joint. + The ease with which the Joint3D twists, if it's too low, it takes more force to twist the joint. </constant> <constant name="CONE_TWIST_JOINT_RELAXATION" value="4" enum="ConeTwistJointParam"> Defines, how fast the swing- and twist-speed-difference on both sides gets synced. @@ -1467,31 +1467,31 @@ If [code]set[/code] there is a linear motor on this axis that targets a specific velocity. </constant> <constant name="SHAPE_PLANE" value="0" enum="ShapeType"> - The [Shape] is a [WorldMarginShape]. + The [Shape3D] is a [WorldMarginShape3D]. </constant> <constant name="SHAPE_RAY" value="1" enum="ShapeType"> - The [Shape] is a [RayShape]. + The [Shape3D] is a [RayShape3D]. </constant> <constant name="SHAPE_SPHERE" value="2" enum="ShapeType"> - The [Shape] is a [SphereShape]. + The [Shape3D] is a [SphereShape3D]. </constant> <constant name="SHAPE_BOX" value="3" enum="ShapeType"> - The [Shape] is a [BoxShape]. + The [Shape3D] is a [BoxShape3D]. </constant> <constant name="SHAPE_CAPSULE" value="4" enum="ShapeType"> - The [Shape] is a [CapsuleShape]. + The [Shape3D] is a [CapsuleShape3D]. </constant> <constant name="SHAPE_CYLINDER" value="5" enum="ShapeType"> - The [Shape] is a [CylinderShape]. + The [Shape3D] is a [CylinderShape3D]. </constant> <constant name="SHAPE_CONVEX_POLYGON" value="6" enum="ShapeType"> - The [Shape] is a [ConvexPolygonShape]. + The [Shape3D] is a [ConvexPolygonShape3D]. </constant> <constant name="SHAPE_CONCAVE_POLYGON" value="7" enum="ShapeType"> - The [Shape] is a [ConcavePolygonShape]. + The [Shape3D] is a [ConcavePolygonShape3D]. </constant> <constant name="SHAPE_HEIGHTMAP" value="8" enum="ShapeType"> - The [Shape] is a [HeightMapShape]. + The [Shape3D] is a [HeightMapShape3D]. </constant> <constant name="SHAPE_CUSTOM" value="9" enum="ShapeType"> This constant is used internally by the engine. Any attempt to create this kind of shape results in an error. diff --git a/doc/classes/Physics2DShapeQueryParameters.xml b/doc/classes/PhysicsShapeQueryParameters2D.xml index 392ccbd10a..9a162dabbb 100644 --- a/doc/classes/Physics2DShapeQueryParameters.xml +++ b/doc/classes/PhysicsShapeQueryParameters2D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Physics2DShapeQueryParameters" inherits="Reference" version="4.0"> +<class name="PhysicsShapeQueryParameters2D" inherits="Reference" version="4.0"> <brief_description> Parameters to be sent to a 2D shape physics query. </brief_description> <description> - This class contains the shape and other parameters for 2D intersection/collision queries. See also [Physics2DShapeQueryResult]. + This class contains the shape and other parameters for 2D intersection/collision queries. See also [PhysicsShapeQueryResult2D]. </description> <tutorials> </tutorials> diff --git a/doc/classes/PhysicsShapeQueryParameters.xml b/doc/classes/PhysicsShapeQueryParameters3D.xml index 829a1d1bf0..6606cfbc59 100644 --- a/doc/classes/PhysicsShapeQueryParameters.xml +++ b/doc/classes/PhysicsShapeQueryParameters3D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PhysicsShapeQueryParameters" inherits="Reference" version="4.0"> +<class name="PhysicsShapeQueryParameters3D" inherits="Reference" version="4.0"> <brief_description> Parameters to be sent to a 3D shape physics query. </brief_description> <description> - This class contains the shape and other parameters for 3D intersection/collision queries. See also [PhysicsShapeQueryResult]. + This class contains the shape and other parameters for 3D intersection/collision queries. See also [PhysicsShapeQueryResult3D]. </description> <tutorials> </tutorials> @@ -15,16 +15,16 @@ <argument index="0" name="shape" type="Resource"> </argument> <description> - Sets the [Shape] that will be used for collision/intersection queries. + Sets the [Shape3D] that will be used for collision/intersection queries. </description> </method> </methods> <members> <member name="collide_with_areas" type="bool" setter="set_collide_with_areas" getter="is_collide_with_areas_enabled" default="false"> - If [code]true[/code], the query will take [Area]s into account. + If [code]true[/code], the query will take [Area3D]s into account. </member> <member name="collide_with_bodies" type="bool" setter="set_collide_with_bodies" getter="is_collide_with_bodies_enabled" default="true"> - If [code]true[/code], the query will take [PhysicsBody]s into account. + If [code]true[/code], the query will take [PhysicsBody3D]s into account. </member> <member name="collision_mask" type="int" setter="set_collision_mask" getter="get_collision_mask" default="2147483647"> The physics layer(s) the query will take into account (as a bitmask). diff --git a/doc/classes/Physics2DShapeQueryResult.xml b/doc/classes/PhysicsShapeQueryResult2D.xml index 359a716bee..227683cc33 100644 --- a/doc/classes/Physics2DShapeQueryResult.xml +++ b/doc/classes/PhysicsShapeQueryResult2D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Physics2DShapeQueryResult" inherits="Reference" version="4.0"> +<class name="PhysicsShapeQueryResult2D" inherits="Reference" version="4.0"> <brief_description> - Result of a 2D shape query in [Physics2DServer]. + Result of a 2D shape query in [PhysicsServer2D]. </brief_description> <description> - The result of a 2D shape query in [Physics2DServer]. See also [Physics2DShapeQueryParameters]. + The result of a 2D shape query in [PhysicsServer2D]. See also [PhysicsShapeQueryParameters2D]. </description> <tutorials> </tutorials> @@ -40,7 +40,7 @@ <argument index="0" name="idx" type="int"> </argument> <description> - Returns the child index of the object's [Shape] that intersected with the shape at index [code]idx[/code]. + Returns the child index of the object's [Shape2D] that intersected with the shape at index [code]idx[/code]. </description> </method> <method name="get_result_rid" qualifiers="const"> diff --git a/doc/classes/PhysicsShapeQueryResult.xml b/doc/classes/PhysicsShapeQueryResult3D.xml index ea6dc2c39e..4555c4e242 100644 --- a/doc/classes/PhysicsShapeQueryResult.xml +++ b/doc/classes/PhysicsShapeQueryResult3D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PhysicsShapeQueryResult" inherits="Reference" version="4.0"> +<class name="PhysicsShapeQueryResult3D" inherits="Reference" version="4.0"> <brief_description> - Result of a 3D shape query in [PhysicsServer]. + Result of a 3D shape query in [PhysicsServer3D]. </brief_description> <description> - The result of a 3D shape query in [PhysicsServer]. See also [PhysicsShapeQueryParameters]. + The result of a 3D shape query in [PhysicsServer3D]. See also [PhysicsShapeQueryParameters3D]. </description> <tutorials> </tutorials> @@ -40,7 +40,7 @@ <argument index="0" name="idx" type="int"> </argument> <description> - Returns the child index of the object's [Shape] that intersected with the shape at index [code]idx[/code]. + Returns the child index of the object's [Shape3D] that intersected with the shape at index [code]idx[/code]. </description> </method> <method name="get_result_rid" qualifiers="const"> diff --git a/doc/classes/Physics2DTestMotionResult.xml b/doc/classes/PhysicsTestMotionResult2D.xml index 9e8c03580f..301cff2885 100644 --- a/doc/classes/Physics2DTestMotionResult.xml +++ b/doc/classes/PhysicsTestMotionResult2D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Physics2DTestMotionResult" inherits="Reference" version="4.0"> +<class name="PhysicsTestMotionResult2D" inherits="Reference" version="4.0"> <brief_description> </brief_description> <description> diff --git a/doc/classes/PinJoint2D.xml b/doc/classes/PinJoint2D.xml index 020babdf40..42155a7f25 100644 --- a/doc/classes/PinJoint2D.xml +++ b/doc/classes/PinJoint2D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="PinJoint2D" inherits="Joint2D" version="4.0"> <brief_description> - Pin Joint for 2D shapes. + Pin joint for 2D shapes. </brief_description> <description> - Pin Joint for 2D rigid bodies. It pins two bodies (rigid or static) together. + Pin joint for 2D rigid bodies. It pins two bodies (rigid or static) together. </description> <tutorials> </tutorials> diff --git a/doc/classes/PinJoint.xml b/doc/classes/PinJoint3D.xml index 78cab4805e..0af1e60839 100644 --- a/doc/classes/PinJoint.xml +++ b/doc/classes/PinJoint3D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PinJoint" inherits="Joint" version="4.0"> +<class name="PinJoint3D" inherits="Joint3D" version="4.0"> <brief_description> Pin joint for 3D shapes. </brief_description> @@ -12,7 +12,7 @@ <method name="get_param" qualifiers="const"> <return type="float"> </return> - <argument index="0" name="param" type="int" enum="PinJoint.Param"> + <argument index="0" name="param" type="int" enum="PinJoint3D.Param"> </argument> <description> Returns the value of the specified parameter. @@ -21,7 +21,7 @@ <method name="set_param"> <return type="void"> </return> - <argument index="0" name="param" type="int" enum="PinJoint.Param"> + <argument index="0" name="param" type="int" enum="PinJoint3D.Param"> </argument> <argument index="1" name="value" type="float"> </argument> @@ -38,7 +38,7 @@ The force with which the pinned objects stay in velocity relation to each other. The higher, the stronger. </member> <member name="params/impulse_clamp" type="float" setter="set_param" getter="get_param" default="0.0"> - If above 0, this value is the maximum value for an impulse that this Joint produces. + If above 0, this value is the maximum value for an impulse that this Joint3D produces. </member> </members> <constants> @@ -49,7 +49,7 @@ The force with which the pinned objects stay in velocity relation to each other. The higher, the stronger. </constant> <constant name="PARAM_IMPULSE_CLAMP" value="2" enum="Param"> - If above 0, this value is the maximum value for an impulse that this Joint produces. + If above 0, this value is the maximum value for an impulse that this Joint3D produces. </constant> </constants> </class> diff --git a/doc/classes/Popup.xml b/doc/classes/Popup.xml index 483e262f60..6f77f3371d 100644 --- a/doc/classes/Popup.xml +++ b/doc/classes/Popup.xml @@ -1,81 +1,23 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Popup" inherits="Control" version="4.0"> +<class name="Popup" inherits="Window" version="4.0"> <brief_description> Base container control for popups and dialogs. </brief_description> <description> - Popup is a base [Control] used to show dialogs and popups. It's a subwindow and modal by default (see [Control]) and has helpers for custom popup behavior. All popup methods ensure correct placement within the viewport. + Popup is a base [Control] used to show dialogs and popups. It's a subwindow and modal by default (see [Control]) and has helpers for custom popup behavior. </description> <tutorials> </tutorials> <methods> - <method name="popup"> - <return type="void"> - </return> - <argument index="0" name="bounds" type="Rect2" default="Rect2( 0, 0, 0, 0 )"> - </argument> - <description> - Popup (show the control in modal form). - </description> - </method> - <method name="popup_centered"> - <return type="void"> - </return> - <argument index="0" name="size" type="Vector2" default="Vector2( 0, 0 )"> - </argument> - <description> - Popup (show the control in modal form) in the center of the screen relative to its current canvas transform, at the current size, or at a size determined by [code]size[/code]. - </description> - </method> - <method name="popup_centered_clamped"> - <return type="void"> - </return> - <argument index="0" name="size" type="Vector2" default="Vector2( 0, 0 )"> - </argument> - <argument index="1" name="fallback_ratio" type="float" default="0.75"> - </argument> - <description> - Popup (show the control in modal form) in the center of the screen relative to the current canvas transform, clamping the size to [code]size[/code], then ensuring the popup is no larger than the viewport size multiplied by [code]fallback_ratio[/code]. - </description> - </method> - <method name="popup_centered_minsize"> - <return type="void"> - </return> - <argument index="0" name="minsize" type="Vector2" default="Vector2( 0, 0 )"> - </argument> - <description> - Popup (show the control in modal form) in the center of the screen relative to the current canvas transform, ensuring the size is never smaller than [code]minsize[/code]. - </description> - </method> - <method name="popup_centered_ratio"> - <return type="void"> - </return> - <argument index="0" name="ratio" type="float" default="0.75"> - </argument> - <description> - Popup (show the control in modal form) in the center of the screen relative to the current canvas transform, scaled at a ratio of size of the screen. - </description> - </method> - <method name="set_as_minsize"> - <return type="void"> - </return> - <description> - Shrink popup to keep to the minimum size of content. - </description> - </method> </methods> <members> - <member name="popup_exclusive" type="bool" setter="set_exclusive" getter="is_exclusive" default="false"> - If [code]true[/code], the popup will not be hidden when a click event occurs outside of it, or when it receives the [code]ui_cancel[/code] action event. - </member> + <member name="borderless" type="bool" setter="set_flag" getter="get_flag" override="true" default="true" /> + <member name="transient" type="bool" setter="set_transient" getter="is_transient" override="true" default="true" /> + <member name="unresizable" type="bool" setter="set_flag" getter="get_flag" override="true" default="true" /> <member name="visible" type="bool" setter="set_visible" getter="is_visible" override="true" default="false" /> + <member name="wrap_controls" type="bool" setter="set_wrap_controls" getter="is_wrapping_controls" override="true" default="true" /> </members> <signals> - <signal name="about_to_show"> - <description> - Emitted when a popup is about to be shown. This is often used in [PopupMenu] to clear the list of options then create a new one according to the current context. - </description> - </signal> <signal name="popup_hide"> <description> Emitted when a popup is hidden. @@ -83,11 +25,5 @@ </signal> </signals> <constants> - <constant name="NOTIFICATION_POST_POPUP" value="80"> - Notification sent right after the popup is shown. - </constant> - <constant name="NOTIFICATION_POPUP_HIDE" value="81"> - Notification sent right after the popup is hidden. - </constant> </constants> </class> diff --git a/doc/classes/PopupDialog.xml b/doc/classes/PopupDialog.xml deleted file mode 100644 index a8fd9c1b7d..0000000000 --- a/doc/classes/PopupDialog.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<class name="PopupDialog" inherits="Popup" version="4.0"> - <brief_description> - Base class for popup dialogs. - </brief_description> - <description> - PopupDialog is a base class for popup dialogs, along with [WindowDialog]. - </description> - <tutorials> - </tutorials> - <methods> - </methods> - <constants> - </constants> - <theme_items> - <theme_item name="panel" type="StyleBox"> - Sets a custom [StyleBox] for the panel of the [PopupDialog]. - </theme_item> - </theme_items> -</class> diff --git a/doc/classes/PopupMenu.xml b/doc/classes/PopupMenu.xml index 8dda33f624..569da5c58b 100644 --- a/doc/classes/PopupMenu.xml +++ b/doc/classes/PopupMenu.xml @@ -330,13 +330,6 @@ Returns the tooltip associated with the specified index index [code]idx[/code]. </description> </method> - <method name="is_hide_on_window_lose_focus" qualifiers="const"> - <return type="bool"> - </return> - <description> - Returns [code]true[/code] if the popup will be hidden when the window loses focus or not. - </description> - </method> <method name="is_item_checkable" qualifiers="const"> <return type="bool"> </return> @@ -404,15 +397,6 @@ [b]Note:[/b] The indices of items after the removed item will be shifted by one. </description> </method> - <method name="set_hide_on_window_lose_focus"> - <return type="void"> - </return> - <argument index="0" name="enable" type="bool"> - </argument> - <description> - Hides the [PopupMenu] when the window loses focus. - </description> - </method> <method name="set_item_accelerator"> <return type="void"> </return> @@ -604,7 +588,6 @@ <member name="allow_search" type="bool" setter="set_allow_search" getter="get_allow_search" default="false"> If [code]true[/code], allows to navigate [PopupMenu] with letter keys. </member> - <member name="focus_mode" type="int" setter="set_focus_mode" getter="get_focus_mode" override="true" enum="Control.FocusMode" default="2" /> <member name="hide_on_checkable_item_selection" type="bool" setter="set_hide_on_checkable_item_selection" getter="is_hide_on_checkable_item_selection" default="true"> If [code]true[/code], hides the [PopupMenu] when a checkbox or radio button is selected. </member> diff --git a/doc/classes/PopupPanel.xml b/doc/classes/PopupPanel.xml index 2e62d09f8f..72045c5559 100644 --- a/doc/classes/PopupPanel.xml +++ b/doc/classes/PopupPanel.xml @@ -4,7 +4,7 @@ Class for displaying popups with a panel background. </brief_description> <description> - Class for displaying popups with a panel background. In some cases it might be simpler to use than [Popup], since it provides a configurable background. If you are making windows, better check [WindowDialog]. + Class for displaying popups with a panel background. In some cases it might be simpler to use than [Popup], since it provides a configurable background. If you are making windows, better check [Window]. </description> <tutorials> </tutorials> diff --git a/doc/classes/Position3D.xml b/doc/classes/Position3D.xml index 6dce8a91c6..ca61a57483 100644 --- a/doc/classes/Position3D.xml +++ b/doc/classes/Position3D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Position3D" inherits="Spatial" version="4.0"> +<class name="Position3D" inherits="Node3D" version="4.0"> <brief_description> Generic 3D position hint for editing. </brief_description> <description> - Generic 3D position hint for editing. It's just like a plain [Spatial], but it displays as a cross in the 3D editor at all times. + Generic 3D position hint for editing. It's just like a plain [Node3D], but it displays as a cross in the 3D editor at all times. </description> <tutorials> </tutorials> diff --git a/doc/classes/ProceduralSkyMaterial.xml b/doc/classes/ProceduralSkyMaterial.xml index dec0cbc120..70e82d248c 100644 --- a/doc/classes/ProceduralSkyMaterial.xml +++ b/doc/classes/ProceduralSkyMaterial.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="ProceduralSkyMaterial" inherits="Material" version="4.0"> <brief_description> - A [Material] used with [Sky] to generate a background based on user input parameters. + A [Material] used with [Sky] to generate a background based on user input parameters. </brief_description> <description> ProceduralSkyMaterial provides a way to create an effective background quickly by defining procedural parameters for the sun, the sky and the ground. The sky and ground are very similar, they are defined by a color at the horizon, another color, and finally an easing curve to interpolate between these two colors. Similarly, the sun is described by a position in the sky, a color, and an easing curve. However, the sun also defines a minimum and maximum angle, these two values define at what distance the easing curve begins and ends from the sun, and thus end up defining the size of the sun in the sky. The [ProceduralSkyMaterial] uses a lightweight shader to draw the sky and is thus suited for real time updates. When you do not need a quick sky that is not realistic, this is a good option. - The [ProceduralSkyMaterial] supports up to 4 suns. Each sun takes its color, energy, and direction from the corresponding [DirectionalLight] in the scene. + The [ProceduralSkyMaterial] supports up to 4 suns. Each sun takes its color, energy, and direction from the corresponding [DirectionalLight3D] in the scene. </description> <tutorials> </tutorials> diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml index 79d5ffa2e7..46f6fd2284 100644 --- a/doc/classes/ProjectSettings.xml +++ b/doc/classes/ProjectSettings.xml @@ -202,7 +202,7 @@ Icon used for the project, set when project loads. Exporters will also use this icon when possible. </member> <member name="application/config/macos_native_icon" type="String" setter="" getter="" default=""""> - Icon set in [code].icns[/code] format used on macOS to set the game's icon. This is done automatically on start by calling [method OS.set_native_icon]. + Icon set in [code].icns[/code] format used on macOS to set the game's icon. This is done automatically on start by calling [method DisplayServer.set_native_icon]. </member> <member name="application/config/name" type="String" setter="" getter="" default=""""> The project's name. It is used both by the Project Manager and by exporters. The project name can be translated by translating its value in localization files. @@ -215,7 +215,7 @@ If [code]true[/code], the project will save user data to its own user directory (see [member application/config/custom_user_dir_name]). This setting is only effective on desktop platforms. A name must be set in the [member application/config/custom_user_dir_name] setting for this to take effect. If [code]false[/code], the project will save user data to [code](OS user data directory)/Godot/app_userdata/(project name)[/code]. </member> <member name="application/config/windows_native_icon" type="String" setter="" getter="" default=""""> - Icon set in [code].ico[/code] format used on Windows to set the game's icon. This is done automatically on start by calling [method OS.set_native_icon]. + Icon set in [code].ico[/code] format used on Windows to set the game's icon. This is done automatically on start by calling [method DisplayServer.set_native_icon]. </member> <member name="application/run/disable_stderr" type="bool" setter="" getter="" default="false"> If [code]true[/code], disables printing to standard error in an exported build. @@ -426,12 +426,6 @@ <member name="display/window/ios/hide_home_indicator" type="bool" setter="" getter="" default="true"> If [code]true[/code], the home indicator is hidden automatically. This only affects iOS devices without a physical home button. </member> - <member name="display/window/per_pixel_transparency/allowed" type="bool" setter="" getter="" default="false"> - If [code]true[/code], allows per-pixel transparency in a desktop window. This affects performance, so leave it on [code]false[/code] unless you need it. - </member> - <member name="display/window/per_pixel_transparency/enabled" type="bool" setter="" getter="" default="false"> - Sets the window background to transparent when it starts. - </member> <member name="display/window/size/always_on_top" type="bool" setter="" getter="" default="false"> Force the window to be always on top. </member> @@ -898,7 +892,7 @@ [b]Note:[/b] This property is only read when the project starts. To change the default gravity at runtime, use the following code sample: [codeblock] # Set the default gravity strength to 98. - Physics2DServer.area_set_param(get_viewport().find_world_2d().get_space(), Physics2DServer.AREA_PARAM_GRAVITY, 98) + PhysicsServer2D.area_set_param(get_viewport().find_world_2d().get_space(), PhysicsServer2D.AREA_PARAM_GRAVITY, 98) [/codeblock] </member> <member name="physics/2d/default_gravity_vector" type="Vector2" setter="" getter="" default="Vector2( 0, 1 )"> @@ -906,7 +900,7 @@ [b]Note:[/b] This property is only read when the project starts. To change the default gravity vector at runtime, use the following code sample: [codeblock] # Set the default gravity direction to `Vector2(0, 1)`. - Physics2DServer.area_set_param(get_viewport().find_world_2d().get_space(), Physics2DServer.AREA_PARAM_GRAVITY_VECTOR, Vector2(0, 1)) + PhysicsServer2D.area_set_param(get_viewport().find_world_2d().get_space(), PhysicsServer2D.AREA_PARAM_GRAVITY_VECTOR, Vector2(0, 1)) [/codeblock] </member> <member name="physics/2d/default_linear_damp" type="float" setter="" getter="" default="0.1"> @@ -920,20 +914,20 @@ "DEFAULT" and "GodotPhysics" are the same, as there is currently no alternative 2D physics server implemented. </member> <member name="physics/2d/sleep_threshold_angular" type="float" setter="" getter="" default="0.139626"> - Threshold angular velocity under which a 2D physics body will be considered inactive. See [constant Physics2DServer.SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_THRESHOLD]. + Threshold angular velocity under which a 2D physics body will be considered inactive. See [constant PhysicsServer2D.SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_THRESHOLD]. </member> <member name="physics/2d/sleep_threshold_linear" type="float" setter="" getter="" default="2.0"> - Threshold linear velocity under which a 2D physics body will be considered inactive. See [constant Physics2DServer.SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_THRESHOLD]. + Threshold linear velocity under which a 2D physics body will be considered inactive. See [constant PhysicsServer2D.SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_THRESHOLD]. </member> <member name="physics/2d/thread_model" type="int" setter="" getter="" default="1"> Sets whether physics is run on the main thread or a separate one. Running the server on a thread increases performance, but restricts API access to only physics process. [b]Warning:[/b] As of Godot 3.2, there are mixed reports about the use of a Multi-Threaded thread model for physics. Be sure to assess whether it does give you extra performance and no regressions when using it. </member> <member name="physics/2d/time_before_sleep" type="float" setter="" getter="" default="0.5"> - Time (in seconds) of inactivity before which a 2D physics body will put to sleep. See [constant Physics2DServer.SPACE_PARAM_BODY_TIME_TO_SLEEP]. + Time (in seconds) of inactivity before which a 2D physics body will put to sleep. See [constant PhysicsServer2D.SPACE_PARAM_BODY_TIME_TO_SLEEP]. </member> <member name="physics/3d/active_soft_world" type="bool" setter="" getter="" default="true"> - Sets whether the 3D physics world will be created with support for [SoftBody] physics. Only applies to the Bullet physics engine. + Sets whether the 3D physics world will be created with support for [SoftBody3D] physics. Only applies to the Bullet physics engine. </member> <member name="physics/3d/default_angular_damp" type="float" setter="" getter="" default="0.1"> The default angular damp in 3D. @@ -943,7 +937,7 @@ [b]Note:[/b] This property is only read when the project starts. To change the default gravity at runtime, use the following code sample: [codeblock] # Set the default gravity strength to 9.8. - PhysicsServer.area_set_param(get_viewport().find_world().get_space(), PhysicsServer.AREA_PARAM_GRAVITY, 9.8) + PhysicsServer3D.area_set_param(get_viewport().find_world().get_space(), PhysicsServer3D.AREA_PARAM_GRAVITY, 9.8) [/codeblock] </member> <member name="physics/3d/default_gravity_vector" type="Vector3" setter="" getter="" default="Vector3( 0, -1, 0 )"> @@ -951,7 +945,7 @@ [b]Note:[/b] This property is only read when the project starts. To change the default gravity vector at runtime, use the following code sample: [codeblock] # Set the default gravity direction to `Vector3(0, -1, 0)`. - PhysicsServer.area_set_param(get_viewport().find_world().get_space(), PhysicsServer.AREA_PARAM_GRAVITY_VECTOR, Vector3(0, -1, 0)) + PhysicsServer3D.area_set_param(get_viewport().find_world().get_space(), PhysicsServer3D.AREA_PARAM_GRAVITY_VECTOR, Vector3(0, -1, 0)) [/codeblock] </member> <member name="physics/3d/default_linear_damp" type="float" setter="" getter="" default="0.1"> @@ -973,7 +967,7 @@ [b]Note:[/b] This property is only read when the project starts. To change the physics FPS at runtime, set [member Engine.physics_jitter_fix] instead. </member> <member name="rendering/environment/default_clear_color" type="Color" setter="" getter="" default="Color( 0.3, 0.3, 0.3, 1 )"> - Default background clear color. Overridable per [Viewport] using its [Environment]. See [member Environment.background_mode] and [member Environment.background_color] in particular. To change this default color programmatically, use [method VisualServer.set_default_clear_color]. + Default background clear color. Overridable per [Viewport] using its [Environment]. See [member Environment.background_mode] and [member Environment.background_color] in particular. To change this default color programmatically, use [method RenderingServer.set_default_clear_color]. </member> <member name="rendering/environment/default_environment" type="String" setter="" getter="" default=""""> [Environment] that will be used as a fallback environment in case a scene does not specify its own environment. The default environment is loaded in at scene load time regardless of whether you have set an environment or not. If you do not rely on the fallback environment, it is best to delete [code]default_env.tres[/code], or to specify a different default environment here. @@ -1002,7 +996,9 @@ </member> <member name="rendering/quality/driver/driver_name" type="String" setter="" getter="" default=""Vulkan""> The video driver to use ("GLES2" or "Vulkan"). - [b]Note:[/b] The backend in use can be overridden at runtime via the [code]--video-driver[/code] command line argument. In such cases, this property is not updated, so use [method OS.get_current_video_driver] to query it at run-time. + [b]Note:[/b] The backend in use can be overridden at runtime via the [code]--rendering-driver[/code] command line argument. + [b]FIXME:[/b] No longer valid after DisplayServer split: + In such cases, this property is not updated, so use [code]OS.get_current_video_driver[/code] to query it at run-time. </member> <member name="rendering/quality/filters/depth_of_field_bokeh_quality" type="int" setter="" getter="" default="2"> </member> @@ -1027,6 +1023,10 @@ </member> <member name="rendering/quality/gi_probes/quality" type="int" setter="" getter="" default="1"> </member> + <member name="rendering/quality/glow/upscale_mode" type="int" setter="" getter="" default="1"> + </member> + <member name="rendering/quality/glow/upscale_mode.mobile" type="int" setter="" getter="" default="0"> + </member> <member name="rendering/quality/intended_usage/framebuffer_allocation" type="int" setter="" getter="" default="2"> Strategy used for framebuffer allocation. The simpler it is, the less resources it uses (but the less features it supports). If set to "2D Without Sampling" or "3D Without Effects", sample buffers will not be allocated. This means [code]SCREEN_TEXTURE[/code] and [code]DEPTH_TEXTURE[/code] will not be available in shaders and post-processing effects will not be available in the [Environment]. </member> diff --git a/doc/classes/ProximityGroup.xml b/doc/classes/ProximityGroup3D.xml index dee1a3daf0..1714c1ec8d 100644 --- a/doc/classes/ProximityGroup.xml +++ b/doc/classes/ProximityGroup3D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ProximityGroup" inherits="Spatial" version="4.0"> +<class name="ProximityGroup3D" inherits="Node3D" version="4.0"> <brief_description> General-purpose proximity detection node. </brief_description> @@ -21,7 +21,7 @@ </method> </methods> <members> - <member name="dispatch_mode" type="int" setter="set_dispatch_mode" getter="get_dispatch_mode" enum="ProximityGroup.DispatchMode" default="0"> + <member name="dispatch_mode" type="int" setter="set_dispatch_mode" getter="get_dispatch_mode" enum="ProximityGroup3D.DispatchMode" default="0"> </member> <member name="grid_radius" type="Vector3" setter="set_grid_radius" getter="get_grid_radius" default="Vector3( 1, 1, 1 )"> </member> diff --git a/doc/classes/RID.xml b/doc/classes/RID.xml index 77c608fccb..644c427120 100644 --- a/doc/classes/RID.xml +++ b/doc/classes/RID.xml @@ -4,7 +4,7 @@ Handle for a [Resource]'s unique ID. </brief_description> <description> - The RID type is used to access the unique integer ID of a resource. They are opaque, which means they do not grant access to the associated resource by themselves. They are used by and with the low-level Server classes such as [VisualServer]. + The RID type is used to access the unique integer ID of a resource. They are opaque, which means they do not grant access to the associated resource by themselves. They are used by and with the low-level Server classes such as [RenderingServer]. </description> <tutorials> </tutorials> diff --git a/doc/classes/RayCast.xml b/doc/classes/RayCast3D.xml index 65f632ba74..08c6d6f40c 100644 --- a/doc/classes/RayCast.xml +++ b/doc/classes/RayCast3D.xml @@ -1,14 +1,14 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="RayCast" inherits="Spatial" version="4.0"> +<class name="RayCast3D" inherits="Node3D" version="4.0"> <brief_description> Query the closest object intersecting a ray. </brief_description> <description> A RayCast represents a line from its origin to its destination position, [code]cast_to[/code]. It is used to query the 3D space in order to find the closest object along the path of the ray. - RayCast can ignore some objects by adding them to the exception list via [code]add_exception[/code] or by setting proper filtering with collision layers and masks. - RayCast can be configured to report collisions with [Area]s ([member collide_with_areas]) and/or [PhysicsBody]s ([member collide_with_bodies]). + RayCast3D can ignore some objects by adding them to the exception list via [code]add_exception[/code] or by setting proper filtering with collision layers and masks. + RayCast3D can be configured to report collisions with [Area3D]s ([member collide_with_areas]) and/or [PhysicsBody3D]s ([member collide_with_bodies]). Only enabled raycasts will be able to query the space and report collisions. - RayCast calculates intersection every physics frame (see [Node]), and the result is cached so it can be used later until the next frame. If multiple queries are required between physics frames (or during the same frame), use [method force_raycast_update] after adjusting the raycast. + RayCast3D calculates intersection every physics frame (see [Node]), and the result is cached so it can be used later until the next frame. If multiple queries are required between physics frames (or during the same frame), use [method force_raycast_update] after adjusting the raycast. </description> <tutorials> <link>https://docs.godotengine.org/en/latest/tutorials/physics/ray-casting.html</link> @@ -130,10 +130,10 @@ The ray's destination point, relative to the RayCast's [code]position[/code]. </member> <member name="collide_with_areas" type="bool" setter="set_collide_with_areas" getter="is_collide_with_areas_enabled" default="false"> - If [code]true[/code], collision with [Area]s will be reported. + If [code]true[/code], collision with [Area3D]s will be reported. </member> <member name="collide_with_bodies" type="bool" setter="set_collide_with_bodies" getter="is_collide_with_bodies_enabled" default="true"> - If [code]true[/code], collision with [PhysicsBody]s will be reported. + If [code]true[/code], collision with [PhysicsBody3D]s will be reported. </member> <member name="collision_mask" type="int" setter="set_collision_mask" getter="get_collision_mask" default="1"> The ray's collision mask. Only objects in at least one collision layer enabled in the mask will be detected. @@ -142,7 +142,7 @@ If [code]true[/code], collisions will be reported. </member> <member name="exclude_parent" type="bool" setter="set_exclude_parent_body" getter="get_exclude_parent_body" default="true"> - If [code]true[/code], collisions will be ignored for this RayCast's immediate parent. + If [code]true[/code], collisions will be ignored for this RayCast3D's immediate parent. </member> </members> <constants> diff --git a/doc/classes/RayShape.xml b/doc/classes/RayShape3D.xml index 87a642f779..9839044c30 100644 --- a/doc/classes/RayShape.xml +++ b/doc/classes/RayShape3D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="RayShape" inherits="Shape" version="4.0"> +<class name="RayShape3D" inherits="Shape3D" version="4.0"> <brief_description> Ray shape for 3D collisions. </brief_description> <description> - Ray shape for 3D collisions, which can be set into a [PhysicsBody] or [Area]. A ray is not really a collision body; instead, it tries to separate itself from whatever is touching its far endpoint. It's often useful for characters. + Ray shape for 3D collisions, which can be set into a [PhysicsBody3D] or [Area3D]. A ray is not really a collision body; instead, it tries to separate itself from whatever is touching its far endpoint. It's often useful for characters. </description> <tutorials> </tutorials> diff --git a/doc/classes/ReflectionProbe.xml b/doc/classes/ReflectionProbe.xml index e138af6841..84f87c3e71 100644 --- a/doc/classes/ReflectionProbe.xml +++ b/doc/classes/ReflectionProbe.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ReflectionProbe" inherits="VisualInstance" version="4.0"> +<class name="ReflectionProbe" inherits="VisualInstance3D" version="4.0"> <brief_description> Captures its surroundings to create reflections. </brief_description> @@ -17,7 +17,7 @@ If [code]true[/code], enables box projection. This makes reflections look more correct in rectangle-shaped rooms by offsetting the reflection center depending on the camera's location. </member> <member name="cull_mask" type="int" setter="set_cull_mask" getter="get_cull_mask" default="1048575"> - Sets the cull mask which determines what objects are drawn by this probe. Every [VisualInstance] with a layer included in this cull mask will be rendered by the probe. It is best to only include large objects which are likely to take up a lot of space in the reflection in order to save on rendering cost. + Sets the cull mask which determines what objects are drawn by this probe. Every [VisualInstance3D] with a layer included in this cull mask will be rendered by the probe. It is best to only include large objects which are likely to take up a lot of space in the reflection in order to save on rendering cost. </member> <member name="enable_shadows" type="bool" setter="set_enable_shadows" getter="are_shadows_enabled" default="false"> If [code]true[/code], computes shadows in the reflection probe. This makes the reflection probe slower to render; you may want to disable this if using the [constant UPDATE_ALWAYS] [member update_mode]. diff --git a/doc/classes/RemoteTransform.xml b/doc/classes/RemoteTransform3D.xml index feb6ac1841..bd3da2aea9 100644 --- a/doc/classes/RemoteTransform.xml +++ b/doc/classes/RemoteTransform3D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="RemoteTransform" inherits="Spatial" version="4.0"> +<class name="RemoteTransform3D" inherits="Node3D" version="4.0"> <brief_description> - RemoteTransform pushes its own [Transform] to another [Spatial] derived Node in the scene. + RemoteTransform3D pushes its own [Transform] to another [Node3D] derived Node in the scene. </brief_description> <description> - RemoteTransform pushes its own [Transform] to another [Spatial] derived Node (called the remote node) in the scene. + RemoteTransform3D pushes its own [Transform] to another [Node3D] derived Node (called the remote node) in the scene. It can be set to update another Node's position, rotation and/or scale. It can use either global or local coordinates. </description> <tutorials> @@ -14,13 +14,13 @@ <return type="void"> </return> <description> - [RemoteTransform] caches the remote node. It may not notice if the remote node disappears; [method force_update_cache] forces it to update the cache again. + [RemoteTransform3D] caches the remote node. It may not notice if the remote node disappears; [method force_update_cache] forces it to update the cache again. </description> </method> </methods> <members> <member name="remote_path" type="NodePath" setter="set_remote_node" getter="get_remote_node" default="NodePath("")"> - The [NodePath] to the remote node, relative to the RemoteTransform's position in the scene. + The [NodePath] to the remote node, relative to the RemoteTransform3D's position in the scene. </member> <member name="update_position" type="bool" setter="set_update_position" getter="get_update_position" default="true"> If [code]true[/code], the remote node's position is updated. diff --git a/doc/classes/VisualServer.xml b/doc/classes/RenderingServer.xml index 00e0b7cdc9..965d6bf175 100644 --- a/doc/classes/VisualServer.xml +++ b/doc/classes/RenderingServer.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisualServer" inherits="Object" version="4.0"> +<class name="RenderingServer" inherits="Object" version="4.0"> <brief_description> Server for anything visible. </brief_description> @@ -9,7 +9,7 @@ The visual server can be used to bypass the scene system entirely. Resources are created using the [code]*_create[/code] functions. All objects are drawn to a viewport. You can use the [Viewport] attached to the [SceneTree] or you can create one yourself with [method viewport_create]. When using a custom scenario or canvas, the scenario or canvas needs to be attached to the viewport using [method viewport_set_scenario] or [method viewport_attach_canvas]. - In 3D, all visual objects must be associated with a scenario. The scenario is a visual representation of the world. If accessing the visual server from a running game, the scenario can be accessed from the scene tree from any [Spatial] node with [method Spatial.get_world]. Otherwise, a scenario can be created with [method scenario_create]. + In 3D, all visual objects must be associated with a scenario. The scenario is a visual representation of the world. If accessing the visual server from a running game, the scenario can be accessed from the scene tree from any [Node3D] node with [method Node3D.get_world]. Otherwise, a scenario can be created with [method scenario_create]. Similarly in 2D, a canvas is needed to draw all canvas items. In 3D, all visible objects are comprised of a resource and an instance. A resource can be a mesh, a particle system, a light, or any other 3D object. In order to be visible resources must be attached to an instance using [method instance_set_base]. The instance must also be attached to the scenario using [method instance_set_scenario] in order to be visible. In 2D, all visible objects are some form of canvas item. In order to be visible, a canvas item needs to be the child of a canvas attached to a viewport, or it needs to be the child of another canvas item that is eventually attached to the canvas. @@ -52,8 +52,8 @@ <return type="RID"> </return> <description> - Creates a camera and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all [code]camera_*[/code] VisualServer functions. - Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method. + Creates a camera and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]camera_*[/code] RenderingServer functions. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method. </description> </method> <method name="camera_set_cull_mask"> @@ -64,7 +64,7 @@ <argument index="1" name="layers" type="int"> </argument> <description> - Sets the cull mask associated with this camera. The cull mask describes which 3D layers are rendered by this camera. Equivalent to [member Camera.cull_mask]. + Sets the cull mask associated with this camera. The cull mask describes which 3D layers are rendered by this camera. Equivalent to [member Camera3D.cull_mask]. </description> </method> <method name="camera_set_environment"> @@ -75,7 +75,7 @@ <argument index="1" name="env" type="RID"> </argument> <description> - Sets the environment used by this camera. Equivalent to [member Camera.environment]. + Sets the environment used by this camera. Equivalent to [member Camera3D.environment]. </description> </method> <method name="camera_set_frustum"> @@ -144,15 +144,15 @@ <argument index="1" name="enable" type="bool"> </argument> <description> - If [code]true[/code], preserves the horizontal aspect ratio which is equivalent to [constant Camera.KEEP_WIDTH]. If [code]false[/code], preserves the vertical aspect ratio which is equivalent to [constant Camera.KEEP_HEIGHT]. + If [code]true[/code], preserves the horizontal aspect ratio which is equivalent to [constant Camera3D.KEEP_WIDTH]. If [code]false[/code], preserves the vertical aspect ratio which is equivalent to [constant Camera3D.KEEP_HEIGHT]. </description> </method> <method name="canvas_create"> <return type="RID"> </return> <description> - Creates a canvas and returns the assigned [RID]. It can be accessed with the RID that is returned. This RID will be used in all [code]canvas_*[/code] VisualServer functions. - Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method. + Creates a canvas and returns the assigned [RID]. It can be accessed with the RID that is returned. This RID will be used in all [code]canvas_*[/code] RenderingServer functions. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method. </description> </method> <method name="canvas_item_clear"> @@ -247,8 +247,8 @@ <return type="RID"> </return> <description> - Creates a canvas light and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all [code]canvas_light_*[/code] VisualServer functions. - Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method. + Creates a canvas light and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]canvas_light_*[/code] RenderingServer functions. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method. </description> </method> <method name="canvas_light_occluder_attach_to_canvas"> @@ -266,8 +266,8 @@ <return type="RID"> </return> <description> - Creates a light occluder and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all [code]canvas_light_ocluder_*[/code] VisualServer functions. - Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method. + Creates a light occluder and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]canvas_light_ocluder_*[/code] RenderingServer functions. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method. </description> </method> <method name="canvas_light_occluder_set_enabled"> @@ -398,7 +398,7 @@ </return> <argument index="0" name="light" type="RID"> </argument> - <argument index="1" name="mode" type="int" enum="VisualServer.CanvasLightMode"> + <argument index="1" name="mode" type="int" enum="RenderingServer.CanvasLightMode"> </argument> <description> The mode of the light, see [enum CanvasLightMode] constants. @@ -453,7 +453,7 @@ </return> <argument index="0" name="light" type="RID"> </argument> - <argument index="1" name="filter" type="int" enum="VisualServer.CanvasLightShadowFilter"> + <argument index="1" name="filter" type="int" enum="RenderingServer.CanvasLightShadowFilter"> </argument> <description> Sets the canvas light's shadow's filter, see [enum CanvasLightShadowFilter] constants. @@ -520,8 +520,8 @@ <return type="RID"> </return> <description> - Creates a new light occluder polygon and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all [code]canvas_occluder_polygon_*[/code] VisualServer functions. - Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method. + Creates a new light occluder polygon and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]canvas_occluder_polygon_*[/code] RenderingServer functions. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method. </description> </method> <method name="canvas_occluder_polygon_set_cull_mode"> @@ -529,7 +529,7 @@ </return> <argument index="0" name="occluder_polygon" type="RID"> </argument> - <argument index="1" name="mode" type="int" enum="VisualServer.CanvasOccluderPolygonCullMode"> + <argument index="1" name="mode" type="int" enum="RenderingServer.CanvasOccluderPolygonCullMode"> </argument> <description> Sets an occluder polygons cull mode. See [enum CanvasOccluderPolygonCullMode] constants. @@ -587,8 +587,8 @@ <return type="RID"> </return> <description> - Creates a directional light and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID can be used in most [code]light_*[/code] VisualServer functions. - Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method. + Creates a directional light and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID can be used in most [code]light_*[/code] RenderingServer functions. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method. To place in a scene, attach this directional light to an instance using [method instance_set_base] using the returned RID. </description> </method> @@ -596,8 +596,8 @@ <return type="RID"> </return> <description> - Creates an environment and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all [code]environment_*[/code] VisualServer functions. - Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method. + Creates an environment and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]environment_*[/code] RenderingServer functions. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method. </description> </method> <method name="environment_set_adjustment"> @@ -626,13 +626,13 @@ </argument> <argument index="1" name="color" type="Color"> </argument> - <argument index="2" name="ambient" type="int" enum="VisualServer.EnvironmentAmbientSource" default="0"> + <argument index="2" name="ambient" type="int" enum="RenderingServer.EnvironmentAmbientSource" default="0"> </argument> <argument index="3" name="energy" type="float" default="1.0"> </argument> <argument index="4" name="sky_contibution" type="float" default="0.0"> </argument> - <argument index="5" name="reflection_source" type="int" enum="VisualServer.EnvironmentReflectionSource" default="0"> + <argument index="5" name="reflection_source" type="int" enum="RenderingServer.EnvironmentReflectionSource" default="0"> </argument> <argument index="6" name="ao_color" type="Color" default="Color( 0, 0, 0, 1 )"> </argument> @@ -644,7 +644,7 @@ </return> <argument index="0" name="env" type="RID"> </argument> - <argument index="1" name="bg" type="int" enum="VisualServer.EnvironmentBG"> + <argument index="1" name="bg" type="int" enum="RenderingServer.EnvironmentBG"> </argument> <description> Sets the [i]BGMode[/i] of the environment. Equivalent to [member Environment.background_mode]. @@ -755,7 +755,7 @@ </argument> <argument index="6" name="bloom_threshold" type="float"> </argument> - <argument index="7" name="blend_mode" type="int" enum="VisualServer.EnvironmentGlowBlendMode"> + <argument index="7" name="blend_mode" type="int" enum="RenderingServer.EnvironmentGlowBlendMode"> </argument> <argument index="8" name="hdr_bleed_threshold" type="float"> </argument> @@ -763,8 +763,6 @@ </argument> <argument index="10" name="hdr_luminance_cap" type="float"> </argument> - <argument index="11" name="bicubic_upscale" type="bool"> - </argument> <description> </description> </method> @@ -818,7 +816,7 @@ </argument> <argument index="6" name="ao_channel_affect" type="float"> </argument> - <argument index="7" name="blur" type="int" enum="VisualServer.EnvironmentSSAOBlur"> + <argument index="7" name="blur" type="int" enum="RenderingServer.EnvironmentSSAOBlur"> </argument> <argument index="8" name="bilateral_sharpness" type="float"> </argument> @@ -851,7 +849,7 @@ </return> <argument index="0" name="env" type="RID"> </argument> - <argument index="1" name="tone_mapper" type="int" enum="VisualServer.EnvironmentToneMapper"> + <argument index="1" name="tone_mapper" type="int" enum="RenderingServer.EnvironmentToneMapper"> </argument> <argument index="2" name="exposure" type="float"> </argument> @@ -902,13 +900,13 @@ <argument index="0" name="rid" type="RID"> </argument> <description> - Tries to free an object in the VisualServer. + Tries to free an object in the RenderingServer. </description> </method> <method name="get_render_info"> <return type="int"> </return> - <argument index="0" name="info" type="int" enum="VisualServer.RenderInfo"> + <argument index="0" name="info" type="int" enum="RenderingServer.RenderInfo"> </argument> <description> Returns a certain information, see [enum RenderInfo] for options. @@ -955,13 +953,13 @@ <return type="bool"> </return> <description> - Returns [code]true[/code] if changes have been made to the VisualServer's data. [method force_draw] is usually called if this happens. + Returns [code]true[/code] if changes have been made to the RenderingServer's data. [method force_draw] is usually called if this happens. </description> </method> <method name="has_feature" qualifiers="const"> <return type="bool"> </return> - <argument index="0" name="feature" type="int" enum="VisualServer.Features"> + <argument index="0" name="feature" type="int" enum="RenderingServer.Features"> </argument> <description> Not yet implemented. Always returns [code]false[/code]. @@ -981,12 +979,12 @@ </return> <argument index="0" name="immediate" type="RID"> </argument> - <argument index="1" name="primitive" type="int" enum="VisualServer.PrimitiveType"> + <argument index="1" name="primitive" type="int" enum="RenderingServer.PrimitiveType"> </argument> <argument index="2" name="texture" type="RID"> </argument> <description> - Sets up [ImmediateGeometry] internals to prepare for drawing. Equivalent to [method ImmediateGeometry.begin]. + Sets up [ImmediateGeometry3D] internals to prepare for drawing. Equivalent to [method ImmediateGeometry3D.begin]. </description> </method> <method name="immediate_clear"> @@ -995,7 +993,7 @@ <argument index="0" name="immediate" type="RID"> </argument> <description> - Clears everything that was set up between [method immediate_begin] and [method immediate_end]. Equivalent to [method ImmediateGeometry.clear]. + Clears everything that was set up between [method immediate_begin] and [method immediate_end]. Equivalent to [method ImmediateGeometry3D.clear]. </description> </method> <method name="immediate_color"> @@ -1006,15 +1004,15 @@ <argument index="1" name="color" type="Color"> </argument> <description> - Sets the color to be used with next vertex. Equivalent to [method ImmediateGeometry.set_color]. + Sets the color to be used with next vertex. Equivalent to [method ImmediateGeometry3D.set_color]. </description> </method> <method name="immediate_create"> <return type="RID"> </return> <description> - Creates an immediate geometry and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all [code]immediate_*[/code] VisualServer functions. - Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method. + Creates an immediate geometry and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]immediate_*[/code] RenderingServer functions. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method. To place in a scene, attach this immediate geometry to an instance using [method instance_set_base] using the returned RID. </description> </method> @@ -1024,7 +1022,7 @@ <argument index="0" name="immediate" type="RID"> </argument> <description> - Ends drawing the [ImmediateGeometry] and displays it. Equivalent to [method ImmediateGeometry.end]. + Ends drawing the [ImmediateGeometry3D] and displays it. Equivalent to [method ImmediateGeometry3D.end]. </description> </method> <method name="immediate_get_material" qualifiers="const"> @@ -1033,7 +1031,7 @@ <argument index="0" name="immediate" type="RID"> </argument> <description> - Returns the material assigned to the [ImmediateGeometry]. + Returns the material assigned to the [ImmediateGeometry3D]. </description> </method> <method name="immediate_normal"> @@ -1044,7 +1042,7 @@ <argument index="1" name="normal" type="Vector3"> </argument> <description> - Sets the normal to be used with next vertex. Equivalent to [method ImmediateGeometry.set_normal]. + Sets the normal to be used with next vertex. Equivalent to [method ImmediateGeometry3D.set_normal]. </description> </method> <method name="immediate_set_material"> @@ -1055,7 +1053,7 @@ <argument index="1" name="material" type="RID"> </argument> <description> - Sets the material to be used to draw the [ImmediateGeometry]. + Sets the material to be used to draw the [ImmediateGeometry3D]. </description> </method> <method name="immediate_tangent"> @@ -1066,7 +1064,7 @@ <argument index="1" name="tangent" type="Plane"> </argument> <description> - Sets the tangent to be used with next vertex. Equivalent to [method ImmediateGeometry.set_tangent]. + Sets the tangent to be used with next vertex. Equivalent to [method ImmediateGeometry3D.set_tangent]. </description> </method> <method name="immediate_uv"> @@ -1077,7 +1075,7 @@ <argument index="1" name="tex_uv" type="Vector2"> </argument> <description> - Sets the UV to be used with next vertex. Equivalent to [method ImmediateGeometry.set_uv]. + Sets the UV to be used with next vertex. Equivalent to [method ImmediateGeometry3D.set_uv]. </description> </method> <method name="immediate_uv2"> @@ -1088,7 +1086,7 @@ <argument index="1" name="tex_uv" type="Vector2"> </argument> <description> - Sets the UV2 to be used with next vertex. Equivalent to [method ImmediateGeometry.set_uv2]. + Sets the UV2 to be used with next vertex. Equivalent to [method ImmediateGeometry3D.set_uv2]. </description> </method> <method name="immediate_vertex"> @@ -1099,7 +1097,7 @@ <argument index="1" name="vertex" type="Vector3"> </argument> <description> - Adds the next vertex using the information provided in advance. Equivalent to [method ImmediateGeometry.add_vertex]. + Adds the next vertex using the information provided in advance. Equivalent to [method ImmediateGeometry3D.add_vertex]. </description> </method> <method name="immediate_vertex_2d"> @@ -1110,7 +1108,7 @@ <argument index="1" name="vertex" type="Vector2"> </argument> <description> - Adds the next vertex using the information provided in advance. This is a helper class that calls [method immediate_vertex] under the hood. Equivalent to [method ImmediateGeometry.add_vertex]. + Adds the next vertex using the information provided in advance. This is a helper class that calls [method immediate_vertex] under the hood. Equivalent to [method ImmediateGeometry3D.add_vertex]. </description> </method> <method name="init"> @@ -1146,8 +1144,8 @@ <return type="RID"> </return> <description> - Creates a visual instance and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all [code]instance_*[/code] VisualServer functions. - Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method. + Creates a visual instance and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]instance_*[/code] RenderingServer functions. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method. An instance is a way of placing a 3D object in the scenario. Objects like particles, meshes, and reflection probes need to be associated with an instance to be visible in the scenario using [method instance_set_base]. </description> </method> @@ -1159,8 +1157,8 @@ <argument index="1" name="scenario" type="RID"> </argument> <description> - Creates a visual instance, adds it to the VisualServer, and sets both base and scenario. It can be accessed with the RID that is returned. This RID will be used in all [code]instance_*[/code] VisualServer functions. - Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method. + Creates a visual instance, adds it to the RenderingServer, and sets both base and scenario. It can be accessed with the RID that is returned. This RID will be used in all [code]instance_*[/code] RenderingServer functions. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method. </description> </method> <method name="instance_geometry_set_as_instance_lod"> @@ -1179,10 +1177,10 @@ </return> <argument index="0" name="instance" type="RID"> </argument> - <argument index="1" name="shadow_casting_setting" type="int" enum="VisualServer.ShadowCastingSetting"> + <argument index="1" name="shadow_casting_setting" type="int" enum="RenderingServer.ShadowCastingSetting"> </argument> <description> - Sets the shadow casting setting to one of [enum ShadowCastingSetting]. Equivalent to [member GeometryInstance.cast_shadow]. + Sets the shadow casting setting to one of [enum ShadowCastingSetting]. Equivalent to [member GeometryInstance3D.cast_shadow]. </description> </method> <method name="instance_geometry_set_draw_range"> @@ -1207,7 +1205,7 @@ </return> <argument index="0" name="instance" type="RID"> </argument> - <argument index="1" name="flag" type="int" enum="VisualServer.InstanceFlags"> + <argument index="1" name="flag" type="int" enum="RenderingServer.InstanceFlags"> </argument> <argument index="2" name="enabled" type="bool"> </argument> @@ -1223,7 +1221,7 @@ <argument index="1" name="material" type="RID"> </argument> <description> - Sets a material that will override the material for all surfaces on the mesh associated with this instance. Equivalent to [member GeometryInstance.material_override]. + Sets a material that will override the material for all surfaces on the mesh associated with this instance. Equivalent to [member GeometryInstance3D.material_override]. </description> </method> <method name="instance_set_base"> @@ -1234,7 +1232,7 @@ <argument index="1" name="base" type="RID"> </argument> <description> - Sets the base of the instance. A base can be any of the 3D objects that are created in the VisualServer that can be displayed. For example, any of the light types, mesh, multimesh, immediate geometry, particle system, reflection probe, lightmap capture, and the GI probe are all types that can be set as the base of an instance in order to be displayed in the scenario. + Sets the base of the instance. A base can be any of the 3D objects that are created in the RenderingServer that can be displayed. For example, any of the light types, mesh, multimesh, immediate geometry, particle system, reflection probe, lightmap capture, and the GI probe are all types that can be set as the base of an instance in order to be displayed in the scenario. </description> </method> <method name="instance_set_blend_shape_weight"> @@ -1258,7 +1256,7 @@ <argument index="1" name="aabb" type="AABB"> </argument> <description> - Sets a custom AABB to use when culling objects from the view frustum. Equivalent to [method GeometryInstance.set_custom_aabb]. + Sets a custom AABB to use when culling objects from the view frustum. Equivalent to [method GeometryInstance3D.set_custom_aabb]. </description> </method> <method name="instance_set_exterior"> @@ -1280,7 +1278,7 @@ <argument index="1" name="margin" type="float"> </argument> <description> - Sets a margin to increase the size of the AABB when culling objects from the view frustum. This allows you avoid culling objects that fall outside the view frustum. Equivalent to [member GeometryInstance.extra_cull_margin]. + Sets a margin to increase the size of the AABB when culling objects from the view frustum. This allows you avoid culling objects that fall outside the view frustum. Equivalent to [member GeometryInstance3D.extra_cull_margin]. </description> </method> <method name="instance_set_layer_mask"> @@ -1291,7 +1289,7 @@ <argument index="1" name="mask" type="int"> </argument> <description> - Sets the render layers that this instance will be drawn to. Equivalent to [member VisualInstance.layers]. + Sets the render layers that this instance will be drawn to. Equivalent to [member VisualInstance3D.layers]. </description> </method> <method name="instance_set_scenario"> @@ -1315,7 +1313,7 @@ <argument index="2" name="material" type="RID"> </argument> <description> - Sets the material of a specific surface. Equivalent to [method MeshInstance.set_surface_material]. + Sets the material of a specific surface. Equivalent to [method MeshInstance3D.set_surface_material]. </description> </method> <method name="instance_set_transform"> @@ -1326,7 +1324,7 @@ <argument index="1" name="transform" type="Transform"> </argument> <description> - Sets the world space transform of the instance. Equivalent to [member Spatial.transform]. + Sets the world space transform of the instance. Equivalent to [member Node3D.transform]. </description> </method> <method name="instance_set_use_lightmap"> @@ -1350,7 +1348,7 @@ <argument index="1" name="visible" type="bool"> </argument> <description> - Sets whether an instance is drawn or not. Equivalent to [member Spatial.visible]. + Sets whether an instance is drawn or not. Equivalent to [member Node3D.visible]. </description> </method> <method name="instances_cull_aabb" qualifiers="const"> @@ -1361,7 +1359,7 @@ <argument index="1" name="scenario" type="RID"> </argument> <description> - Returns an array of object IDs intersecting with the provided AABB. Only visual 3D nodes are considered, such as [MeshInstance] or [DirectionalLight]. Use [method @GDScript.instance_from_id] to obtain the actual nodes. A scenario RID must be provided, which is available in the [World] you want to query. This forces an update for all resources queued to update. + Returns an array of object IDs intersecting with the provided AABB. Only visual 3D nodes are considered, such as [MeshInstance3D] or [DirectionalLight3D]. Use [method @GDScript.instance_from_id] to obtain the actual nodes. A scenario RID must be provided, which is available in the [World3D] you want to query. This forces an update for all resources queued to update. [b]Warning:[/b] This function is primarily intended for editor usage. For in-game use cases, prefer physics collision. </description> </method> @@ -1373,7 +1371,7 @@ <argument index="1" name="scenario" type="RID"> </argument> <description> - Returns an array of object IDs intersecting with the provided convex shape. Only visual 3D nodes are considered, such as [MeshInstance] or [DirectionalLight]. Use [method @GDScript.instance_from_id] to obtain the actual nodes. A scenario RID must be provided, which is available in the [World] you want to query. This forces an update for all resources queued to update. + Returns an array of object IDs intersecting with the provided convex shape. Only visual 3D nodes are considered, such as [MeshInstance3D] or [DirectionalLight3D]. Use [method @GDScript.instance_from_id] to obtain the actual nodes. A scenario RID must be provided, which is available in the [World3D] you want to query. This forces an update for all resources queued to update. [b]Warning:[/b] This function is primarily intended for editor usage. For in-game use cases, prefer physics collision. </description> </method> @@ -1387,7 +1385,7 @@ <argument index="2" name="scenario" type="RID"> </argument> <description> - Returns an array of object IDs intersecting with the provided 3D ray. Only visual 3D nodes are considered, such as [MeshInstance] or [DirectionalLight]. Use [method @GDScript.instance_from_id] to obtain the actual nodes. A scenario RID must be provided, which is available in the [World] you want to query. This forces an update for all resources queued to update. + Returns an array of object IDs intersecting with the provided 3D ray. Only visual 3D nodes are considered, such as [MeshInstance3D] or [DirectionalLight3D]. Use [method @GDScript.instance_from_id] to obtain the actual nodes. A scenario RID must be provided, which is available in the [World3D] you want to query. This forces an update for all resources queued to update. [b]Warning:[/b] This function is primarily intended for editor usage. For in-game use cases, prefer physics collision. </description> </method> @@ -1399,7 +1397,7 @@ <argument index="1" name="enable" type="bool"> </argument> <description> - If [code]true[/code], this directional light will blend between shadow map splits resulting in a smoother transition between them. Equivalent to [member DirectionalLight.directional_shadow_blend_splits]. + If [code]true[/code], this directional light will blend between shadow map splits resulting in a smoother transition between them. Equivalent to [member DirectionalLight3D.directional_shadow_blend_splits]. </description> </method> <method name="light_directional_set_shadow_depth_range_mode"> @@ -1407,10 +1405,10 @@ </return> <argument index="0" name="light" type="RID"> </argument> - <argument index="1" name="range_mode" type="int" enum="VisualServer.LightDirectionalShadowDepthRangeMode"> + <argument index="1" name="range_mode" type="int" enum="RenderingServer.LightDirectionalShadowDepthRangeMode"> </argument> <description> - Sets the shadow depth range mode for this directional light. Equivalent to [member DirectionalLight.directional_shadow_depth_range]. See [enum LightDirectionalShadowDepthRangeMode] for options. + Sets the shadow depth range mode for this directional light. Equivalent to [member DirectionalLight3D.directional_shadow_depth_range]. See [enum LightDirectionalShadowDepthRangeMode] for options. </description> </method> <method name="light_directional_set_shadow_mode"> @@ -1418,10 +1416,10 @@ </return> <argument index="0" name="light" type="RID"> </argument> - <argument index="1" name="mode" type="int" enum="VisualServer.LightDirectionalShadowMode"> + <argument index="1" name="mode" type="int" enum="RenderingServer.LightDirectionalShadowMode"> </argument> <description> - Sets the shadow mode for this directional light. Equivalent to [member DirectionalLight.directional_shadow_mode]. See [enum LightDirectionalShadowMode] for options. + Sets the shadow mode for this directional light. Equivalent to [member DirectionalLight3D.directional_shadow_mode]. See [enum LightDirectionalShadowMode] for options. </description> </method> <method name="light_omni_set_shadow_mode"> @@ -1429,10 +1427,10 @@ </return> <argument index="0" name="light" type="RID"> </argument> - <argument index="1" name="mode" type="int" enum="VisualServer.LightOmniShadowMode"> + <argument index="1" name="mode" type="int" enum="RenderingServer.LightOmniShadowMode"> </argument> <description> - Sets whether to use a dual paraboloid or a cubemap for the shadow map. Dual paraboloid is faster but may suffer from artifacts. Equivalent to [member OmniLight.omni_shadow_mode]. + Sets whether to use a dual paraboloid or a cubemap for the shadow map. Dual paraboloid is faster but may suffer from artifacts. Equivalent to [member OmniLight3D.omni_shadow_mode]. </description> </method> <method name="light_set_color"> @@ -1443,7 +1441,7 @@ <argument index="1" name="color" type="Color"> </argument> <description> - Sets the color of the light. Equivalent to [member Light.light_color]. + Sets the color of the light. Equivalent to [member Light3D.light_color]. </description> </method> <method name="light_set_cull_mask"> @@ -1454,7 +1452,7 @@ <argument index="1" name="mask" type="int"> </argument> <description> - Sets the cull mask for this Light. Lights only affect objects in the selected layers. Equivalent to [member Light.light_cull_mask]. + Sets the cull mask for this Light3D. Lights only affect objects in the selected layers. Equivalent to [member Light3D.light_cull_mask]. </description> </method> <method name="light_set_negative"> @@ -1465,7 +1463,7 @@ <argument index="1" name="enable" type="bool"> </argument> <description> - If [code]true[/code], light will subtract light instead of adding light. Equivalent to [member Light.light_negative]. + If [code]true[/code], light will subtract light instead of adding light. Equivalent to [member Light3D.light_negative]. </description> </method> <method name="light_set_param"> @@ -1473,12 +1471,12 @@ </return> <argument index="0" name="light" type="RID"> </argument> - <argument index="1" name="param" type="int" enum="VisualServer.LightParam"> + <argument index="1" name="param" type="int" enum="RenderingServer.LightParam"> </argument> <argument index="2" name="value" type="float"> </argument> <description> - Sets the specified light parameter. See [enum LightParam] for options. Equivalent to [method Light.set_param]. + Sets the specified light parameter. See [enum LightParam] for options. Equivalent to [method Light3D.set_param]. </description> </method> <method name="light_set_projector"> @@ -1500,7 +1498,7 @@ <argument index="1" name="enabled" type="bool"> </argument> <description> - If [code]true[/code], reverses the backface culling of the mesh. This can be useful when you have a flat mesh that has a light behind it. If you need to cast a shadow on both sides of the mesh, set the mesh to use double sided shadows with [method instance_geometry_set_cast_shadows_setting]. Equivalent to [member Light.shadow_reverse_cull_face]. + If [code]true[/code], reverses the backface culling of the mesh. This can be useful when you have a flat mesh that has a light behind it. If you need to cast a shadow on both sides of the mesh, set the mesh to use double sided shadows with [method instance_geometry_set_cast_shadows_setting]. Equivalent to [member Light3D.shadow_reverse_cull_face]. </description> </method> <method name="light_set_shadow"> @@ -1511,7 +1509,7 @@ <argument index="1" name="enabled" type="bool"> </argument> <description> - If [code]true[/code], light will cast shadows. Equivalent to [member Light.shadow_enabled]. + If [code]true[/code], light will cast shadows. Equivalent to [member Light3D.shadow_enabled]. </description> </method> <method name="light_set_shadow_color"> @@ -1522,7 +1520,7 @@ <argument index="1" name="color" type="Color"> </argument> <description> - Sets the color of the shadow cast by the light. Equivalent to [member Light.shadow_color]. + Sets the color of the shadow cast by the light. Equivalent to [member Light3D.shadow_color]. </description> </method> <method name="light_set_use_gi"> @@ -1540,8 +1538,8 @@ <return type="RID"> </return> <description> - Creates a lightmap capture and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all [code]lightmap_capture_*[/code] VisualServer functions. - Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method. + Creates a lightmap capture and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]lightmap_capture_*[/code] RenderingServer functions. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method. To place in a scene, attach this lightmap capture to an instance using [method instance_set_base] using the returned RID. </description> </method> @@ -1662,8 +1660,8 @@ <return type="RID"> </return> <description> - Creates an empty material and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all [code]material_*[/code] VisualServer functions. - Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method. + Creates an empty material and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]material_*[/code] RenderingServer functions. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method. </description> </method> <method name="material_get_param" qualifiers="const"> @@ -1728,7 +1726,7 @@ </return> <argument index="0" name="mesh" type="RID"> </argument> - <argument index="1" name="primitive" type="int" enum="VisualServer.PrimitiveType"> + <argument index="1" name="primitive" type="int" enum="RenderingServer.PrimitiveType"> </argument> <argument index="2" name="arrays" type="Array"> </argument> @@ -1756,8 +1754,8 @@ <return type="RID"> </return> <description> - Creates a new mesh and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all [code]mesh_*[/code] VisualServer functions. - Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method. + Creates a new mesh and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]mesh_*[/code] RenderingServer functions. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method. To place in a scene, attach this mesh to an instance using [method instance_set_base] using the returned RID. </description> </method> @@ -1771,7 +1769,7 @@ </description> </method> <method name="mesh_get_blend_shape_mode" qualifiers="const"> - <return type="int" enum="VisualServer.BlendShapeMode"> + <return type="int" enum="RenderingServer.BlendShapeMode"> </return> <argument index="0" name="mesh" type="RID"> </argument> @@ -1802,7 +1800,7 @@ </return> <argument index="0" name="mesh" type="RID"> </argument> - <argument index="1" name="mode" type="int" enum="VisualServer.BlendShapeMode"> + <argument index="1" name="mode" type="int" enum="RenderingServer.BlendShapeMode"> </argument> <description> Sets a mesh's blend shape mode. @@ -1915,7 +1913,7 @@ </argument> <argument index="1" name="instances" type="int"> </argument> - <argument index="2" name="transform_format" type="int" enum="VisualServer.MultimeshTransformFormat"> + <argument index="2" name="transform_format" type="int" enum="RenderingServer.MultimeshTransformFormat"> </argument> <argument index="3" name="color_format" type="bool" default="false"> </argument> @@ -1928,8 +1926,8 @@ <return type="RID"> </return> <description> - Creates a new multimesh on the VisualServer and returns an [RID] handle. This RID will be used in all [code]multimesh_*[/code] VisualServer functions. - Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method. + Creates a new multimesh on the RenderingServer and returns an [RID] handle. This RID will be used in all [code]multimesh_*[/code] RenderingServer functions. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method. To place in a scene, attach this multimesh to an instance using [method instance_set_base] using the returned RID. </description> </method> @@ -2109,8 +2107,8 @@ <return type="RID"> </return> <description> - Creates a new omni light and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID can be used in most [code]light_*[/code] VisualServer functions. - Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method. + Creates a new omni light and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID can be used in most [code]light_*[/code] RenderingServer functions. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method. To place in a scene, attach this omni light to an instance using [method instance_set_base] using the returned RID. </description> </method> @@ -2118,8 +2116,8 @@ <return type="RID"> </return> <description> - Creates a particle system and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all [code]particles_*[/code] VisualServer functions. - Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method. + Creates a particle system and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]particles_*[/code] RenderingServer functions. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method. To place in a scene, attach these particles to an instance using [method instance_set_base] using the returned RID. </description> </method> @@ -2129,7 +2127,7 @@ <argument index="0" name="particles" type="RID"> </argument> <description> - Calculates and returns the axis-aligned bounding box that contains all the particles. Equivalent to [method Particles.capture_aabb]. + Calculates and returns the axis-aligned bounding box that contains all the particles. Equivalent to [method GPUParticles3D.capture_aabb]. </description> </method> <method name="particles_get_emitting"> @@ -2165,7 +2163,7 @@ <argument index="0" name="particles" type="RID"> </argument> <description> - Reset the particles on the next update. Equivalent to [method Particles.restart]. + Reset the particles on the next update. Equivalent to [method GPUParticles3D.restart]. </description> </method> <method name="particles_set_amount"> @@ -2176,7 +2174,7 @@ <argument index="1" name="amount" type="int"> </argument> <description> - Sets the number of particles to be drawn and allocates the memory for them. Equivalent to [member Particles.amount]. + Sets the number of particles to be drawn and allocates the memory for them. Equivalent to [member GPUParticles3D.amount]. </description> </method> <method name="particles_set_custom_aabb"> @@ -2187,7 +2185,7 @@ <argument index="1" name="aabb" type="AABB"> </argument> <description> - Sets a custom axis-aligned bounding box for the particle system. Equivalent to [member Particles.visibility_aabb]. + Sets a custom axis-aligned bounding box for the particle system. Equivalent to [member GPUParticles3D.visibility_aabb]. </description> </method> <method name="particles_set_draw_order"> @@ -2195,10 +2193,10 @@ </return> <argument index="0" name="particles" type="RID"> </argument> - <argument index="1" name="order" type="int" enum="VisualServer.ParticlesDrawOrder"> + <argument index="1" name="order" type="int" enum="RenderingServer.ParticlesDrawOrder"> </argument> <description> - Sets the draw order of the particles to one of the named enums from [enum ParticlesDrawOrder]. See [enum ParticlesDrawOrder] for options. Equivalent to [member Particles.draw_order]. + Sets the draw order of the particles to one of the named enums from [enum ParticlesDrawOrder]. See [enum ParticlesDrawOrder] for options. Equivalent to [member GPUParticles3D.draw_order]. </description> </method> <method name="particles_set_draw_pass_mesh"> @@ -2211,7 +2209,7 @@ <argument index="2" name="mesh" type="RID"> </argument> <description> - Sets the mesh to be used for the specified draw pass. Equivalent to [member Particles.draw_pass_1], [member Particles.draw_pass_2], [member Particles.draw_pass_3], and [member Particles.draw_pass_4]. + Sets the mesh to be used for the specified draw pass. Equivalent to [member GPUParticles3D.draw_pass_1], [member GPUParticles3D.draw_pass_2], [member GPUParticles3D.draw_pass_3], and [member GPUParticles3D.draw_pass_4]. </description> </method> <method name="particles_set_draw_passes"> @@ -2222,7 +2220,7 @@ <argument index="1" name="count" type="int"> </argument> <description> - Sets the number of draw passes to use. Equivalent to [member Particles.draw_passes]. + Sets the number of draw passes to use. Equivalent to [member GPUParticles3D.draw_passes]. </description> </method> <method name="particles_set_emission_transform"> @@ -2244,7 +2242,7 @@ <argument index="1" name="emitting" type="bool"> </argument> <description> - If [code]true[/code], particles will emit over time. Setting to false does not reset the particles, but only stops their emission. Equivalent to [member Particles.emitting]. + If [code]true[/code], particles will emit over time. Setting to false does not reset the particles, but only stops their emission. Equivalent to [member GPUParticles3D.emitting]. </description> </method> <method name="particles_set_explosiveness_ratio"> @@ -2255,7 +2253,7 @@ <argument index="1" name="ratio" type="float"> </argument> <description> - Sets the explosiveness ratio. Equivalent to [member Particles.explosiveness]. + Sets the explosiveness ratio. Equivalent to [member GPUParticles3D.explosiveness]. </description> </method> <method name="particles_set_fixed_fps"> @@ -2266,7 +2264,7 @@ <argument index="1" name="fps" type="int"> </argument> <description> - Sets the frame rate that the particle system rendering will be fixed to. Equivalent to [member Particles.fixed_fps]. + Sets the frame rate that the particle system rendering will be fixed to. Equivalent to [member GPUParticles3D.fixed_fps]. </description> </method> <method name="particles_set_fractional_delta"> @@ -2277,7 +2275,7 @@ <argument index="1" name="enable" type="bool"> </argument> <description> - If [code]true[/code], uses fractional delta which smooths the movement of the particles. Equivalent to [member Particles.fract_delta]. + If [code]true[/code], uses fractional delta which smooths the movement of the particles. Equivalent to [member GPUParticles3D.fract_delta]. </description> </method> <method name="particles_set_lifetime"> @@ -2288,7 +2286,7 @@ <argument index="1" name="lifetime" type="float"> </argument> <description> - Sets the lifetime of each particle in the system. Equivalent to [member Particles.lifetime]. + Sets the lifetime of each particle in the system. Equivalent to [member GPUParticles3D.lifetime]. </description> </method> <method name="particles_set_one_shot"> @@ -2299,7 +2297,7 @@ <argument index="1" name="one_shot" type="bool"> </argument> <description> - If [code]true[/code], particles will emit once and then stop. Equivalent to [member Particles.one_shot]. + If [code]true[/code], particles will emit once and then stop. Equivalent to [member GPUParticles3D.one_shot]. </description> </method> <method name="particles_set_pre_process_time"> @@ -2310,7 +2308,7 @@ <argument index="1" name="time" type="float"> </argument> <description> - Sets the preprocess time for the particles animation. This lets you delay starting an animation until after the particles have begun emitting. Equivalent to [member Particles.preprocess]. + Sets the preprocess time for the particles animation. This lets you delay starting an animation until after the particles have begun emitting. Equivalent to [member GPUParticles3D.preprocess]. </description> </method> <method name="particles_set_process_material"> @@ -2321,7 +2319,7 @@ <argument index="1" name="material" type="RID"> </argument> <description> - Sets the material for processing the particles. Note: this is not the material used to draw the materials. Equivalent to [member Particles.process_material]. + Sets the material for processing the particles. Note: this is not the material used to draw the materials. Equivalent to [member GPUParticles3D.process_material]. </description> </method> <method name="particles_set_randomness_ratio"> @@ -2332,7 +2330,7 @@ <argument index="1" name="ratio" type="float"> </argument> <description> - Sets the emission randomness ratio. This randomizes the emission of particles within their phase. Equivalent to [member Particles.randomness]. + Sets the emission randomness ratio. This randomizes the emission of particles within their phase. Equivalent to [member GPUParticles3D.randomness]. </description> </method> <method name="particles_set_speed_scale"> @@ -2343,7 +2341,7 @@ <argument index="1" name="scale" type="float"> </argument> <description> - Sets the speed scale of the particle system. Equivalent to [member Particles.speed_scale]. + Sets the speed scale of the particle system. Equivalent to [member GPUParticles3D.speed_scale]. </description> </method> <method name="particles_set_use_local_coordinates"> @@ -2354,15 +2352,15 @@ <argument index="1" name="enable" type="bool"> </argument> <description> - If [code]true[/code], particles use local coordinates. If [code]false[/code] they use global coordinates. Equivalent to [member Particles.local_coords]. + If [code]true[/code], particles use local coordinates. If [code]false[/code] they use global coordinates. Equivalent to [member GPUParticles3D.local_coords]. </description> </method> <method name="reflection_probe_create"> <return type="RID"> </return> <description> - Creates a reflection probe and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all [code]reflection_probe_*[/code] VisualServer functions. - Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method. + Creates a reflection probe and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]reflection_probe_*[/code] RenderingServer functions. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method. To place in a scene, attach this reflection probe to an instance using [method instance_set_base] using the returned RID. </description> </method> @@ -2492,7 +2490,7 @@ </return> <argument index="0" name="probe" type="RID"> </argument> - <argument index="1" name="mode" type="int" enum="VisualServer.ReflectionProbeUpdateMode"> + <argument index="1" name="mode" type="int" enum="RenderingServer.ReflectionProbeUpdateMode"> </argument> <description> Sets how often the reflection probe updates. Can either be once or every frame. See [enum ReflectionProbeUpdateMode] for options. @@ -2516,8 +2514,8 @@ <return type="RID"> </return> <description> - Creates a scenario and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all [code]scenario_*[/code] VisualServer functions. - Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method. + Creates a scenario and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]scenario_*[/code] RenderingServer functions. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method. The scenario is the 3D world that all the visual instances exist in. </description> </method> @@ -2526,7 +2524,7 @@ </return> <argument index="0" name="scenario" type="RID"> </argument> - <argument index="1" name="debug_mode" type="int" enum="VisualServer.ScenarioDebugMode"> + <argument index="1" name="debug_mode" type="int" enum="RenderingServer.ScenarioDebugMode"> </argument> <description> Sets the [enum ScenarioDebugMode] for this scenario. See [enum ScenarioDebugMode] for options. @@ -2591,8 +2589,8 @@ <return type="RID"> </return> <description> - Creates an empty shader and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all [code]shader_*[/code] VisualServer functions. - Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method. + Creates an empty shader and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]shader_*[/code] RenderingServer functions. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method. </description> </method> <method name="shader_get_code" qualifiers="const"> @@ -2723,8 +2721,8 @@ <return type="RID"> </return> <description> - Creates a skeleton and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all [code]skeleton_*[/code] VisualServer functions. - Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method. + Creates a skeleton and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]skeleton_*[/code] RenderingServer functions. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method. </description> </method> <method name="skeleton_get_bone_count" qualifiers="const"> @@ -2740,8 +2738,8 @@ <return type="RID"> </return> <description> - Creates an empty sky and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all [code]sky_*[/code] VisualServer functions. - Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method. + Creates an empty sky and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]sky_*[/code] RenderingServer functions. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method. </description> </method> <method name="sky_set_material"> @@ -2759,8 +2757,8 @@ <return type="RID"> </return> <description> - Creates a spot light and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID can be used in most [code]light_*[/code] VisualServer functions. - Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method. + Creates a spot light and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID can be used in most [code]light_*[/code] RenderingServer functions. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method. To place in a scene, attach this spot light to an instance using [method instance_set_base] using the returned RID. </description> </method> @@ -2812,7 +2810,7 @@ <argument index="2" name="screen" type="int" default="0"> </argument> <description> - Copies viewport to a region of the screen specified by [code]rect[/code]. If [member Viewport.render_direct_to_screen] is [code]true[/code], then viewport does not use a framebuffer and the contents of the viewport are rendered directly to screen. However, note that the root viewport is drawn last, therefore it will draw over the screen. Accordingly, you must set the root viewport to an area that does not cover the area that you have attached this viewport to. + Copies the viewport to a region of the screen specified by [code]rect[/code]. If [method viewport_set_render_direct_to_screen] is [code]true[/code], then the viewport does not use a framebuffer and the contents of the viewport are rendered directly to screen. However, note that the root viewport is drawn last, therefore it will draw over the screen. Accordingly, you must set the root viewport to an area that does not cover the area that you have attached this viewport to. For example, you can set the root viewport to not render at all with the following code: [codeblock] func _ready(): @@ -2826,17 +2824,8 @@ <return type="RID"> </return> <description> - Creates an empty viewport and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all [code]viewport_*[/code] VisualServer functions. - Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method. - </description> - </method> - <method name="viewport_detach"> - <return type="void"> - </return> - <argument index="0" name="viewport" type="RID"> - </argument> - <description> - Detaches the viewport from the screen. + Creates an empty viewport and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]viewport_*[/code] RenderingServer functions. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method. </description> </method> <method name="viewport_get_render_info"> @@ -2844,7 +2833,7 @@ </return> <argument index="0" name="viewport" type="RID"> </argument> - <argument index="1" name="info" type="int" enum="VisualServer.ViewportRenderInfo"> + <argument index="1" name="info" type="int" enum="RenderingServer.ViewportRenderInfo"> </argument> <description> Returns a viewport's render information. For options, see the [enum ViewportRenderInfo] constants. @@ -2915,7 +2904,7 @@ </return> <argument index="0" name="viewport" type="RID"> </argument> - <argument index="1" name="clear_mode" type="int" enum="VisualServer.ViewportClearMode"> + <argument index="1" name="clear_mode" type="int" enum="RenderingServer.ViewportClearMode"> </argument> <description> Sets the clear mode of a viewport. See [enum ViewportClearMode] for options. @@ -2926,7 +2915,7 @@ </return> <argument index="0" name="viewport" type="RID"> </argument> - <argument index="1" name="draw" type="int" enum="VisualServer.ViewportDebugDraw"> + <argument index="1" name="draw" type="int" enum="RenderingServer.ViewportDebugDraw"> </argument> <description> Sets the debug draw mode of a viewport. See [enum ViewportDebugDraw] for options. @@ -2981,7 +2970,7 @@ </return> <argument index="0" name="viewport" type="RID"> </argument> - <argument index="1" name="msaa" type="int" enum="VisualServer.ViewportMSAA"> + <argument index="1" name="msaa" type="int" enum="RenderingServer.ViewportMSAA"> </argument> <description> Sets the anti-aliasing mode. See [enum ViewportMSAA] for options. @@ -3074,7 +3063,7 @@ </return> <argument index="0" name="viewport" type="RID"> </argument> - <argument index="1" name="update_mode" type="int" enum="VisualServer.ViewportUpdateMode"> + <argument index="1" name="update_mode" type="int" enum="RenderingServer.ViewportUpdateMode"> </argument> <description> Sets when the viewport should be updated. See [enum ViewportUpdateMode] constants for options. @@ -3095,12 +3084,12 @@ <signals> <signal name="frame_post_draw"> <description> - Emitted at the end of the frame, after the VisualServer has finished updating all the Viewports. + Emitted at the end of the frame, after the RenderingServer has finished updating all the Viewports. </description> </signal> <signal name="frame_pre_draw"> <description> - Emitted at the beginning of the frame, before the VisualServer updates all the Viewports. + Emitted at the beginning of the frame, before the RenderingServer updates all the Viewports. </description> </signal> </signals> @@ -3378,7 +3367,9 @@ <constant name="VIEWPORT_UPDATE_WHEN_VISIBLE" value="2" enum="ViewportUpdateMode"> Update the viewport whenever it is visible. </constant> - <constant name="VIEWPORT_UPDATE_ALWAYS" value="3" enum="ViewportUpdateMode"> + <constant name="VIEWPORT_UPDATE_WHEN_PARENT_VISIBLE" value="3" enum="ViewportUpdateMode"> + </constant> + <constant name="VIEWPORT_UPDATE_ALWAYS" value="4" enum="ViewportUpdateMode"> Always update the viewport. </constant> <constant name="VIEWPORT_CLEAR_ALWAYS" value="0" enum="ViewportClearMode"> diff --git a/doc/classes/RigidBody2D.xml b/doc/classes/RigidBody2D.xml index 79c4205f59..e746d7fc96 100644 --- a/doc/classes/RigidBody2D.xml +++ b/doc/classes/RigidBody2D.xml @@ -16,7 +16,7 @@ <method name="_integrate_forces" qualifiers="virtual"> <return type="void"> </return> - <argument index="0" name="state" type="Physics2DDirectBodyState"> + <argument index="0" name="state" type="PhysicsDirectBodyState2D"> </argument> <description> Allows you to read and safely modify the simulation state for the object. Use this instead of [method Node._physics_process] if you need to directly change the body's [code]position[/code] or other physics properties. By default, it works in addition to the usual physics behavior, but [member custom_integrator] allows you to disable the default behavior and write custom force integration for a body. @@ -106,10 +106,10 @@ </argument> <argument index="2" name="margin" type="float" default="0.08"> </argument> - <argument index="3" name="result" type="Physics2DTestMotionResult" default="null"> + <argument index="3" name="result" type="PhysicsTestMotionResult2D" default="null"> </argument> <description> - Returns [code]true[/code] if a collision would result from moving in the given vector. [code]margin[/code] increases the size of the shapes involved in the collision detection, and [code]result[/code] is an object of type [Physics2DTestMotionResult], which contains additional information about the collision (should there be one). + Returns [code]true[/code] if a collision would result from moving in the given vector. [code]margin[/code] increases the size of the shapes involved in the collision detection, and [code]result[/code] is an object of type [PhysicsTestMotionResult2D], which contains additional information about the collision (should there be one). </description> </method> </methods> diff --git a/doc/classes/RigidBody.xml b/doc/classes/RigidBody3D.xml index e2b7813361..829589f650 100644 --- a/doc/classes/RigidBody.xml +++ b/doc/classes/RigidBody3D.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="RigidBody" inherits="PhysicsBody" version="4.0"> +<class name="RigidBody3D" inherits="PhysicsBody3D" version="4.0"> <brief_description> Physics Body whose position is determined through physics simulation in 3D space. </brief_description> <description> - This is the node that implements full 3D physics. This means that you do not control a RigidBody directly. Instead, you can apply forces to it (gravity, impulses, etc.), and the physics simulation will calculate the resulting movement, collision, bouncing, rotating, etc. - A RigidBody has 4 behavior [member mode]s: Rigid, Static, Character, and Kinematic. - [b]Note:[/b] Don't change a RigidBody's position every frame or very often. Sporadic changes work fine, but physics runs at a different granularity (fixed Hz) than usual rendering (process callback) and maybe even in a separate thread, so changing this from a process loop may result in strange behavior. If you need to directly affect the body's state, use [method _integrate_forces], which allows you to directly access the physics state. + This is the node that implements full 3D physics. This means that you do not control a RigidBody3D directly. Instead, you can apply forces to it (gravity, impulses, etc.), and the physics simulation will calculate the resulting movement, collision, bouncing, rotating, etc. + A RigidBody3D has 4 behavior [member mode]s: Rigid, Static, Character, and Kinematic. + [b]Note:[/b] Don't change a RigidBody3D's position every frame or very often. Sporadic changes work fine, but physics runs at a different granularity (fixed Hz) than usual rendering (process callback) and maybe even in a separate thread, so changing this from a process loop may result in strange behavior. If you need to directly affect the body's state, use [method _integrate_forces], which allows you to directly access the physics state. If you need to override the default physics behavior, you can write a custom force integration function. See [member custom_integrator]. </description> <tutorials> @@ -16,7 +16,7 @@ <method name="_integrate_forces" qualifiers="virtual"> <return type="void"> </return> - <argument index="0" name="state" type="PhysicsDirectBodyState"> + <argument index="0" name="state" type="PhysicsDirectBodyState3D"> </argument> <description> Called during physics processing, allowing you to read and safely modify the simulation state for the object. By default, it works in addition to the usual physics behavior, but the [member custom_integrator] property allows you to disable the default behavior and do fully custom force integration for a body. @@ -85,7 +85,7 @@ <method name="get_axis_lock" qualifiers="const"> <return type="bool"> </return> - <argument index="0" name="axis" type="int" enum="PhysicsServer.BodyAxis"> + <argument index="0" name="axis" type="int" enum="PhysicsServer3D.BodyAxis"> </argument> <description> Returns [code]true[/code] if the specified linear or rotational axis is locked. @@ -102,7 +102,7 @@ <method name="set_axis_lock"> <return type="void"> </return> - <argument index="0" name="axis" type="int" enum="PhysicsServer.BodyAxis"> + <argument index="0" name="axis" type="int" enum="PhysicsServer3D.BodyAxis"> </argument> <argument index="1" name="lock" type="bool"> </argument> @@ -122,10 +122,10 @@ </methods> <members> <member name="angular_damp" type="float" setter="set_angular_damp" getter="get_angular_damp" default="-1.0"> - Damps RigidBody's rotational forces. + Damps RigidBody3D's rotational forces. </member> <member name="angular_velocity" type="Vector3" setter="set_angular_velocity" getter="get_angular_velocity" default="Vector3( 0, 0, 0 )"> - RigidBody's rotational velocity. + RigidBody3D's rotational velocity. </member> <member name="axis_lock_angular_x" type="bool" setter="set_axis_lock" getter="get_axis_lock" default="false"> Lock the body's rotation in the X axis. @@ -146,10 +146,10 @@ Lock the body's movement in the Z axis. </member> <member name="can_sleep" type="bool" setter="set_can_sleep" getter="is_able_to_sleep" default="true"> - If [code]true[/code], the RigidBody will not calculate forces and will act as a static body while there is no movement. It will wake up when forces are applied through other collisions or when the [code]apply_impulse[/code] method is used. + If [code]true[/code], the RigidBody3D will not calculate forces and will act as a static body while there is no movement. It will wake up when forces are applied through other collisions or when the [code]apply_impulse[/code] method is used. </member> <member name="contact_monitor" type="bool" setter="set_contact_monitor" getter="is_contact_monitor_enabled" default="false"> - If [code]true[/code], the RigidBody will emit signals when it collides with another RigidBody. + If [code]true[/code], the RigidBody3D will emit signals when it collides with another RigidBody3D. </member> <member name="contacts_reported" type="int" setter="set_max_contacts_reported" getter="get_max_contacts_reported" default="0"> The maximum contacts to report. Bodies can keep a log of the contacts with other bodies, this is enabled by setting the maximum amount of contacts reported to a number greater than 0. @@ -162,7 +162,7 @@ If [code]true[/code], internal force integration will be disabled (like gravity or air friction) for this body. Other than collision response, the body will only move as determined by the [method _integrate_forces] function, if defined. </member> <member name="gravity_scale" type="float" setter="set_gravity_scale" getter="get_gravity_scale" default="1.0"> - This is multiplied by the global 3D gravity setting found in [b]Project > Project Settings > Physics > 3d[/b] to produce RigidBody's gravity. For example, a value of 1 will be normal gravity, 2 will apply double gravity, and 0.5 will apply half gravity to this object. + This is multiplied by the global 3D gravity setting found in [b]Project > Project Settings > Physics > 3d[/b] to produce RigidBody3D's gravity. For example, a value of 1 will be normal gravity, 2 will apply double gravity, and 0.5 will apply half gravity to this object. </member> <member name="linear_damp" type="float" setter="set_linear_damp" getter="get_linear_damp" default="-1.0"> The body's linear damp. Cannot be less than -1.0. If this value is different from -1.0, any linear damp derived from the world or areas will be overridden. @@ -173,7 +173,7 @@ <member name="mass" type="float" setter="set_mass" getter="get_mass" default="1.0"> The body's mass. </member> - <member name="mode" type="int" setter="set_mode" getter="get_mode" enum="RigidBody.Mode" default="0"> + <member name="mode" type="int" setter="set_mode" getter="get_mode" enum="RigidBody3D.Mode" default="0"> The body mode. See [enum Mode] for possible values. </member> <member name="physics_material_override" type="PhysicsMaterial" setter="set_physics_material_override" getter="get_physics_material_override"> @@ -241,13 +241,13 @@ Rigid body mode. This is the "natural" state of a rigid body. It is affected by forces, and can move, rotate, and be affected by user code. </constant> <constant name="MODE_STATIC" value="1" enum="Mode"> - Static mode. The body behaves like a [StaticBody], and can only move by user code. + Static mode. The body behaves like a [StaticBody3D], and can only move by user code. </constant> <constant name="MODE_CHARACTER" value="2" enum="Mode"> Character body mode. This behaves like a rigid body, but can not rotate. </constant> <constant name="MODE_KINEMATIC" value="3" enum="Mode"> - Kinematic body mode. The body behaves like a [KinematicBody], and can only move by user code. + Kinematic body mode. The body behaves like a [KinematicBody3D], and can only move by user code. </constant> </constants> </class> diff --git a/doc/classes/RootMotionView.xml b/doc/classes/RootMotionView.xml index 654e42a3c6..be8d8d0078 100644 --- a/doc/classes/RootMotionView.xml +++ b/doc/classes/RootMotionView.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="RootMotionView" inherits="VisualInstance" version="4.0"> +<class name="RootMotionView" inherits="VisualInstance3D" version="4.0"> <brief_description> </brief_description> <description> diff --git a/doc/classes/SceneTree.xml b/doc/classes/SceneTree.xml index e6778013cf..00ca5c6e9f 100644 --- a/doc/classes/SceneTree.xml +++ b/doc/classes/SceneTree.xml @@ -135,13 +135,6 @@ Returns [code]true[/code] if there is a [member network_peer] set. </description> </method> - <method name="is_input_handled"> - <return type="bool"> - </return> - <description> - Returns [code]true[/code] if the most recent [InputEvent] was marked as handled with [method set_input_as_handled]. - </description> - </method> <method name="is_network_server" qualifiers="const"> <return type="bool"> </return> @@ -237,13 +230,6 @@ Sets the given [code]property[/code] to [code]value[/code] on all members of the given group, respecting the given [enum GroupCallFlags]. </description> </method> - <method name="set_input_as_handled"> - <return type="void"> - </return> - <description> - Marks the most recent [InputEvent] as handled. - </description> - </method> <method name="set_quit_on_go_back"> <return type="void"> </return> @@ -251,22 +237,7 @@ </argument> <description> If [code]true[/code], the application quits automatically on going back (e.g. on Android). Enabled by default. - To handle 'Go Back' button when this option is disabled, use [constant MainLoop.NOTIFICATION_WM_GO_BACK_REQUEST]. - </description> - </method> - <method name="set_screen_stretch"> - <return type="void"> - </return> - <argument index="0" name="mode" type="int" enum="SceneTree.StretchMode"> - </argument> - <argument index="1" name="aspect" type="int" enum="SceneTree.StretchAspect"> - </argument> - <argument index="2" name="minsize" type="Vector2"> - </argument> - <argument index="3" name="shrink" type="float" default="1"> - </argument> - <description> - Configures screen stretching to the given [enum StretchMode], [enum StretchAspect], minimum size and [code]shrink[/code] ratio. + To handle 'Go Back' button when this option is disabled, use [constant DisplayServer.WINDOW_EVENT_GO_BACK_REQUEST]. </description> </method> </methods> @@ -301,11 +272,8 @@ <member name="refuse_new_network_connections" type="bool" setter="set_refuse_new_network_connections" getter="is_refusing_new_network_connections" default="false"> If [code]true[/code], the [SceneTree]'s [member network_peer] refuses new incoming connections. </member> - <member name="root" type="Viewport" setter="" getter="get_root"> - The [SceneTree]'s root [Viewport]. - </member> - <member name="use_font_oversampling" type="bool" setter="set_use_font_oversampling" getter="is_using_font_oversampling" default="false"> - If [code]true[/code], font oversampling is used. + <member name="root" type="Window" setter="" getter="get_root"> + The [SceneTree]'s root [Window]. </member> </members> <signals> @@ -328,15 +296,6 @@ Emitted when files are dragged from the OS file manager and dropped in the game window. The arguments are a list of file paths and the identifier of the screen where the drag originated. </description> </signal> - <signal name="global_menu_action"> - <argument index="0" name="id" type="Variant"> - </argument> - <argument index="1" name="meta" type="Variant"> - </argument> - <description> - Emitted whenever global menu item is clicked. - </description> - </signal> <signal name="idle_frame"> <description> Emitted immediately before [method Node._process] is called on every node in the [SceneTree]. @@ -389,11 +348,6 @@ Emitted immediately before [method Node._physics_process] is called on every node in the [SceneTree]. </description> </signal> - <signal name="screen_resized"> - <description> - Emitted when the screen resolution (fullscreen) or window size (windowed) changes. - </description> - </signal> <signal name="server_disconnected"> <description> Emitted whenever this [SceneTree]'s [member network_peer] disconnected from server. Only emitted on clients. @@ -418,29 +372,5 @@ <constant name="GROUP_CALL_UNIQUE" value="4" enum="GroupCallFlags"> Call a group only once even if the call is executed many times. </constant> - <constant name="STRETCH_MODE_DISABLED" value="0" enum="StretchMode"> - No stretching. - </constant> - <constant name="STRETCH_MODE_2D" value="1" enum="StretchMode"> - Render stretching in higher resolution (interpolated). - </constant> - <constant name="STRETCH_MODE_VIEWPORT" value="2" enum="StretchMode"> - Keep the specified display resolution. No interpolation. Content may appear pixelated. - </constant> - <constant name="STRETCH_ASPECT_IGNORE" value="0" enum="StretchAspect"> - Fill the window with the content stretched to cover excessive space. Content may appear stretched. - </constant> - <constant name="STRETCH_ASPECT_KEEP" value="1" enum="StretchAspect"> - Retain the same aspect ratio by padding with black bars on either axis. This prevents distortion. - </constant> - <constant name="STRETCH_ASPECT_KEEP_WIDTH" value="2" enum="StretchAspect"> - Expand vertically. Left/right black bars may appear if the window is too wide. - </constant> - <constant name="STRETCH_ASPECT_KEEP_HEIGHT" value="3" enum="StretchAspect"> - Expand horizontally. Top/bottom black bars may appear if the window is too tall. - </constant> - <constant name="STRETCH_ASPECT_EXPAND" value="4" enum="StretchAspect"> - Expand in both directions, retaining the same aspect ratio. This prevents distortion while avoiding black bars. - </constant> </constants> </class> diff --git a/doc/classes/ScriptCreateDialog.xml b/doc/classes/ScriptCreateDialog.xml index 9f16a6ed46..aa60ecb12b 100644 --- a/doc/classes/ScriptCreateDialog.xml +++ b/doc/classes/ScriptCreateDialog.xml @@ -4,7 +4,7 @@ The Editor's popup dialog for creating new [Script] files. </brief_description> <description> - The [ScriptCreateDialog] creates script files according to a given template for a given scripting language. The standard use is to configure its fields prior to calling one of the [method Popup.popup] methods. + The [ScriptCreateDialog] creates script files according to a given template for a given scripting language. The standard use is to configure its fields prior to calling one of the [method Window.popup] methods. [codeblock] func _ready(): dialog.config("Node", "res://new_node.gd") # For in-engine types @@ -33,10 +33,7 @@ </methods> <members> <member name="dialog_hide_on_ok" type="bool" setter="set_hide_on_ok" getter="get_hide_on_ok" override="true" default="false" /> - <member name="margin_bottom" type="float" setter="set_margin" getter="get_margin" override="true" default="232.0" /> - <member name="margin_right" type="float" setter="set_margin" getter="get_margin" override="true" default="361.0" /> - <member name="rect_size" type="Vector2" setter="_set_size" getter="get_size" override="true" default="Vector2( 361, 232 )" /> - <member name="window_title" type="String" setter="set_title" getter="get_title" override="true" default=""Attach Node Script"" /> + <member name="title" type="String" setter="set_title" getter="get_title" override="true" default=""Attach Node Script"" /> </members> <signals> <signal name="script_created"> diff --git a/doc/classes/Shape.xml b/doc/classes/Shape3D.xml index d70d2c09b3..1af6550dc5 100644 --- a/doc/classes/Shape.xml +++ b/doc/classes/Shape3D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Shape" inherits="Resource" version="4.0"> +<class name="Shape3D" inherits="Resource" version="4.0"> <brief_description> Base class for all 3D shape resources. </brief_description> <description> - Base class for all 3D shape resources. Nodes that inherit from this can be used as shapes for a [PhysicsBody] or [Area] objects. + Base class for all 3D shape resources. Nodes that inherit from this can be used as shapes for a [PhysicsBody3D] or [Area3D] objects. </description> <tutorials> <link>https://docs.godotengine.org/en/latest/tutorials/physics/physics_introduction.html</link> diff --git a/doc/classes/Skeleton.xml b/doc/classes/Skeleton3D.xml index eaab4063b8..08404fb467 100644 --- a/doc/classes/Skeleton.xml +++ b/doc/classes/Skeleton3D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Skeleton" inherits="Spatial" version="4.0"> +<class name="Skeleton3D" inherits="Node3D" version="4.0"> <brief_description> Skeleton for characters and animated objects. </brief_description> <description> - Skeleton provides a hierarchical interface for managing bones, including pose, rest and animation (see [Animation]). It can also use ragdoll physics. + Skeleton3D provides a hierarchical interface for managing bones, including pose, rest and animation (see [Animation]). It can also use ragdoll physics. The overall transform of a bone with respect to the skeleton is determined by the following hierarchical order: rest pose, custom pose and pose. Note that "global pose" below refers to the overall transform of the bone with respect to skeleton, so it not the actual global/world transform of the bone. </description> @@ -38,6 +38,12 @@ Clear all the bones in this skeleton. </description> </method> + <method name="clear_bones_global_pose_override"> + <return type="void"> + </return> + <description> + </description> + </method> <method name="find_bone" qualifiers="const"> <return type="int"> </return> diff --git a/doc/classes/SkeletonIK.xml b/doc/classes/SkeletonIK3D.xml index 1db78314d2..de83847403 100644 --- a/doc/classes/SkeletonIK.xml +++ b/doc/classes/SkeletonIK3D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="SkeletonIK" inherits="Node" version="4.0"> +<class name="SkeletonIK3D" inherits="Node" version="4.0"> <brief_description> </brief_description> <description> @@ -8,7 +8,7 @@ </tutorials> <methods> <method name="get_parent_skeleton" qualifiers="const"> - <return type="Skeleton"> + <return type="Skeleton3D"> </return> <description> </description> diff --git a/doc/classes/SliderJoint.xml b/doc/classes/SliderJoint3D.xml index dc0cf96eb4..efd6353e3c 100644 --- a/doc/classes/SliderJoint.xml +++ b/doc/classes/SliderJoint3D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="SliderJoint" inherits="Joint" version="4.0"> +<class name="SliderJoint3D" inherits="Joint3D" version="4.0"> <brief_description> Piston kind of slider between two bodies in 3D. </brief_description> @@ -12,7 +12,7 @@ <method name="get_param" qualifiers="const"> <return type="float"> </return> - <argument index="0" name="param" type="int" enum="SliderJoint.Param"> + <argument index="0" name="param" type="int" enum="SliderJoint3D.Param"> </argument> <description> </description> @@ -20,7 +20,7 @@ <method name="set_param"> <return type="void"> </return> - <argument index="0" name="param" type="int" enum="SliderJoint.Param"> + <argument index="0" name="param" type="int" enum="SliderJoint3D.Param"> </argument> <argument index="1" name="value" type="float"> </argument> diff --git a/doc/classes/SoftBody.xml b/doc/classes/SoftBody3D.xml index 46a00fbd67..24d6609900 100644 --- a/doc/classes/SoftBody.xml +++ b/doc/classes/SoftBody3D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="SoftBody" inherits="MeshInstance" version="4.0"> +<class name="SoftBody3D" inherits="MeshInstance3D" version="4.0"> <brief_description> A soft mesh physics body. </brief_description> @@ -80,12 +80,12 @@ <member name="areaAngular_stiffness" type="float" setter="set_areaAngular_stiffness" getter="get_areaAngular_stiffness" default="0.5"> </member> <member name="collision_layer" type="int" setter="set_collision_layer" getter="get_collision_layer" default="1"> - The physics layers this SoftBody is in. + The physics layers this SoftBody3D is in. Collidable objects can exist in any of 32 different layers. These layers work like a tagging system, and are not visual. A collidable can use these layers to select with which objects it can collide, using the collision_mask property. A contact is detected if object A is in any of the layers that object B scans, or object B is in any layer scanned by object A. </member> <member name="collision_mask" type="int" setter="set_collision_mask" getter="get_collision_mask" default="1"> - The physics layers this SoftBody scans for collisions. + The physics layers this SoftBody3D scans for collisions. </member> <member name="damping_coefficient" type="float" setter="set_damping_coefficient" getter="get_damping_coefficient" default="0.01"> </member> @@ -94,20 +94,20 @@ <member name="linear_stiffness" type="float" setter="set_linear_stiffness" getter="get_linear_stiffness" default="0.5"> </member> <member name="parent_collision_ignore" type="NodePath" setter="set_parent_collision_ignore" getter="get_parent_collision_ignore" default="NodePath("")"> - [NodePath] to a [CollisionObject] this SoftBody should avoid clipping. + [NodePath] to a [CollisionObject3D] this SoftBody3D should avoid clipping. </member> <member name="pose_matching_coefficient" type="float" setter="set_pose_matching_coefficient" getter="get_pose_matching_coefficient" default="0.0"> </member> <member name="pressure_coefficient" type="float" setter="set_pressure_coefficient" getter="get_pressure_coefficient" default="0.0"> </member> <member name="ray_pickable" type="bool" setter="set_ray_pickable" getter="is_ray_pickable" default="true"> - If [code]true[/code], the [SoftBody] will respond to [RayCast]s. + If [code]true[/code], the [SoftBody3D] will respond to [RayCast3D]s. </member> <member name="simulation_precision" type="int" setter="set_simulation_precision" getter="get_simulation_precision" default="5"> Increasing this value will improve the resulting simulation, but can affect performance. Use with care. </member> <member name="total_mass" type="float" setter="set_total_mass" getter="get_total_mass" default="1.0"> - The SoftBody's mass. + The SoftBody3D's mass. </member> <member name="volume_stiffness" type="float" setter="set_volume_stiffness" getter="get_volume_stiffness" default="0.5"> </member> diff --git a/doc/classes/SphereShape.xml b/doc/classes/SphereShape3D.xml index 75dab58c38..1eaf890639 100644 --- a/doc/classes/SphereShape.xml +++ b/doc/classes/SphereShape3D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="SphereShape" inherits="Shape" version="4.0"> +<class name="SphereShape3D" inherits="Shape3D" version="4.0"> <brief_description> Sphere shape for 3D collisions. </brief_description> <description> - Sphere shape for 3D collisions, which can be set into a [PhysicsBody] or [Area]. This shape is useful for modeling sphere-like 3D objects. + Sphere shape for 3D collisions, which can be set into a [PhysicsBody3D] or [Area3D]. This shape is useful for modeling sphere-like 3D objects. </description> <tutorials> </tutorials> diff --git a/doc/classes/SpotLight.xml b/doc/classes/SpotLight3D.xml index 351d4f8aff..f094818c21 100644 --- a/doc/classes/SpotLight.xml +++ b/doc/classes/SpotLight3D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="SpotLight" inherits="Light" version="4.0"> +<class name="SpotLight3D" inherits="Light3D" version="4.0"> <brief_description> A spotlight, such as a reflector spotlight or a lantern. </brief_description> <description> - A Spotlight is a type of [Light] node that emits lights in a specific direction, in the shape of a cone. The light is attenuated through the distance. This attenuation can be configured by changing the energy, radius and attenuation parameters of [Light]. + A Spotlight is a type of [Light3D] node that emits lights in a specific direction, in the shape of a cone. The light is attenuated through the distance. This attenuation can be configured by changing the energy, radius and attenuation parameters of [Light3D]. </description> <tutorials> <link>https://docs.godotengine.org/en/latest/tutorials/3d/lights_and_shadows.html</link> diff --git a/doc/classes/SpringArm.xml b/doc/classes/SpringArm3D.xml index 780ed5077d..8305494c2b 100644 --- a/doc/classes/SpringArm.xml +++ b/doc/classes/SpringArm3D.xml @@ -1,13 +1,13 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="SpringArm" inherits="Spatial" version="4.0"> +<class name="SpringArm3D" inherits="Node3D" version="4.0"> <brief_description> A helper node, mostly used in 3rd person cameras. </brief_description> <description> - The SpringArm node is a node that casts a ray (or collision shape) along its z axis and moves all its direct children to the collision point, minus a margin. + The SpringArm3D node is a node that casts a ray (or collision shape) along its z axis and moves all its direct children to the collision point, minus a margin. The most common use case for this is to make a 3rd person camera that reacts to collisions in the environment. - The SpringArm will either cast a ray, or if a shape is given, it will cast the shape in the direction of its z axis. - If you use the SpringArm as a camera controller for your player, you might need to exclude the player's collider from the SpringArm's collision check. + The SpringArm3D will either cast a ray, or if a shape is given, it will cast the shape in the direction of its z axis. + If you use the SpringArm3D as a camera controller for your player, you might need to exclude the player's collider from the SpringArm3D's collision check. </description> <tutorials> </tutorials> @@ -18,14 +18,14 @@ <argument index="0" name="RID" type="RID"> </argument> <description> - Adds the [PhysicsBody] object with the given [RID] to the list of [PhysicsBody] objects excluded from the collision check. + Adds the [PhysicsBody3D] object with the given [RID] to the list of [PhysicsBody3D] objects excluded from the collision check. </description> </method> <method name="clear_excluded_objects"> <return type="void"> </return> <description> - Clears the list of [PhysicsBody] objects excluded from the collision check. + Clears the list of [PhysicsBody3D] objects excluded from the collision check. </description> </method> <method name="get_hit_length"> @@ -41,7 +41,7 @@ <argument index="0" name="RID" type="RID"> </argument> <description> - Removes the given [RID] from the list of [PhysicsBody] objects excluded from the collision check. + Removes the given [RID] from the list of [PhysicsBody3D] objects excluded from the collision check. </description> </method> </methods> @@ -50,17 +50,17 @@ The layers against which the collision check shall be done. </member> <member name="margin" type="float" setter="set_margin" getter="get_margin" default="0.01"> - When the collision check is made, a candidate length for the SpringArm is given. - The margin is then subtracted to this length and the translation is applied to the child objects of the SpringArm. - This margin is useful for when the SpringArm has a [Camera] as a child node: without the margin, the [Camera] would be placed on the exact point of collision, while with the margin the [Camera] would be placed close to the point of collision. + When the collision check is made, a candidate length for the SpringArm3D is given. + The margin is then subtracted to this length and the translation is applied to the child objects of the SpringArm3D. + This margin is useful for when the SpringArm3D has a [Camera3D] as a child node: without the margin, the [Camera3D] would be placed on the exact point of collision, while with the margin the [Camera3D] would be placed close to the point of collision. </member> - <member name="shape" type="Shape" setter="set_shape" getter="get_shape"> - The [Shape] to use for the SpringArm. - When the shape is set, the SpringArm will cast the [Shape] on its z axis instead of performing a ray cast. + <member name="shape" type="Shape3D" setter="set_shape" getter="get_shape"> + The [Shape3D] to use for the SpringArm3D. + When the shape is set, the SpringArm3D will cast the [Shape3D] on its z axis instead of performing a ray cast. </member> <member name="spring_length" type="float" setter="set_length" getter="get_length" default="1.0"> - The maximum extent of the SpringArm. This is used as a length for both the ray and the shape cast used internally to calculate the desired position of the SpringArm's child nodes. - To know more about how to perform a shape cast or a ray cast, please consult the [PhysicsDirectSpaceState] documentation. + The maximum extent of the SpringArm3D. This is used as a length for both the ray and the shape cast used internally to calculate the desired position of the SpringArm3D's child nodes. + To know more about how to perform a shape cast or a ray cast, please consult the [PhysicsDirectSpaceState3D] documentation. </member> </members> <constants> diff --git a/doc/classes/Sprite.xml b/doc/classes/Sprite2D.xml index 6c21881535..950fda4e20 100644 --- a/doc/classes/Sprite.xml +++ b/doc/classes/Sprite2D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Sprite" inherits="Node2D" version="4.0"> +<class name="Sprite2D" inherits="Node2D" version="4.0"> <brief_description> General-purpose sprite node. </brief_description> @@ -13,7 +13,7 @@ <return type="Rect2"> </return> <description> - Returns a [Rect2] representing the Sprite's boundary in local coordinates. Can be used to detect if the Sprite was clicked. Example: + Returns a [Rect2] representing the Sprite2D's boundary in local coordinates. Can be used to detect if the Sprite2D was clicked. Example: [codeblock] func _input(event): if event is InputEventMouseButton and event.pressed and event.button_index == BUTTON_LEFT: @@ -53,7 +53,7 @@ The number of columns in the sprite sheet. </member> <member name="normal_map" type="Texture2D" setter="set_normal_map" getter="get_normal_map"> - The normal map gives depth to the Sprite. + The normal map gives depth to the Sprite2D. </member> <member name="offset" type="Vector2" setter="set_offset" getter="get_offset" default="Vector2( 0, 0 )"> The texture's drawing offset. @@ -68,7 +68,7 @@ The region of the atlas texture to display. [member region_enabled] must be [code]true[/code]. </member> <member name="shininess" type="float" setter="set_shininess" getter="get_shininess" default="1.0"> - Strength of the specular light effect of this [Sprite]. + Strength of the specular light effect of this [Sprite2D]. </member> <member name="specular_color" type="Color" setter="set_specular_color" getter="get_specular_color" default="Color( 1, 1, 1, 1 )"> The color of the specular light effect. diff --git a/doc/classes/Sprite3D.xml b/doc/classes/Sprite3D.xml index 63958eeb7b..f59d5130c9 100644 --- a/doc/classes/Sprite3D.xml +++ b/doc/classes/Sprite3D.xml @@ -5,7 +5,7 @@ </brief_description> <description> A node that displays a 2D texture in a 3D environment. The texture displayed can be a region from a larger atlas texture, or a frame from a sprite sheet animation. - [b]Note:[/b] There are [url=https://github.com/godotengine/godot/issues/20855]known performance issues[/url] when using [Sprite3D]. Consider using a [MeshInstance] with a [QuadMesh] as the mesh instead. You can still have billboarding by enabling billboard properties in the QuadMesh's [StandardMaterial3D]. + [b]Note:[/b] There are [url=https://github.com/godotengine/godot/issues/20855]known performance issues[/url] when using [Sprite3D]. Consider using a [MeshInstance3D] with a [QuadMesh] as the mesh instead. You can still have billboarding by enabling billboard properties in the QuadMesh's [StandardMaterial3D]. </description> <tutorials> </tutorials> diff --git a/doc/classes/SpriteBase3D.xml b/doc/classes/SpriteBase3D.xml index 563a17e8f6..479dc5f94c 100644 --- a/doc/classes/SpriteBase3D.xml +++ b/doc/classes/SpriteBase3D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="SpriteBase3D" inherits="GeometryInstance" version="4.0"> +<class name="SpriteBase3D" inherits="GeometryInstance3D" version="4.0"> <brief_description> 2D sprite node in 3D environment. </brief_description> @@ -76,7 +76,7 @@ The size of one pixel's width on the sprite to scale it in 3D. </member> <member name="shaded" type="bool" setter="set_draw_flag" getter="get_draw_flag" default="false"> - If [code]true[/code], the [Light] in the [Environment] has effects on the sprite. + If [code]true[/code], the [Light3D] in the [Environment] has effects on the sprite. </member> <member name="transparent" type="bool" setter="set_draw_flag" getter="get_draw_flag" default="true"> If [code]true[/code], the texture's transparency and the opacity are used to make those parts of the sprite invisible. diff --git a/doc/classes/SpriteFrames.xml b/doc/classes/SpriteFrames.xml index 9facdde681..6e1e1688f4 100644 --- a/doc/classes/SpriteFrames.xml +++ b/doc/classes/SpriteFrames.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="SpriteFrames" inherits="Resource" version="4.0"> <brief_description> - Sprite frame library for AnimatedSprite. + Sprite frame library for AnimatedSprite2D. </brief_description> <description> - Sprite frame library for [AnimatedSprite]. Contains frames and animation data for playback. + Sprite frame library for [AnimatedSprite2D]. Contains frames and animation data for playback. </description> <tutorials> </tutorials> diff --git a/doc/classes/StaticBody.xml b/doc/classes/StaticBody3D.xml index 280b95d182..c896efc314 100644 --- a/doc/classes/StaticBody.xml +++ b/doc/classes/StaticBody3D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="StaticBody" inherits="PhysicsBody" version="4.0"> +<class name="StaticBody3D" inherits="PhysicsBody3D" version="4.0"> <brief_description> Static body for 3D physics. </brief_description> <description> - Static body for 3D physics. A static body is a simple body that is not intended to move. In contrast to [RigidBody], they don't consume any CPU resources as long as they don't move. + Static body for 3D physics. A static body is a simple body that is not intended to move. In contrast to [RigidBody3D], they don't consume any CPU resources as long as they don't move. Additionally, a constant linear or angular velocity can be set for the static body, so even if it doesn't move, it affects other bodies as if it was moving (this is useful for simulating conveyor belts or conveyor wheels). </description> <tutorials> diff --git a/doc/classes/SubViewport.xml b/doc/classes/SubViewport.xml new file mode 100644 index 0000000000..561e5d1a15 --- /dev/null +++ b/doc/classes/SubViewport.xml @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="SubViewport" inherits="Viewport" version="4.0"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <methods> + <method name="get_size" qualifiers="const"> + <return type="Vector2i"> + </return> + <description> + </description> + </method> + <method name="set_size"> + <return type="void"> + </return> + <argument index="0" name="size" type="Vector2i"> + </argument> + <description> + </description> + </method> + </methods> + <members> + <member name="arvr" type="bool" setter="set_use_arvr" getter="is_using_arvr" default="false"> + </member> + <member name="render_target_clear_mode" type="int" setter="set_clear_mode" getter="get_clear_mode" enum="SubViewport.ClearMode" default="0"> + </member> + <member name="render_target_update_mode" type="int" setter="set_update_mode" getter="get_update_mode" enum="SubViewport.UpdateMode" default="2"> + </member> + </members> + <constants> + <constant name="UPDATE_DISABLED" value="0" enum="UpdateMode"> + </constant> + <constant name="UPDATE_ONCE" value="1" enum="UpdateMode"> + </constant> + <constant name="UPDATE_WHEN_VISIBLE" value="2" enum="UpdateMode"> + </constant> + <constant name="UPDATE_WHEN_PARENT_VISIBLE" value="3" enum="UpdateMode"> + </constant> + <constant name="UPDATE_ALWAYS" value="4" enum="UpdateMode"> + </constant> + <constant name="CLEAR_MODE_ALWAYS" value="0" enum="ClearMode"> + </constant> + <constant name="CLEAR_MODE_NEVER" value="1" enum="ClearMode"> + </constant> + <constant name="CLEAR_MODE_ONLY_NEXT_FRAME" value="2" enum="ClearMode"> + </constant> + </constants> +</class> diff --git a/doc/classes/Texture2D.xml b/doc/classes/Texture2D.xml index 63cdb0d90a..ffe806cef7 100644 --- a/doc/classes/Texture2D.xml +++ b/doc/classes/Texture2D.xml @@ -4,7 +4,7 @@ Texture for 2D and 3D. </brief_description> <description> - A texture works by registering an image in the video hardware, which then can be used in 3D models or 2D [Sprite] or GUI [Control]. + A texture works by registering an image in the video hardware, which then can be used in 3D models or 2D [Sprite2D] or GUI [Control]. Textures are often created by loading them from a file. See [method @GDScript.load]. [Texture2D] is a base for other resources. It cannot be used directly. </description> @@ -28,12 +28,12 @@ </argument> <argument index="6" name="specular_color_shininess" type="Color" default="Color( 1, 1, 1, 1 )"> </argument> - <argument index="7" name="texture_filter" type="int" enum="VisualServer.CanvasItemTextureFilter" default="0"> + <argument index="7" name="texture_filter" type="int" enum="RenderingServer.CanvasItemTextureFilter" default="0"> </argument> - <argument index="8" name="texture_repeat" type="int" enum="VisualServer.CanvasItemTextureRepeat" default="0"> + <argument index="8" name="texture_repeat" type="int" enum="RenderingServer.CanvasItemTextureRepeat" default="0"> </argument> <description> - Draws the texture using a [CanvasItem] with the [VisualServer] API at the specified [code]position[/code]. + Draws the texture using a [CanvasItem] with the [RenderingServer] API at the specified [code]position[/code]. </description> </method> <method name="draw_rect" qualifiers="const"> @@ -55,12 +55,12 @@ </argument> <argument index="7" name="specular_color_shininess" type="Color" default="Color( 1, 1, 1, 1 )"> </argument> - <argument index="8" name="texture_filter" type="int" enum="VisualServer.CanvasItemTextureFilter" default="0"> + <argument index="8" name="texture_filter" type="int" enum="RenderingServer.CanvasItemTextureFilter" default="0"> </argument> - <argument index="9" name="texture_repeat" type="int" enum="VisualServer.CanvasItemTextureRepeat" default="0"> + <argument index="9" name="texture_repeat" type="int" enum="RenderingServer.CanvasItemTextureRepeat" default="0"> </argument> <description> - Draws the texture using a [CanvasItem] with the [VisualServer] API. + Draws the texture using a [CanvasItem] with the [RenderingServer] API. </description> </method> <method name="draw_rect_region" qualifiers="const"> @@ -82,14 +82,14 @@ </argument> <argument index="7" name="specular_color_shininess" type="Color" default="Color( 1, 1, 1, 1 )"> </argument> - <argument index="8" name="texture_filter" type="int" enum="VisualServer.CanvasItemTextureFilter" default="0"> + <argument index="8" name="texture_filter" type="int" enum="RenderingServer.CanvasItemTextureFilter" default="0"> </argument> - <argument index="9" name="texture_repeat" type="int" enum="VisualServer.CanvasItemTextureRepeat" default="0"> + <argument index="9" name="texture_repeat" type="int" enum="RenderingServer.CanvasItemTextureRepeat" default="0"> </argument> <argument index="10" name="clip_uv" type="bool" default="true"> </argument> <description> - Draws a part of the texture using a [CanvasItem] with the [VisualServer] API. + Draws a part of the texture using a [CanvasItem] with the [RenderingServer] API. </description> </method> <method name="get_data" qualifiers="const"> diff --git a/doc/classes/Thread.xml b/doc/classes/Thread.xml index 3bb5797df5..4d6e89fa6f 100644 --- a/doc/classes/Thread.xml +++ b/doc/classes/Thread.xml @@ -36,7 +36,7 @@ <argument index="3" name="priority" type="int" enum="Thread.Priority" default="1"> </argument> <description> - Starts a new [Thread] that runs [code]method[/code] on object [code]instance[/code] with [code]userdata[/code] passed as an argument. The [code]priority[/code] of the [Thread] can be changed by passing a value from the [enum Priority] enum. + Starts a new [Thread] that runs [code]method[/code] on object [code]instance[/code] with [code]userdata[/code] passed as an argument. Even if no userdata is passed, [code]method[/code] must accept one argument and it will be null. The [code]priority[/code] of the [Thread] can be changed by passing a value from the [enum Priority] enum. Returns [constant OK] on success, or [constant ERR_CANT_CREATE] on failure. </description> </method> diff --git a/doc/classes/VehicleBody.xml b/doc/classes/VehicleBody3D.xml index 74879419a1..b8b85ff605 100644 --- a/doc/classes/VehicleBody.xml +++ b/doc/classes/VehicleBody3D.xml @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VehicleBody" inherits="RigidBody" version="4.0"> +<class name="VehicleBody3D" inherits="RigidBody3D" version="4.0"> <brief_description> Physics body that simulates the behavior of a car. </brief_description> <description> - This node implements all the physics logic needed to simulate a car. It is based on the raycast vehicle system commonly found in physics engines. You will need to add a [CollisionShape] for the main body of your vehicle and add [VehicleWheel] nodes for the wheels. You should also add a [MeshInstance] to this node for the 3D model of your car but this model should not include meshes for the wheels. You should control the vehicle by using the [member brake], [member engine_force], and [member steering] properties and not change the position or orientation of this node directly. - [b]Note:[/b] The origin point of your VehicleBody will determine the center of gravity of your vehicle so it is better to keep this low and move the [CollisionShape] and [MeshInstance] upwards. + This node implements all the physics logic needed to simulate a car. It is based on the raycast vehicle system commonly found in physics engines. You will need to add a [CollisionShape3D] for the main body of your vehicle and add [VehicleWheel3D] nodes for the wheels. You should also add a [MeshInstance3D] to this node for the 3D model of your car but this model should not include meshes for the wheels. You should control the vehicle by using the [member brake], [member engine_force], and [member steering] properties and not change the position or orientation of this node directly. + [b]Note:[/b] The origin point of your VehicleBody3D will determine the center of gravity of your vehicle so it is better to keep this low and move the [CollisionShape3D] and [MeshInstance3D] upwards. </description> <tutorials> </tutorials> @@ -13,16 +13,16 @@ </methods> <members> <member name="brake" type="float" setter="set_brake" getter="get_brake" default="0.0"> - Slows down the vehicle by applying a braking force. The vehicle is only slowed down if the wheels are in contact with a surface. The force you need to apply to adequately slow down your vehicle depends on the [member RigidBody.mass] of the vehicle. For a vehicle with a mass set to 1000, try a value in the 25 - 30 range for hard braking. + Slows down the vehicle by applying a braking force. The vehicle is only slowed down if the wheels are in contact with a surface. The force you need to apply to adequately slow down your vehicle depends on the [member RigidBody3D.mass] of the vehicle. For a vehicle with a mass set to 1000, try a value in the 25 - 30 range for hard braking. </member> <member name="engine_force" type="float" setter="set_engine_force" getter="get_engine_force" default="0.0"> - Accelerates the vehicle by applying an engine force. The vehicle is only speed up if the wheels that have [member VehicleWheel.use_as_traction] set to [code]true[/code] and are in contact with a surface. The [member RigidBody.mass] of the vehicle has an effect on the acceleration of the vehicle. For a vehicle with a mass set to 1000, try a value in the 25 - 50 range for acceleration. + Accelerates the vehicle by applying an engine force. The vehicle is only speed up if the wheels that have [member VehicleWheel3D.use_as_traction] set to [code]true[/code] and are in contact with a surface. The [member RigidBody3D.mass] of the vehicle has an effect on the acceleration of the vehicle. For a vehicle with a mass set to 1000, try a value in the 25 - 50 range for acceleration. [b]Note:[/b] The simulation does not take the effect of gears into account, you will need to add logic for this if you wish to simulate gears. A negative value will result in the vehicle reversing. </member> <member name="mass" type="float" setter="set_mass" getter="get_mass" override="true" default="40.0" /> <member name="steering" type="float" setter="set_steering" getter="get_steering" default="0.0"> - The steering angle for the vehicle. Setting this to a non-zero value will result in the vehicle turning when it's moving. Wheels that have [member VehicleWheel.use_as_steering] set to [code]true[/code] will automatically be rotated. + The steering angle for the vehicle. Setting this to a non-zero value will result in the vehicle turning when it's moving. Wheels that have [member VehicleWheel3D.use_as_steering] set to [code]true[/code] will automatically be rotated. </member> <member name="weight" type="float" setter="set_weight" getter="get_weight" override="true" default="392.0" /> </members> diff --git a/doc/classes/VehicleWheel.xml b/doc/classes/VehicleWheel3D.xml index 1a6a226fd1..c71d797eff 100644 --- a/doc/classes/VehicleWheel.xml +++ b/doc/classes/VehicleWheel3D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VehicleWheel" inherits="Spatial" version="4.0"> +<class name="VehicleWheel3D" inherits="Node3D" version="4.0"> <brief_description> Physics object that simulates the behavior of a wheel. </brief_description> <description> - This node needs to be used as a child node of [VehicleBody] and simulates the behavior of one of its wheels. This node also acts as a collider to detect if the wheel is touching a surface. + This node needs to be used as a child node of [VehicleBody3D] and simulates the behavior of one of its wheels. This node also acts as a collider to detect if the wheel is touching a surface. </description> <tutorials> </tutorials> @@ -33,7 +33,7 @@ </methods> <members> <member name="brake" type="float" setter="set_brake" getter="get_brake" default="0.0"> - Slows down the wheel by applying a braking force. The wheel is only slowed down if it is in contact with a surface. The force you need to apply to adequately slow down your vehicle depends on the [member RigidBody.mass] of the vehicle. For a vehicle with a mass set to 1000, try a value in the 25 - 30 range for hard braking. + Slows down the wheel by applying a braking force. The wheel is only slowed down if it is in contact with a surface. The force you need to apply to adequately slow down your vehicle depends on the [member RigidBody3D.mass] of the vehicle. For a vehicle with a mass set to 1000, try a value in the 25 - 30 range for hard braking. </member> <member name="damping_compression" type="float" setter="set_damping_compression" getter="get_damping_compression" default="0.83"> The damping applied to the spring when the spring is being compressed. This value should be between 0.0 (no damping) and 1.0. A value of 0.0 means the car will keep bouncing as the spring keeps its energy. A good value for this is around 0.3 for a normal car, 0.5 for a race car. @@ -42,7 +42,7 @@ The damping applied to the spring when relaxing. This value should be between 0.0 (no damping) and 1.0. This value should always be slightly higher than the [member damping_compression] property. For a [member damping_compression] value of 0.3, try a relaxation value of 0.5. </member> <member name="engine_force" type="float" setter="set_engine_force" getter="get_engine_force" default="0.0"> - Accelerates the wheel by applying an engine force. The wheel is only speed up if it is in contact with a surface. The [member RigidBody.mass] of the vehicle has an effect on the acceleration of the vehicle. For a vehicle with a mass set to 1000, try a value in the 25 - 50 range for acceleration. + Accelerates the wheel by applying an engine force. The wheel is only speed up if it is in contact with a surface. The [member RigidBody3D.mass] of the vehicle has an effect on the acceleration of the vehicle. For a vehicle with a mass set to 1000, try a value in the 25 - 50 range for acceleration. [b]Note:[/b] The simulation does not take the effect of gears into account, you will need to add logic for this if you wish to simulate gears. A negative value will result in the wheel reversing. </member> @@ -50,7 +50,7 @@ The steering angle for the wheel. Setting this to a non-zero value will result in the vehicle turning when it's moving. </member> <member name="suspension_max_force" type="float" setter="set_suspension_max_force" getter="get_suspension_max_force" default="6000.0"> - The maximum force the spring can resist. This value should be higher than a quarter of the [member RigidBody.mass] of the [VehicleBody] or the spring will not carry the weight of the vehicle. Good results are often obtained by a value that is about 3× to 4× this number. + The maximum force the spring can resist. This value should be higher than a quarter of the [member RigidBody3D.mass] of the [VehicleBody3D] or the spring will not carry the weight of the vehicle. Good results are often obtained by a value that is about 3× to 4× this number. </member> <member name="suspension_stiffness" type="float" setter="set_suspension_stiffness" getter="get_suspension_stiffness" default="5.88"> This value defines the stiffness of the suspension. Use a value lower than 50 for an off-road car, a value between 50 and 100 for a race car and try something around 200 for something like a Formula 1 car. @@ -59,10 +59,10 @@ This is the distance the suspension can travel. As Godot units are equivalent to meters, keep this setting relatively low. Try a value between 0.1 and 0.3 depending on the type of car. </member> <member name="use_as_steering" type="bool" setter="set_use_as_steering" getter="is_used_as_steering" default="false"> - If [code]true[/code], this wheel will be turned when the car steers. This value is used in conjunction with [member VehicleBody.steering] and ignored if you are using the per-wheel [member steering] value instead. + If [code]true[/code], this wheel will be turned when the car steers. This value is used in conjunction with [member VehicleBody3D.steering] and ignored if you are using the per-wheel [member steering] value instead. </member> <member name="use_as_traction" type="bool" setter="set_use_as_traction" getter="is_used_as_traction" default="false"> - If [code]true[/code], this wheel transfers engine force to the ground to propel the vehicle forward. This value is used in conjunction with [member VehicleBody.engine_force] and ignored if you are using the per-wheel [member engine_force] value instead. + If [code]true[/code], this wheel transfers engine force to the ground to propel the vehicle forward. This value is used in conjunction with [member VehicleBody3D.engine_force] and ignored if you are using the per-wheel [member engine_force] value instead. </member> <member name="wheel_friction_slip" type="float" setter="set_friction_slip" getter="get_friction_slip" default="10.5"> This determines how much grip this wheel has. It is combined with the friction setting of the surface the wheel is in contact with. 0.0 means no grip, 1.0 is normal grip. For a drift car setup, try setting the grip of the rear wheels slightly lower than the front wheels, or use a lower value to simulate tire wear. diff --git a/doc/classes/SpatialVelocityTracker.xml b/doc/classes/VelocityTracker3D.xml index 7a4e0c054a..98f7533c76 100644 --- a/doc/classes/SpatialVelocityTracker.xml +++ b/doc/classes/VelocityTracker3D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="SpatialVelocityTracker" inherits="Reference" version="4.0"> +<class name="VelocityTracker3D" inherits="Reference" version="4.0"> <brief_description> </brief_description> <description> diff --git a/doc/classes/Viewport.xml b/doc/classes/Viewport.xml index 0632be28e1..517eb3b24c 100644 --- a/doc/classes/Viewport.xml +++ b/doc/classes/Viewport.xml @@ -4,7 +4,7 @@ Creates a sub-view into the screen. </brief_description> <description> - A Viewport creates a different view into the screen, or a sub-view inside another viewport. Children 2D Nodes will display on it, and children Camera 3D nodes will render on it too. + A Viewport creates a different view into the screen, or a sub-view inside another viewport. Children 2D Nodes will display on it, and children Camera3D 3D nodes will render on it too. Optionally, a viewport can have its own 2D or 3D world, so they don't share what they draw with other viewports. If a viewport is a child of a [ViewportContainer], it will automatically take up its size, otherwise it must be set manually. Viewports can also choose to be audio listeners, so they generate positional audio depending on a 2D or 3D camera child of it. @@ -17,7 +17,7 @@ </tutorials> <methods> <method name="find_world" qualifiers="const"> - <return type="World"> + <return type="World3D"> </return> <description> Returns the 3D world of the viewport, or if none the world of the parent viewport. @@ -31,7 +31,7 @@ </description> </method> <method name="get_camera" qualifiers="const"> - <return type="Camera"> + <return type="Camera3D"> </return> <description> Returns the active 3D camera. @@ -44,13 +44,6 @@ Returns the total transform of the viewport. </description> </method> - <method name="get_modal_stack_top" qualifiers="const"> - <return type="Control"> - </return> - <description> - Returns the topmost modal in the stack. - </description> - </method> <method name="get_mouse_position" qualifiers="const"> <return type="Vector2"> </return> @@ -76,13 +69,6 @@ Returns the [enum ShadowAtlasQuadrantSubdiv] of the specified quadrant. </description> </method> - <method name="get_size_override" qualifiers="const"> - <return type="Vector2"> - </return> - <description> - Returns the size override set with [method set_size_override]. - </description> - </method> <method name="get_texture" qualifiers="const"> <return type="ViewportTexture"> </return> @@ -99,7 +85,7 @@ <return type="RID"> </return> <description> - Returns the viewport's RID from the [VisualServer]. + Returns the viewport's RID from the [RenderingServer]. </description> </method> <method name="get_visible_rect" qualifiers="const"> @@ -116,13 +102,6 @@ Returns the drag data from the GUI, that was previously returned by [method Control.get_drag_data]. </description> </method> - <method name="gui_has_modal_stack" qualifiers="const"> - <return type="bool"> - </return> - <description> - Returns [code]true[/code] if there are visible modals on-screen. - </description> - </method> <method name="gui_is_dragging" qualifiers="const"> <return type="bool"> </return> @@ -133,31 +112,31 @@ <method name="input"> <return type="void"> </return> - <argument index="0" name="local_event" type="InputEvent"> + <argument index="0" name="event" type="InputEvent"> + </argument> + <argument index="1" name="in_local_coords" type="bool" default="false"> </argument> <description> </description> </method> - <method name="is_input_handled" qualifiers="const"> - <return type="bool"> + <method name="input_text"> + <return type="void"> </return> + <argument index="0" name="text" type="String"> + </argument> <description> </description> </method> - <method name="is_size_override_enabled" qualifiers="const"> + <method name="is_embedding_subwindows" qualifiers="const"> <return type="bool"> </return> <description> - Returns [code]true[/code] if the size override is enabled. See [method set_size_override]. </description> </method> - <method name="set_attach_to_screen_rect"> - <return type="void"> + <method name="is_input_handled" qualifiers="const"> + <return type="bool"> </return> - <argument index="0" name="rect" type="Rect2"> - </argument> <description> - Attaches this [Viewport] to the root [Viewport] with the specified rectangle. This bypasses the need for another node to display this [Viewport] but makes you responsible for updating the position of this [Viewport] manually. </description> </method> <method name="set_input_as_handled"> @@ -178,23 +157,12 @@ Sets the number of subdivisions to use in the specified quadrant. A higher number of subdivisions allows you to have more shadows in the scene at once, but reduces the quality of the shadows. A good practice is to have quadrants with a varying number of subdivisions and to have as few subdivisions as possible. </description> </method> - <method name="set_size_override"> - <return type="void"> - </return> - <argument index="0" name="enable" type="bool"> - </argument> - <argument index="1" name="size" type="Vector2" default="Vector2( -1, -1 )"> - </argument> - <argument index="2" name="margin" type="Vector2" default="Vector2( 0, 0 )"> - </argument> - <description> - Sets the size override of the viewport. If the [code]enable[/code] parameter is [code]true[/code] the override is used, otherwise it uses the default size. If the size parameter is [code](-1, -1)[/code], it won't update the size. - </description> - </method> <method name="unhandled_input"> <return type="void"> </return> - <argument index="0" name="local_event" type="InputEvent"> + <argument index="0" name="event" type="InputEvent"> + </argument> + <argument index="1" name="in_local_coords" type="bool" default="false"> </argument> <description> </description> @@ -217,9 +185,6 @@ </method> </methods> <members> - <member name="arvr" type="bool" setter="set_use_arvr" getter="use_arvr" default="false"> - If [code]true[/code], the viewport will be used in AR/VR process. - </member> <member name="audio_listener_enable_2d" type="bool" setter="set_as_audio_listener_2d" getter="is_audio_listener_2d" default="false"> If [code]true[/code], the viewport will process 2D audio streams. </member> @@ -242,6 +207,8 @@ <member name="gui_disable_input" type="bool" setter="set_disable_input" getter="is_input_disabled" default="false"> If [code]true[/code], the viewport will not receive input event. </member> + <member name="gui_embed_subwindows" type="bool" setter="set_embed_subwindows_hint" getter="get_embed_subwindows_hint" default="false"> + </member> <member name="gui_snap_controls_to_pixels" type="bool" setter="set_snap_controls_to_pixels" getter="is_snap_controls_to_pixels_enabled" default="true"> If [code]true[/code], the GUI controls on the viewport will lay pixel perfectly. </member> @@ -251,20 +218,11 @@ The multisample anti-aliasing mode. A higher number results in smoother edges at the cost of significantly worse performance. A value of 4 is best unless targeting very high-end systems. </member> <member name="own_world" type="bool" setter="set_use_own_world" getter="is_using_own_world" default="false"> - If [code]true[/code], the viewport will use [World] defined in [code]world[/code] property. + If [code]true[/code], the viewport will use [World3D] defined in [code]world[/code] property. </member> <member name="physics_object_picking" type="bool" setter="set_physics_object_picking" getter="get_physics_object_picking" default="false"> If [code]true[/code], the objects rendered by viewport become subjects of mouse picking process. </member> - <member name="render_direct_to_screen" type="bool" setter="set_use_render_direct_to_screen" getter="is_using_render_direct_to_screen" default="false"> - If [code]true[/code], renders the Viewport directly to the screen instead of to the root viewport. Only available in GLES2. This is a low-level optimization and should not be used in most cases. If used, reading from the Viewport or from [code]SCREEN_TEXTURE[/code] becomes unavailable. For more information see [method VisualServer.viewport_set_render_direct_to_screen]. - </member> - <member name="render_target_clear_mode" type="int" setter="set_clear_mode" getter="get_clear_mode" enum="Viewport.ClearMode" default="0"> - The clear mode when viewport used as a render target. - </member> - <member name="render_target_update_mode" type="int" setter="set_update_mode" getter="get_update_mode" enum="Viewport.UpdateMode" default="2"> - The update mode when viewport used as a render target. - </member> <member name="shadow_atlas_quad_0" type="int" setter="set_shadow_atlas_quadrant_subdiv" getter="get_shadow_atlas_quadrant_subdiv" enum="Viewport.ShadowAtlasQuadrantSubdiv" default="2"> The subdivision amount of the first quadrant on the shadow atlas. </member> @@ -281,17 +239,11 @@ The shadow atlas' resolution (used for omni and spot lights). The value will be rounded up to the nearest power of 2. [b]Note:[/b] If this is set to 0, shadows won't be visible. Since user-created viewports default to a value of 0, this value must be set above 0 manually. </member> - <member name="size" type="Vector2" setter="set_size" getter="get_size" default="Vector2( 0, 0 )"> - The width and height of viewport. - </member> - <member name="size_override_stretch" type="bool" setter="set_size_override_stretch" getter="is_size_override_stretch_enabled" default="false"> - If [code]true[/code], the size override affects stretch as well. - </member> <member name="transparent_bg" type="bool" setter="set_transparent_background" getter="has_transparent_background" default="false"> If [code]true[/code], the viewport should render its background as transparent. </member> - <member name="world" type="World" setter="set_world" getter="get_world"> - The custom [World] which can be used as 3D environment source. + <member name="world" type="World3D" setter="set_world" getter="get_world"> + The custom [World3D] which can be used as 3D environment source. </member> <member name="world_2d" type="World2D" setter="set_world_2d" getter="get_world_2d"> The custom [World2D] which can be used as 2D environment source. @@ -307,23 +259,11 @@ </signal> <signal name="size_changed"> <description> - Emitted when the size of the viewport is changed, whether by [method set_size_override], resize of window, or some other means. + Emitted when the size of the viewport is changed, whether by resizing of window, or some other means. </description> </signal> </signals> <constants> - <constant name="UPDATE_DISABLED" value="0" enum="UpdateMode"> - Do not update the render target. - </constant> - <constant name="UPDATE_ONCE" value="1" enum="UpdateMode"> - Update the render target once, then switch to [constant UPDATE_DISABLED]. - </constant> - <constant name="UPDATE_WHEN_VISIBLE" value="2" enum="UpdateMode"> - Update the render target only when it is visible. This is the default value. - </constant> - <constant name="UPDATE_ALWAYS" value="3" enum="UpdateMode"> - Always update the render target. - </constant> <constant name="SHADOW_ATLAS_QUADRANT_SUBDIV_DISABLED" value="0" enum="ShadowAtlasQuadrantSubdiv"> This quadrant will not be used. </constant> @@ -410,15 +350,6 @@ <constant name="MSAA_16X" value="4" enum="MSAA"> Use 16x Multisample Antialiasing. Likely unsupported on medium and low-end hardware. </constant> - <constant name="CLEAR_MODE_ALWAYS" value="0" enum="ClearMode"> - Always clear the render target before drawing. - </constant> - <constant name="CLEAR_MODE_NEVER" value="1" enum="ClearMode"> - Never clear the render target. - </constant> - <constant name="CLEAR_MODE_ONLY_NEXT_FRAME" value="2" enum="ClearMode"> - Clear the render target next frame, then switch to [constant CLEAR_MODE_NEVER]. - </constant> <constant name="DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_NEAREST" value="0" enum="DefaultCanvasItemTextureFilter"> </constant> <constant name="DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_LINEAR" value="1" enum="DefaultCanvasItemTextureFilter"> diff --git a/doc/classes/VisibilityEnabler2D.xml b/doc/classes/VisibilityEnabler2D.xml index 3f9bf6887a..0bdecafbfa 100644 --- a/doc/classes/VisibilityEnabler2D.xml +++ b/doc/classes/VisibilityEnabler2D.xml @@ -36,13 +36,13 @@ If [code]true[/code], [RigidBody2D] nodes will be paused. </member> <member name="pause_animated_sprites" type="bool" setter="set_enabler" getter="is_enabler_enabled" default="true"> - If [code]true[/code], [AnimatedSprite] nodes will be paused. + If [code]true[/code], [AnimatedSprite2D] nodes will be paused. </member> <member name="pause_animations" type="bool" setter="set_enabler" getter="is_enabler_enabled" default="true"> If [code]true[/code], [AnimationPlayer] nodes will be paused. </member> <member name="pause_particles" type="bool" setter="set_enabler" getter="is_enabler_enabled" default="true"> - If [code]true[/code], [Particles2D] nodes will be paused. + If [code]true[/code], [GPUParticles2D] nodes will be paused. </member> <member name="physics_process_parent" type="bool" setter="set_enabler" getter="is_enabler_enabled" default="false"> If [code]true[/code], the parent's [method Node._physics_process] will be stopped. @@ -59,7 +59,7 @@ This enabler will freeze [RigidBody2D] nodes. </constant> <constant name="ENABLER_PAUSE_PARTICLES" value="2" enum="Enabler"> - This enabler will stop [Particles2D] nodes. + This enabler will stop [GPUParticles2D] nodes. </constant> <constant name="ENABLER_PARENT_PROCESS" value="3" enum="Enabler"> This enabler will stop the parent's _process function. @@ -68,7 +68,7 @@ This enabler will stop the parent's _physics_process function. </constant> <constant name="ENABLER_PAUSE_ANIMATED_SPRITES" value="5" enum="Enabler"> - This enabler will stop [AnimatedSprite] nodes animations. + This enabler will stop [AnimatedSprite2D] nodes animations. </constant> <constant name="ENABLER_MAX" value="6" enum="Enabler"> Represents the size of the [enum Enabler] enum. diff --git a/doc/classes/VisibilityEnabler.xml b/doc/classes/VisibilityEnabler3D.xml index 7ab6c52e6c..9c25c6c7c8 100644 --- a/doc/classes/VisibilityEnabler.xml +++ b/doc/classes/VisibilityEnabler3D.xml @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisibilityEnabler" inherits="VisibilityNotifier" version="4.0"> +<class name="VisibilityEnabler3D" inherits="VisibilityNotifier3D" version="4.0"> <brief_description> Enables certain nodes only when visible. </brief_description> <description> - The VisibilityEnabler will disable [RigidBody] and [AnimationPlayer] nodes when they are not visible. It will only affect other nodes within the same scene as the VisibilityEnabler itself. - Note that VisibilityEnabler will not affect nodes added after scene initialization. + The VisibilityEnabler3D will disable [RigidBody3D] and [AnimationPlayer] nodes when they are not visible. It will only affect other nodes within the same scene as the VisibilityEnabler3D itself. + Note that VisibilityEnabler3D will not affect nodes added after scene initialization. </description> <tutorials> </tutorials> @@ -13,7 +13,7 @@ <method name="is_enabler_enabled" qualifiers="const"> <return type="bool"> </return> - <argument index="0" name="enabler" type="int" enum="VisibilityEnabler.Enabler"> + <argument index="0" name="enabler" type="int" enum="VisibilityEnabler3D.Enabler"> </argument> <description> Returns whether the enabler identified by given [enum Enabler] constant is active. @@ -22,7 +22,7 @@ <method name="set_enabler"> <return type="void"> </return> - <argument index="0" name="enabler" type="int" enum="VisibilityEnabler.Enabler"> + <argument index="0" name="enabler" type="int" enum="VisibilityEnabler3D.Enabler"> </argument> <argument index="1" name="enabled" type="bool"> </argument> @@ -33,7 +33,7 @@ </methods> <members> <member name="freeze_bodies" type="bool" setter="set_enabler" getter="is_enabler_enabled" default="true"> - If [code]true[/code], [RigidBody] nodes will be paused. + If [code]true[/code], [RigidBody3D] nodes will be paused. </member> <member name="pause_animations" type="bool" setter="set_enabler" getter="is_enabler_enabled" default="true"> If [code]true[/code], [AnimationPlayer] nodes will be paused. @@ -44,7 +44,7 @@ This enabler will pause [AnimationPlayer] nodes. </constant> <constant name="ENABLER_FREEZE_BODIES" value="1" enum="Enabler"> - This enabler will freeze [RigidBody] nodes. + This enabler will freeze [RigidBody3D] nodes. </constant> <constant name="ENABLER_MAX" value="2" enum="Enabler"> Represents the size of the [enum Enabler] enum. diff --git a/doc/classes/VisibilityNotifier.xml b/doc/classes/VisibilityNotifier3D.xml index 6161017884..d8a605c69c 100644 --- a/doc/classes/VisibilityNotifier.xml +++ b/doc/classes/VisibilityNotifier3D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisibilityNotifier" inherits="Spatial" version="4.0"> +<class name="VisibilityNotifier3D" inherits="Node3D" version="4.0"> <brief_description> Detects when the node is visible on screen. </brief_description> <description> - The VisibilityNotifier detects when it is visible on the screen. It also notifies when its bounding rectangle enters or exits the screen or a [Camera]'s view. + The VisibilityNotifier3D detects when it is visible on the screen. It also notifies when its bounding rectangle enters or exits the screen or a [Camera3D]'s view. </description> <tutorials> </tutorials> @@ -20,32 +20,32 @@ </methods> <members> <member name="aabb" type="AABB" setter="set_aabb" getter="get_aabb" default="AABB( -1, -1, -1, 2, 2, 2 )"> - The VisibilityNotifier's bounding box. + The VisibilityNotifier3D's bounding box. </member> </members> <signals> <signal name="camera_entered"> - <argument index="0" name="camera" type="Camera"> + <argument index="0" name="camera" type="Camera3D"> </argument> <description> - Emitted when the VisibilityNotifier enters a [Camera]'s view. + Emitted when the VisibilityNotifier3D enters a [Camera3D]'s view. </description> </signal> <signal name="camera_exited"> - <argument index="0" name="camera" type="Camera"> + <argument index="0" name="camera" type="Camera3D"> </argument> <description> - Emitted when the VisibilityNotifier exits a [Camera]'s view. + Emitted when the VisibilityNotifier3D exits a [Camera3D]'s view. </description> </signal> <signal name="screen_entered"> <description> - Emitted when the VisibilityNotifier enters the screen. + Emitted when the VisibilityNotifier3D enters the screen. </description> </signal> <signal name="screen_exited"> <description> - Emitted when the VisibilityNotifier exits the screen. + Emitted when the VisibilityNotifier3D exits the screen. </description> </signal> </signals> diff --git a/doc/classes/VisualInstance.xml b/doc/classes/VisualInstance3D.xml index 1bbd5cb64d..6451b3f330 100644 --- a/doc/classes/VisualInstance.xml +++ b/doc/classes/VisualInstance3D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisualInstance" inherits="Spatial" version="4.0"> +<class name="VisualInstance3D" inherits="Node3D" version="4.0"> <brief_description> Parent of all visual 3D nodes. </brief_description> <description> - The [VisualInstance] is used to connect a resource to a visual representation. All visual 3D nodes inherit from the [VisualInstance]. In general, you should not access the [VisualInstance] properties directly as they are accessed and managed by the nodes that inherit from [VisualInstance]. [VisualInstance] is the node representation of the [VisualServer] instance. + The [VisualInstance3D] is used to connect a resource to a visual representation. All visual 3D nodes inherit from the [VisualInstance3D]. In general, you should not access the [VisualInstance3D] properties directly as they are accessed and managed by the nodes that inherit from [VisualInstance3D]. [VisualInstance3D] is the node representation of the [RenderingServer] instance. </description> <tutorials> </tutorials> @@ -13,21 +13,21 @@ <return type="AABB"> </return> <description> - Returns the [AABB] (also known as the bounding box) for this [VisualInstance]. + Returns the [AABB] (also known as the bounding box) for this [VisualInstance3D]. </description> </method> <method name="get_base" qualifiers="const"> <return type="RID"> </return> <description> - Returns the RID of the resource associated with this [VisualInstance]. For example, if the Node is a [MeshInstance], this will return the RID of the associated [Mesh]. + Returns the RID of the resource associated with this [VisualInstance3D]. For example, if the Node is a [MeshInstance3D], this will return the RID of the associated [Mesh]. </description> </method> <method name="get_instance" qualifiers="const"> <return type="RID"> </return> <description> - Returns the RID of this instance. This RID is the same as the RID returned by [method VisualServer.instance_create]. This RID is needed if you want to call [VisualServer] functions directly on this [VisualInstance]. + Returns the RID of this instance. This RID is the same as the RID returned by [method RenderingServer.instance_create]. This RID is needed if you want to call [RenderingServer] functions directly on this [VisualInstance3D]. </description> </method> <method name="get_layer_mask_bit" qualifiers="const"> @@ -43,8 +43,8 @@ <return type="AABB"> </return> <description> - Returns the transformed [AABB] (also known as the bounding box) for this [VisualInstance]. - Transformed in this case means the [AABB] plus the position, rotation, and scale of the [Spatial]'s [Transform]. + Returns the transformed [AABB] (also known as the bounding box) for this [VisualInstance3D]. + Transformed in this case means the [AABB] plus the position, rotation, and scale of the [Node3D]'s [Transform]. </description> </method> <method name="set_base"> @@ -53,7 +53,7 @@ <argument index="0" name="base" type="RID"> </argument> <description> - Sets the resource that is instantiated by this [VisualInstance], which changes how the engine handles the [VisualInstance] under the hood. Equivalent to [method VisualServer.instance_set_base]. + Sets the resource that is instantiated by this [VisualInstance3D], which changes how the engine handles the [VisualInstance3D] under the hood. Equivalent to [method RenderingServer.instance_set_base]. </description> </method> <method name="set_layer_mask_bit"> @@ -70,8 +70,8 @@ </methods> <members> <member name="layers" type="int" setter="set_layer_mask" getter="get_layer_mask" default="1"> - The render layer(s) this [VisualInstance] is drawn on. - This object will only be visible for [Camera]s whose cull mask includes the render object this [VisualInstance] is set to. + The render layer(s) this [VisualInstance3D] is drawn on. + This object will only be visible for [Camera3D]s whose cull mask includes the render object this [VisualInstance3D] is set to. </member> </members> <constants> diff --git a/doc/classes/Window.xml b/doc/classes/Window.xml new file mode 100644 index 0000000000..e1a0f1f22a --- /dev/null +++ b/doc/classes/Window.xml @@ -0,0 +1,419 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="Window" inherits="Viewport" version="4.0"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <methods> + <method name="can_draw" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> + <method name="child_controls_changed"> + <return type="void"> + </return> + <description> + </description> + </method> + <method name="get_flag" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="flag" type="int" enum="Window.Flags"> + </argument> + <description> + </description> + </method> + <method name="get_real_size" qualifiers="const"> + <return type="Vector2i"> + </return> + <description> + </description> + </method> + <method name="get_theme_color" qualifiers="const"> + <return type="Color"> + </return> + <argument index="0" name="name" type="StringName"> + </argument> + <argument index="1" name="type" type="StringName" default=""""> + </argument> + <description> + </description> + </method> + <method name="get_theme_constant" qualifiers="const"> + <return type="int"> + </return> + <argument index="0" name="name" type="StringName"> + </argument> + <argument index="1" name="type" type="StringName" default=""""> + </argument> + <description> + </description> + </method> + <method name="get_theme_font" qualifiers="const"> + <return type="Font"> + </return> + <argument index="0" name="name" type="StringName"> + </argument> + <argument index="1" name="type" type="StringName" default=""""> + </argument> + <description> + </description> + </method> + <method name="get_theme_icon" qualifiers="const"> + <return type="Texture2D"> + </return> + <argument index="0" name="name" type="StringName"> + </argument> + <argument index="1" name="type" type="StringName" default=""""> + </argument> + <description> + </description> + </method> + <method name="get_theme_stylebox" qualifiers="const"> + <return type="StyleBox"> + </return> + <argument index="0" name="name" type="StringName"> + </argument> + <argument index="1" name="type" type="StringName" default=""""> + </argument> + <description> + </description> + </method> + <method name="grab_focus"> + <return type="void"> + </return> + <description> + </description> + </method> + <method name="has_focus" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> + <method name="has_theme_color" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="name" type="StringName"> + </argument> + <argument index="1" name="type" type="StringName" default=""""> + </argument> + <description> + </description> + </method> + <method name="has_theme_constant" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="name" type="StringName"> + </argument> + <argument index="1" name="type" type="StringName" default=""""> + </argument> + <description> + </description> + </method> + <method name="has_theme_font" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="name" type="StringName"> + </argument> + <argument index="1" name="type" type="StringName" default=""""> + </argument> + <description> + </description> + </method> + <method name="has_theme_icon" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="name" type="StringName"> + </argument> + <argument index="1" name="type" type="StringName" default=""""> + </argument> + <description> + </description> + </method> + <method name="has_theme_stylebox" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="name" type="StringName"> + </argument> + <argument index="1" name="type" type="StringName" default=""""> + </argument> + <description> + </description> + </method> + <method name="hide"> + <return type="void"> + </return> + <description> + </description> + </method> + <method name="is_embedded" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> + <method name="is_maximize_allowed" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> + <method name="is_using_font_oversampling" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> + <method name="move_to_foreground"> + <return type="void"> + </return> + <description> + </description> + </method> + <method name="popup"> + <return type="void"> + </return> + <argument index="0" name="rect" type="Rect2i" default="Rect2i( 0, 0, 0, 0 )"> + </argument> + <description> + </description> + </method> + <method name="popup_centered"> + <return type="void"> + </return> + <argument index="0" name="minsize" type="Vector2i" default="Vector2i( 0, 0 )"> + </argument> + <description> + </description> + </method> + <method name="popup_centered_clamped"> + <return type="void"> + </return> + <argument index="0" name="minsize" type="Vector2i" default="Vector2i( 0, 0 )"> + </argument> + <argument index="1" name="fallback_ratio" type="float" default="0.75"> + </argument> + <description> + </description> + </method> + <method name="popup_centered_ratio"> + <return type="void"> + </return> + <argument index="0" name="ratio" type="float" default="0.8"> + </argument> + <description> + </description> + </method> + <method name="popup_on_parent"> + <return type="void"> + </return> + <argument index="0" name="parent_rect" type="Rect2i"> + </argument> + <description> + </description> + </method> + <method name="request_attention"> + <return type="void"> + </return> + <description> + </description> + </method> + <method name="set_flag"> + <return type="void"> + </return> + <argument index="0" name="flag" type="int" enum="Window.Flags"> + </argument> + <argument index="1" name="enabled" type="bool"> + </argument> + <description> + </description> + </method> + <method name="set_ime_active"> + <return type="void"> + </return> + <argument index="0" name="arg0" type="bool"> + </argument> + <description> + </description> + </method> + <method name="set_ime_position"> + <return type="void"> + </return> + <argument index="0" name="arg0" type="Vector2i"> + </argument> + <description> + </description> + </method> + <method name="set_use_font_oversampling"> + <return type="void"> + </return> + <argument index="0" name="enable" type="bool"> + </argument> + <description> + </description> + </method> + <method name="show"> + <return type="void"> + </return> + <description> + </description> + </method> + </methods> + <members> + <member name="always_on_top" type="bool" setter="set_flag" getter="get_flag" default="false"> + </member> + <member name="borderless" type="bool" setter="set_flag" getter="get_flag" default="false"> + </member> + <member name="content_scale_aspect" type="int" setter="set_content_scale_aspect" getter="get_content_scale_aspect" enum="Window.ContentScaleAspect" default="0"> + </member> + <member name="content_scale_mode" type="int" setter="set_content_scale_mode" getter="get_content_scale_mode" enum="Window.ContentScaleMode" default="0"> + </member> + <member name="content_scale_size" type="Vector2i" setter="set_content_scale_size" getter="get_content_scale_size" default="Vector2i( 0, 0 )"> + </member> + <member name="current_screen" type="int" setter="set_current_screen" getter="get_current_screen" default="0"> + </member> + <member name="exclusive" type="bool" setter="set_exclusive" getter="is_exclusive" default="false"> + </member> + <member name="max_size" type="Vector2i" setter="set_max_size" getter="get_max_size" default="Vector2i( 0, 0 )"> + </member> + <member name="min_size" type="Vector2i" setter="set_min_size" getter="get_min_size" default="Vector2i( 0, 0 )"> + </member> + <member name="mode" type="int" setter="set_mode" getter="get_mode" enum="Window.Mode" default="0"> + </member> + <member name="position" type="Vector2i" setter="set_position" getter="get_position" default="Vector2i( 0, 0 )"> + </member> + <member name="size" type="Vector2i" setter="set_size" getter="get_size" default="Vector2i( 100, 100 )"> + </member> + <member name="theme" type="Theme" setter="set_theme" getter="get_theme"> + </member> + <member name="title" type="String" setter="set_title" getter="get_title" default=""""> + </member> + <member name="transient" type="bool" setter="set_transient" getter="is_transient" default="false"> + </member> + <member name="transparent" type="bool" setter="set_flag" getter="get_flag" default="false"> + </member> + <member name="unfocusable" type="bool" setter="set_flag" getter="get_flag" default="false"> + </member> + <member name="unresizable" type="bool" setter="set_flag" getter="get_flag" default="false"> + </member> + <member name="visible" type="bool" setter="set_visible" getter="is_visible" default="true"> + </member> + <member name="wrap_controls" type="bool" setter="set_wrap_controls" getter="is_wrapping_controls" default="false"> + </member> + </members> + <signals> + <signal name="about_to_popup"> + <description> + </description> + </signal> + <signal name="close_requested"> + <description> + </description> + </signal> + <signal name="files_dropped"> + <argument index="0" name="files" type="PackedStringArray"> + </argument> + <description> + </description> + </signal> + <signal name="focus_entered"> + <description> + </description> + </signal> + <signal name="focus_exited"> + <description> + </description> + </signal> + <signal name="go_back_requested"> + <description> + </description> + </signal> + <signal name="mouse_entered"> + <description> + </description> + </signal> + <signal name="mouse_exited"> + <description> + </description> + </signal> + <signal name="visibility_changed"> + <description> + </description> + </signal> + <signal name="window_input"> + <argument index="0" name="event" type="InputEvent"> + </argument> + <description> + </description> + </signal> + </signals> + <constants> + <constant name="NOTIFICATION_VISIBILITY_CHANGED" value="30"> + </constant> + <constant name="MODE_WINDOWED" value="0" enum="Mode"> + </constant> + <constant name="MODE_MINIMIZED" value="1" enum="Mode"> + </constant> + <constant name="MODE_MAXIMIZED" value="2" enum="Mode"> + </constant> + <constant name="MODE_FULLSCREEN" value="3" enum="Mode"> + </constant> + <constant name="FLAG_RESIZE_DISABLED" value="0" enum="Flags"> + </constant> + <constant name="FLAG_BORDERLESS" value="1" enum="Flags"> + </constant> + <constant name="FLAG_ALWAYS_ON_TOP" value="2" enum="Flags"> + </constant> + <constant name="FLAG_TRANSPARENT" value="3" enum="Flags"> + </constant> + <constant name="FLAG_NO_FOCUS" value="4" enum="Flags"> + </constant> + <constant name="FLAG_MAX" value="5" enum="Flags"> + </constant> + <constant name="CONTENT_SCALE_MODE_DISABLED" value="0" enum="ContentScaleMode"> + </constant> + <constant name="CONTENT_SCALE_MODE_OBJECTS" value="1" enum="ContentScaleMode"> + </constant> + <constant name="CONTENT_SCALE_MODE_PIXELS" value="2" enum="ContentScaleMode"> + </constant> + <constant name="CONTENT_SCALE_ASPECT_IGNORE" value="0" enum="ContentScaleAspect"> + </constant> + <constant name="CONTENT_SCALE_ASPECT_KEEP" value="1" enum="ContentScaleAspect"> + </constant> + <constant name="CONTENT_SCALE_ASPECT_KEEP_WIDTH" value="2" enum="ContentScaleAspect"> + </constant> + <constant name="CONTENT_SCALE_ASPECT_KEEP_HEIGHT" value="3" enum="ContentScaleAspect"> + </constant> + <constant name="CONTENT_SCALE_ASPECT_EXPAND" value="4" enum="ContentScaleAspect"> + </constant> + </constants> + <theme_items> + <theme_item name="close" type="Texture2D"> + </theme_item> + <theme_item name="close_h_ofs" type="int" default="18"> + </theme_item> + <theme_item name="close_highlight" type="Texture2D"> + </theme_item> + <theme_item name="close_v_ofs" type="int" default="18"> + </theme_item> + <theme_item name="panel" type="StyleBox"> + </theme_item> + <theme_item name="resize_margin" type="int" default="4"> + </theme_item> + <theme_item name="scaleborder_size" type="int" default="4"> + </theme_item> + <theme_item name="title_color" type="Color" default="Color( 0, 0, 0, 1 )"> + </theme_item> + <theme_item name="title_font" type="Font"> + </theme_item> + <theme_item name="title_height" type="int" default="20"> + </theme_item> + <theme_item name="window_panel" type="StyleBox"> + </theme_item> + </theme_items> +</class> diff --git a/doc/classes/WindowDialog.xml b/doc/classes/WindowDialog.xml deleted file mode 100644 index 8b6bf00508..0000000000 --- a/doc/classes/WindowDialog.xml +++ /dev/null @@ -1,59 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<class name="WindowDialog" inherits="Popup" version="4.0"> - <brief_description> - Base class for window dialogs. - </brief_description> - <description> - Windowdialog is the base class for all window-based dialogs. It's a by-default toplevel [Control] that draws a window decoration and allows motion and resizing. - </description> - <tutorials> - </tutorials> - <methods> - <method name="get_close_button"> - <return type="TextureButton"> - </return> - <description> - Returns the close [TextureButton]. - </description> - </method> - </methods> - <members> - <member name="resizable" type="bool" setter="set_resizable" getter="get_resizable" default="false"> - If [code]true[/code], the user can resize the window. - </member> - <member name="window_title" type="String" setter="set_title" getter="get_title" default=""""> - The text displayed in the window's title bar. - </member> - </members> - <constants> - </constants> - <theme_items> - <theme_item name="close" type="Texture2D"> - The icon for the close button. - </theme_item> - <theme_item name="close_h_ofs" type="int" default="18"> - The horizontal offset of the close button. - </theme_item> - <theme_item name="close_highlight" type="Texture2D"> - The icon used for the close button when it's hovered with the mouse cursor. - </theme_item> - <theme_item name="close_v_ofs" type="int" default="18"> - The vertical offset of the close button. - </theme_item> - <theme_item name="panel" type="StyleBox"> - The style for both the content background of the [WindowDialog] and the title bar. - </theme_item> - <theme_item name="scaleborder_size" type="int" default="4"> - The thickness of the border that can be dragged when scaling the window (if [member resizable] is enabled). - </theme_item> - <theme_item name="title_color" type="Color" default="Color( 0, 0, 0, 1 )"> - The color of the title text. - </theme_item> - <theme_item name="title_font" type="Font"> - The font used to draw the title. - </theme_item> - <theme_item name="title_height" type="int" default="20"> - The vertical offset of the title text. - </theme_item> - </theme_items> -</class> diff --git a/doc/classes/World2D.xml b/doc/classes/World2D.xml index 9e2d4cfde3..2d8382b7e3 100644 --- a/doc/classes/World2D.xml +++ b/doc/classes/World2D.xml @@ -13,13 +13,13 @@ </methods> <members> <member name="canvas" type="RID" setter="" getter="get_canvas"> - The [RID] of this world's canvas resource. Used by the [VisualServer] for 2D drawing. + The [RID] of this world's canvas resource. Used by the [RenderingServer] for 2D drawing. </member> - <member name="direct_space_state" type="Physics2DDirectSpaceState" setter="" getter="get_direct_space_state"> + <member name="direct_space_state" type="PhysicsDirectSpaceState2D" setter="" getter="get_direct_space_state"> The state of this world's physics space. This allows arbitrary querying for collision. </member> <member name="space" type="RID" setter="" getter="get_space"> - The [RID] of this world's physics space resource. Used by the [Physics2DServer] for 2D physics, treating it as both a space and an area. + The [RID] of this world's physics space resource. Used by the [PhysicsServer2D] for 2D physics, treating it as both a space and an area. </member> </members> <constants> diff --git a/doc/classes/World.xml b/doc/classes/World3D.xml index 48596c87d0..4224a2a2c3 100644 --- a/doc/classes/World.xml +++ b/doc/classes/World3D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="World" inherits="Resource" version="4.0"> +<class name="World3D" inherits="Resource" version="4.0"> <brief_description> Class that has everything pertaining to a world. </brief_description> <description> - Class that has everything pertaining to a world. A physics space, a visual scenario and a sound space. Spatial nodes register their resources into the current world. + Class that has everything pertaining to a world. A physics space, a visual scenario and a sound space. Node3D nodes register their resources into the current world. </description> <tutorials> <link>https://docs.godotengine.org/en/latest/tutorials/physics/ray-casting.html</link> @@ -14,20 +14,20 @@ <members> <member name="camera_effects" type="CameraEffects" setter="set_camera_effects" getter="get_camera_effects"> </member> - <member name="direct_space_state" type="PhysicsDirectSpaceState" setter="" getter="get_direct_space_state"> - The World's physics direct space state, used for making various queries. Might be used only during [code]_physics_process[/code]. + <member name="direct_space_state" type="PhysicsDirectSpaceState3D" setter="" getter="get_direct_space_state"> + The World3D's physics direct space state, used for making various queries. Might be used only during [code]_physics_process[/code]. </member> <member name="environment" type="Environment" setter="set_environment" getter="get_environment"> - The World's [Environment]. + The World3D's [Environment]. </member> <member name="fallback_environment" type="Environment" setter="set_fallback_environment" getter="get_fallback_environment"> - The World's fallback_environment will be used if the World's [Environment] fails or is missing. + The World3D's fallback_environment will be used if the World3D's [Environment] fails or is missing. </member> <member name="scenario" type="RID" setter="" getter="get_scenario"> - The World's visual scenario. + The World3D's visual scenario. </member> <member name="space" type="RID" setter="" getter="get_space"> - The World's physics space. + The World3D's physics space. </member> </members> <constants> diff --git a/doc/classes/WorldEnvironment.xml b/doc/classes/WorldEnvironment.xml index 73500868a8..92b75621c2 100644 --- a/doc/classes/WorldEnvironment.xml +++ b/doc/classes/WorldEnvironment.xml @@ -5,7 +5,7 @@ </brief_description> <description> The [WorldEnvironment] node is used to configure the default [Environment] for the scene. - The parameters defined in the [WorldEnvironment] can be overridden by an [Environment] node set on the current [Camera]. Additionally, only one [WorldEnvironment] may be instanced in a given scene at a time. + The parameters defined in the [WorldEnvironment] can be overridden by an [Environment] node set on the current [Camera3D]. Additionally, only one [WorldEnvironment] may be instanced in a given scene at a time. The [WorldEnvironment] allows the user to specify default lighting parameters (e.g. ambient lighting), various post-processing effects (e.g. SSAO, DOF, Tonemapping), and how to draw the background (e.g. solid color, skybox). Usually, these are added in order to improve the realism/color balance of the scene. </description> <tutorials> diff --git a/doc/classes/WorldMarginShape.xml b/doc/classes/WorldMarginShape3D.xml index 54f76a066b..a91447056b 100644 --- a/doc/classes/WorldMarginShape.xml +++ b/doc/classes/WorldMarginShape3D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="WorldMarginShape" inherits="Shape" version="4.0"> +<class name="WorldMarginShape3D" inherits="Shape3D" version="4.0"> <brief_description> Infinite plane shape for 3D collisions. </brief_description> <description> - An infinite plane shape for 3D collisions. Note that the [Plane]'s normal matters; anything "below" the plane will collide with it. If the [WorldMarginShape] is used in a [PhysicsBody], it will cause colliding objects placed "below" it to teleport "above" the plane. + An infinite plane shape for 3D collisions. Note that the [Plane]'s normal matters; anything "below" the plane will collide with it. If the [WorldMarginShape3D] is used in a [PhysicsBody3D], it will cause colliding objects placed "below" it to teleport "above" the plane. </description> <tutorials> </tutorials> @@ -12,7 +12,7 @@ </methods> <members> <member name="plane" type="Plane" setter="set_plane" getter="get_plane" default="Plane( 0, 1, 0, 0 )"> - The [Plane] used by the [WorldMarginShape] for collision. + The [Plane] used by the [WorldMarginShape3D] for collision. </member> </members> <constants> diff --git a/doc/tools/doc_merge.py b/doc/tools/doc_merge.py index 496d5dcb74..f6f52f5d66 100755 --- a/doc/tools/doc_merge.py +++ b/doc/tools/doc_merge.py @@ -21,7 +21,7 @@ def write_string(_f, text, newline=True): for t in range(tab): _f.write("\t") _f.write(text) - if (newline): + if newline: _f.write("\n") @@ -30,7 +30,7 @@ def escape(ret): ret = ret.replace("<", ">") ret = ret.replace(">", "<") ret = ret.replace("'", "'") - ret = ret.replace("\"", """) + ret = ret.replace('"', """) return ret @@ -43,25 +43,26 @@ def dec_tab(): global tab tab -= 1 + write_string(f, '<?xml version="1.0" encoding="UTF-8" ?>') write_string(f, '<doc version="' + new_doc.attrib["version"] + '">') def get_tag(node, name): tag = "" - if (name in node.attrib): - tag = ' ' + name + '="' + escape(node.attrib[name]) + '" ' + if name in node.attrib: + tag = " " + name + '="' + escape(node.attrib[name]) + '" ' return tag def find_method_descr(old_class, name): methods = old_class.find("methods") - if(methods != None and len(list(methods)) > 0): + if methods != None and len(list(methods)) > 0: for m in list(methods): - if (m.attrib["name"] == name): + if m.attrib["name"] == name: description = m.find("description") - if (description != None and description.text.strip() != ""): + if description != None and description.text.strip() != "": return description.text return None @@ -70,11 +71,11 @@ def find_method_descr(old_class, name): def find_signal_descr(old_class, name): signals = old_class.find("signals") - if(signals != None and len(list(signals)) > 0): + if signals != None and len(list(signals)) > 0: for m in list(signals): - if (m.attrib["name"] == name): + if m.attrib["name"] == name: description = m.find("description") - if (description != None and description.text.strip() != ""): + if description != None and description.text.strip() != "": return description.text return None @@ -82,13 +83,13 @@ def find_signal_descr(old_class, name): def find_constant_descr(old_class, name): - if (old_class is None): + if old_class is None: return None constants = old_class.find("constants") - if(constants != None and len(list(constants)) > 0): + if constants != None and len(list(constants)) > 0: for m in list(constants): - if (m.attrib["name"] == name): - if (m.text.strip() != ""): + if m.attrib["name"] == name: + if m.text.strip() != "": return m.text return None @@ -96,35 +97,35 @@ def find_constant_descr(old_class, name): def write_class(c): class_name = c.attrib["name"] print("Parsing Class: " + class_name) - if (class_name in old_classes): + if class_name in old_classes: old_class = old_classes[class_name] else: old_class = None category = get_tag(c, "category") inherits = get_tag(c, "inherits") - write_string(f, '<class name="' + class_name + '" ' + category + inherits + '>') + write_string(f, '<class name="' + class_name + '" ' + category + inherits + ">") inc_tab() write_string(f, "<brief_description>") - if (old_class != None): + if old_class != None: old_brief_descr = old_class.find("brief_description") - if (old_brief_descr != None): + if old_brief_descr != None: write_string(f, escape(old_brief_descr.text.strip())) write_string(f, "</brief_description>") write_string(f, "<description>") - if (old_class != None): + if old_class != None: old_descr = old_class.find("description") - if (old_descr != None): + if old_descr != None: write_string(f, escape(old_descr.text.strip())) write_string(f, "</description>") methods = c.find("methods") - if(methods != None and len(list(methods)) > 0): + if methods != None and len(list(methods)) > 0: write_string(f, "<methods>") inc_tab() @@ -132,35 +133,46 @@ def write_class(c): for m in list(methods): qualifiers = get_tag(m, "qualifiers") - write_string(f, '<method name="' + escape(m.attrib["name"]) + '" ' + qualifiers + '>') + write_string(f, '<method name="' + escape(m.attrib["name"]) + '" ' + qualifiers + ">") inc_tab() for a in list(m): - if (a.tag == "return"): + if a.tag == "return": typ = get_tag(a, "type") - write_string(f, '<return' + typ + '>') - write_string(f, '</return>') - elif (a.tag == "argument"): + write_string(f, "<return" + typ + ">") + write_string(f, "</return>") + elif a.tag == "argument": default = get_tag(a, "default") - write_string(f, '<argument index="' + a.attrib["index"] + '" name="' + escape(a.attrib["name"]) + '" type="' + a.attrib["type"] + '"' + default + '>') - write_string(f, '</argument>') - - write_string(f, '<description>') - if (old_class != None): + write_string( + f, + '<argument index="' + + a.attrib["index"] + + '" name="' + + escape(a.attrib["name"]) + + '" type="' + + a.attrib["type"] + + '"' + + default + + ">", + ) + write_string(f, "</argument>") + + write_string(f, "<description>") + if old_class != None: old_method_descr = find_method_descr(old_class, m.attrib["name"]) - if (old_method_descr): + if old_method_descr: write_string(f, escape(escape(old_method_descr.strip()))) - write_string(f, '</description>') + write_string(f, "</description>") dec_tab() write_string(f, "</method>") dec_tab() write_string(f, "</methods>") signals = c.find("signals") - if(signals != None and len(list(signals)) > 0): + if signals != None and len(list(signals)) > 0: write_string(f, "<signals>") inc_tab() @@ -171,24 +183,33 @@ def write_class(c): inc_tab() for a in list(m): - if (a.tag == "argument"): - - write_string(f, '<argument index="' + a.attrib["index"] + '" name="' + escape(a.attrib["name"]) + '" type="' + a.attrib["type"] + '">') - write_string(f, '</argument>') - - write_string(f, '<description>') - if (old_class != None): + if a.tag == "argument": + + write_string( + f, + '<argument index="' + + a.attrib["index"] + + '" name="' + + escape(a.attrib["name"]) + + '" type="' + + a.attrib["type"] + + '">', + ) + write_string(f, "</argument>") + + write_string(f, "<description>") + if old_class != None: old_signal_descr = find_signal_descr(old_class, m.attrib["name"]) - if (old_signal_descr): + if old_signal_descr: write_string(f, escape(old_signal_descr.strip())) - write_string(f, '</description>') + write_string(f, "</description>") dec_tab() write_string(f, "</signal>") dec_tab() write_string(f, "</signals>") constants = c.find("constants") - if(constants != None and len(list(constants)) > 0): + if constants != None and len(list(constants)) > 0: write_string(f, "<constants>") inc_tab() @@ -197,7 +218,7 @@ def write_class(c): write_string(f, '<constant name="' + escape(m.attrib["name"]) + '" value="' + m.attrib["value"] + '">') old_constant_descr = find_constant_descr(old_class, m.attrib["name"]) - if (old_constant_descr): + if old_constant_descr: write_string(f, escape(old_constant_descr.strip())) write_string(f, "</constant>") @@ -207,9 +228,10 @@ def write_class(c): dec_tab() write_string(f, "</class>") + for c in list(old_doc): old_classes[c.attrib["name"]] = c for c in list(new_doc): write_class(c) -write_string(f, '</doc>\n') +write_string(f, "</doc>\n") diff --git a/doc/tools/doc_status.py b/doc/tools/doc_status.py index e6e6d5f606..629b5a032b 100755 --- a/doc/tools/doc_status.py +++ b/doc/tools/doc_status.py @@ -13,75 +13,74 @@ import xml.etree.ElementTree as ET ################################################################################ flags = { - 'c': platform.platform() != 'Windows', # Disable by default on windows, since we use ANSI escape codes - 'b': False, - 'g': False, - 's': False, - 'u': False, - 'h': False, - 'p': False, - 'o': True, - 'i': False, - 'a': True, - 'e': False, + "c": platform.platform() != "Windows", # Disable by default on windows, since we use ANSI escape codes + "b": False, + "g": False, + "s": False, + "u": False, + "h": False, + "p": False, + "o": True, + "i": False, + "a": True, + "e": False, } flag_descriptions = { - 'c': 'Toggle colors when outputting.', - 'b': 'Toggle showing only not fully described classes.', - 'g': 'Toggle showing only completed classes.', - 's': 'Toggle showing comments about the status.', - 'u': 'Toggle URLs to docs.', - 'h': 'Show help and exit.', - 'p': 'Toggle showing percentage as well as counts.', - 'o': 'Toggle overall column.', - 'i': 'Toggle collapse of class items columns.', - 'a': 'Toggle showing all items.', - 'e': 'Toggle hiding empty items.', + "c": "Toggle colors when outputting.", + "b": "Toggle showing only not fully described classes.", + "g": "Toggle showing only completed classes.", + "s": "Toggle showing comments about the status.", + "u": "Toggle URLs to docs.", + "h": "Show help and exit.", + "p": "Toggle showing percentage as well as counts.", + "o": "Toggle overall column.", + "i": "Toggle collapse of class items columns.", + "a": "Toggle showing all items.", + "e": "Toggle hiding empty items.", } long_flags = { - 'colors': 'c', - 'use-colors': 'c', - - 'bad': 'b', - 'only-bad': 'b', - - 'good': 'g', - 'only-good': 'g', - - 'comments': 's', - 'status': 's', - - 'urls': 'u', - 'gen-url': 'u', - - 'help': 'h', - - 'percent': 'p', - 'use-percentages': 'p', - - 'overall': 'o', - 'use-overall': 'o', - - 'items': 'i', - 'collapse': 'i', - - 'all': 'a', - - 'empty': 'e', + "colors": "c", + "use-colors": "c", + "bad": "b", + "only-bad": "b", + "good": "g", + "only-good": "g", + "comments": "s", + "status": "s", + "urls": "u", + "gen-url": "u", + "help": "h", + "percent": "p", + "use-percentages": "p", + "overall": "o", + "use-overall": "o", + "items": "i", + "collapse": "i", + "all": "a", + "empty": "e", } -table_columns = ['name', 'brief_description', 'description', 'methods', 'constants', 'members', 'signals', 'theme_items'] -table_column_names = ['Name', 'Brief Desc.', 'Desc.', 'Methods', 'Constants', 'Members', 'Signals', 'Theme Items'] +table_columns = [ + "name", + "brief_description", + "description", + "methods", + "constants", + "members", + "signals", + "theme_items", +] +table_column_names = ["Name", "Brief Desc.", "Desc.", "Methods", "Constants", "Members", "Signals", "Theme Items"] colors = { - 'name': [36], # cyan - 'part_big_problem': [4, 31], # underline, red - 'part_problem': [31], # red - 'part_mostly_good': [33], # yellow - 'part_good': [32], # green - 'url': [4, 34], # underline, blue - 'section': [1, 4], # bold, underline - 'state_off': [36], # cyan - 'state_on': [1, 35], # bold, magenta/plum - 'bold': [1], # bold + "name": [36], # cyan + "part_big_problem": [4, 31], # underline, red + "part_problem": [31], # red + "part_mostly_good": [33], # yellow + "part_good": [32], # green + "url": [4, 34], # underline, blue + "section": [1, 4], # bold, underline + "state_off": [36], # cyan + "state_on": [1, 35], # bold, magenta/plum + "bold": [1], # bold } overall_progress_description_weigth = 10 @@ -90,6 +89,7 @@ overall_progress_description_weigth = 10 # Utils # ################################################################################ + def validate_tag(elem, tag): if elem.tag != tag: print('Tag mismatch, expected "' + tag + '", got ' + elem.tag) @@ -97,36 +97,38 @@ def validate_tag(elem, tag): def color(color, string): - if flags['c'] and terminal_supports_color(): - color_format = '' + if flags["c"] and terminal_supports_color(): + color_format = "" for code in colors[color]: - color_format += '\033[' + str(code) + 'm' - return color_format + string + '\033[0m' + color_format += "\033[" + str(code) + "m" + return color_format + string + "\033[0m" else: return string -ansi_escape = re.compile(r'\x1b[^m]*m') + +ansi_escape = re.compile(r"\x1b[^m]*m") def nonescape_len(s): - return len(ansi_escape.sub('', s)) + return len(ansi_escape.sub("", s)) + def terminal_supports_color(): p = sys.platform - supported_platform = p != 'Pocket PC' and (p != 'win32' or - 'ANSICON' in os.environ) + supported_platform = p != "Pocket PC" and (p != "win32" or "ANSICON" in os.environ) - is_a_tty = hasattr(sys.stdout, 'isatty') and sys.stdout.isatty() + is_a_tty = hasattr(sys.stdout, "isatty") and sys.stdout.isatty() if not supported_platform or not is_a_tty: return False return True + ################################################################################ # Classes # ################################################################################ -class ClassStatusProgress: +class ClassStatusProgress: def __init__(self, described=0, total=0): self.described = described self.total = total @@ -143,42 +145,41 @@ class ClassStatusProgress: return self.described >= self.total def to_configured_colored_string(self): - if flags['p']: - return self.to_colored_string('{percent}% ({has}/{total})', '{pad_percent}{pad_described}{s}{pad_total}') + if flags["p"]: + return self.to_colored_string("{percent}% ({has}/{total})", "{pad_percent}{pad_described}{s}{pad_total}") else: return self.to_colored_string() - def to_colored_string(self, format='{has}/{total}', pad_format='{pad_described}{s}{pad_total}'): + def to_colored_string(self, format="{has}/{total}", pad_format="{pad_described}{s}{pad_total}"): ratio = float(self.described) / float(self.total) if self.total != 0 else 1 percent = int(round(100 * ratio)) s = format.format(has=str(self.described), total=str(self.total), percent=str(percent)) if self.described >= self.total: - s = color('part_good', s) + s = color("part_good", s) elif self.described >= self.total / 4 * 3: - s = color('part_mostly_good', s) + s = color("part_mostly_good", s) elif self.described > 0: - s = color('part_problem', s) + s = color("part_problem", s) else: - s = color('part_big_problem', s) + s = color("part_big_problem", s) pad_size = max(len(str(self.described)), len(str(self.total))) - pad_described = ''.ljust(pad_size - len(str(self.described))) - pad_percent = ''.ljust(3 - len(str(percent))) - pad_total = ''.ljust(pad_size - len(str(self.total))) + pad_described = "".ljust(pad_size - len(str(self.described))) + pad_percent = "".ljust(3 - len(str(percent))) + pad_total = "".ljust(pad_size - len(str(self.total))) return pad_format.format(pad_described=pad_described, pad_total=pad_total, pad_percent=pad_percent, s=s) class ClassStatus: - - def __init__(self, name=''): + def __init__(self, name=""): self.name = name self.has_brief_description = True self.has_description = True self.progresses = { - 'methods': ClassStatusProgress(), - 'constants': ClassStatusProgress(), - 'members': ClassStatusProgress(), - 'theme_items': ClassStatusProgress(), - 'signals': ClassStatusProgress() + "methods": ClassStatusProgress(), + "constants": ClassStatusProgress(), + "members": ClassStatusProgress(), + "theme_items": ClassStatusProgress(), + "signals": ClassStatusProgress(), } def __add__(self, other): @@ -208,66 +209,70 @@ class ClassStatus: def make_output(self): output = {} - output['name'] = color('name', self.name) + output["name"] = color("name", self.name) - ok_string = color('part_good', 'OK') - missing_string = color('part_big_problem', 'MISSING') + ok_string = color("part_good", "OK") + missing_string = color("part_big_problem", "MISSING") - output['brief_description'] = ok_string if self.has_brief_description else missing_string - output['description'] = ok_string if self.has_description else missing_string + output["brief_description"] = ok_string if self.has_brief_description else missing_string + output["description"] = ok_string if self.has_description else missing_string description_progress = ClassStatusProgress( (self.has_brief_description + self.has_description) * overall_progress_description_weigth, - 2 * overall_progress_description_weigth + 2 * overall_progress_description_weigth, ) items_progress = ClassStatusProgress() - for k in ['methods', 'constants', 'members', 'signals', 'theme_items']: + for k in ["methods", "constants", "members", "signals", "theme_items"]: items_progress += self.progresses[k] output[k] = self.progresses[k].to_configured_colored_string() - output['items'] = items_progress.to_configured_colored_string() + output["items"] = items_progress.to_configured_colored_string() - output['overall'] = (description_progress + items_progress).to_colored_string(color('bold', '{percent}%'), '{pad_percent}{s}') + output["overall"] = (description_progress + items_progress).to_colored_string( + color("bold", "{percent}%"), "{pad_percent}{s}" + ) - if self.name.startswith('Total'): - output['url'] = color('url', 'https://docs.godotengine.org/en/latest/classes/') - if flags['s']: - output['comment'] = color('part_good', 'ALL OK') + if self.name.startswith("Total"): + output["url"] = color("url", "https://docs.godotengine.org/en/latest/classes/") + if flags["s"]: + output["comment"] = color("part_good", "ALL OK") else: - output['url'] = color('url', 'https://docs.godotengine.org/en/latest/classes/class_{name}.html'.format(name=self.name.lower())) + output["url"] = color( + "url", "https://docs.godotengine.org/en/latest/classes/class_{name}.html".format(name=self.name.lower()) + ) - if flags['s'] and not flags['g'] and self.is_ok(): - output['comment'] = color('part_good', 'ALL OK') + if flags["s"] and not flags["g"] and self.is_ok(): + output["comment"] = color("part_good", "ALL OK") return output @staticmethod def generate_for_class(c): status = ClassStatus() - status.name = c.attrib['name'] + status.name = c.attrib["name"] for tag in list(c): - if tag.tag == 'brief_description': + if tag.tag == "brief_description": status.has_brief_description = len(tag.text.strip()) > 0 - elif tag.tag == 'description': + elif tag.tag == "description": status.has_description = len(tag.text.strip()) > 0 - elif tag.tag in ['methods', 'signals']: + elif tag.tag in ["methods", "signals"]: for sub_tag in list(tag): - descr = sub_tag.find('description') + descr = sub_tag.find("description") status.progresses[tag.tag].increment(len(descr.text.strip()) > 0) - elif tag.tag in ['constants', 'members', 'theme_items']: + elif tag.tag in ["constants", "members", "theme_items"]: for sub_tag in list(tag): if not sub_tag.text is None: status.progresses[tag.tag].increment(len(sub_tag.text.strip()) > 0) - elif tag.tag in ['tutorials']: + elif tag.tag in ["tutorials"]: pass # Ignore those tags for now - elif tag.tag in ['theme_items']: + elif tag.tag in ["theme_items"]: pass # Ignore those tags, since they seem to lack description at all else: @@ -286,63 +291,69 @@ merged_file = "" for arg in sys.argv[1:]: try: - if arg.startswith('--'): + if arg.startswith("--"): flags[long_flags[arg[2:]]] = not flags[long_flags[arg[2:]]] - elif arg.startswith('-'): + elif arg.startswith("-"): for f in arg[1:]: flags[f] = not flags[f] elif os.path.isdir(arg): for f in os.listdir(arg): - if f.endswith('.xml'): - input_file_list.append(os.path.join(arg, f)); + if f.endswith(".xml"): + input_file_list.append(os.path.join(arg, f)) else: input_class_list.append(arg) except KeyError: print("Unknown command line flag: " + arg) sys.exit(1) -if flags['i']: - for r in ['methods', 'constants', 'members', 'signals', 'theme_items']: +if flags["i"]: + for r in ["methods", "constants", "members", "signals", "theme_items"]: index = table_columns.index(r) del table_column_names[index] del table_columns[index] - table_column_names.append('Items') - table_columns.append('items') + table_column_names.append("Items") + table_columns.append("items") -if flags['o'] == (not flags['i']): - table_column_names.append(color('bold', 'Overall')) - table_columns.append('overall') +if flags["o"] == (not flags["i"]): + table_column_names.append(color("bold", "Overall")) + table_columns.append("overall") -if flags['u']: - table_column_names.append('Docs URL') - table_columns.append('url') +if flags["u"]: + table_column_names.append("Docs URL") + table_columns.append("url") ################################################################################ # Help # ################################################################################ -if len(input_file_list) < 1 or flags['h']: - if not flags['h']: - print(color('section', 'Invalid usage') + ': Please specify a classes directory') - print(color('section', 'Usage') + ': doc_status.py [flags] <classes_dir> [class names]') - print('\t< and > signify required parameters, while [ and ] signify optional parameters.') - print(color('section', 'Available flags') + ':') +if len(input_file_list) < 1 or flags["h"]: + if not flags["h"]: + print(color("section", "Invalid usage") + ": Please specify a classes directory") + print(color("section", "Usage") + ": doc_status.py [flags] <classes_dir> [class names]") + print("\t< and > signify required parameters, while [ and ] signify optional parameters.") + print(color("section", "Available flags") + ":") possible_synonym_list = list(long_flags) possible_synonym_list.sort() flag_list = list(flags) flag_list.sort() for flag in flag_list: - synonyms = [color('name', '-' + flag)] + synonyms = [color("name", "-" + flag)] for synonym in possible_synonym_list: if long_flags[synonym] == flag: - synonyms.append(color('name', '--' + synonym)) - - print(('{synonyms} (Currently ' + color('state_' + ('on' if flags[flag] else 'off'), '{value}') + ')\n\t{description}').format( - synonyms=', '.join(synonyms), - value=('on' if flags[flag] else 'off'), - description=flag_descriptions[flag] - )) + synonyms.append(color("name", "--" + synonym)) + + print( + ( + "{synonyms} (Currently " + + color("state_" + ("on" if flags[flag] else "off"), "{value}") + + ")\n\t{description}" + ).format( + synonyms=", ".join(synonyms), + value=("on" if flags[flag] else "off"), + description=flag_descriptions[flag], + ) + ) sys.exit(0) @@ -357,21 +368,21 @@ for file in input_file_list: tree = ET.parse(file) doc = tree.getroot() - if 'version' not in doc.attrib: + if "version" not in doc.attrib: print('Version missing from "doc"') sys.exit(255) - version = doc.attrib['version'] + version = doc.attrib["version"] - if doc.attrib['name'] in class_names: + if doc.attrib["name"] in class_names: continue - class_names.append(doc.attrib['name']) - classes[doc.attrib['name']] = doc + class_names.append(doc.attrib["name"]) + classes[doc.attrib["name"]] = doc class_names.sort() if len(input_class_list) < 1: - input_class_list = ['*'] + input_class_list = ["*"] filtered_classes = set() for pattern in input_class_list: @@ -384,23 +395,23 @@ filtered_classes.sort() ################################################################################ table = [table_column_names] -table_row_chars = '| - ' -table_column_chars = '|' +table_row_chars = "| - " +table_column_chars = "|" -total_status = ClassStatus('Total') +total_status = ClassStatus("Total") for cn in filtered_classes: c = classes[cn] - validate_tag(c, 'class') + validate_tag(c, "class") status = ClassStatus.generate_for_class(c) total_status = total_status + status - if (flags['b'] and status.is_ok()) or (flags['g'] and not status.is_ok()) or (not flags['a']): + if (flags["b"] and status.is_ok()) or (flags["g"] and not status.is_ok()) or (not flags["a"]): continue - if flags['e'] and status.is_empty(): + if flags["e"] and status.is_empty(): continue out = status.make_output() @@ -409,10 +420,10 @@ for cn in filtered_classes: if column in out: row.append(out[column]) else: - row.append('') + row.append("") - if 'comment' in out and out['comment'] != '': - row.append(out['comment']) + if "comment" in out and out["comment"] != "": + row.append(out["comment"]) table.append(row) @@ -421,22 +432,22 @@ for cn in filtered_classes: # Print output table # ################################################################################ -if len(table) == 1 and flags['a']: - print(color('part_big_problem', 'No classes suitable for printing!')) +if len(table) == 1 and flags["a"]: + print(color("part_big_problem", "No classes suitable for printing!")) sys.exit(0) -if len(table) > 2 or not flags['a']: - total_status.name = 'Total = {0}'.format(len(table) - 1) +if len(table) > 2 or not flags["a"]: + total_status.name = "Total = {0}".format(len(table) - 1) out = total_status.make_output() row = [] for column in table_columns: if column in out: row.append(out[column]) else: - row.append('') + row.append("") table.append(row) -if flags['a']: +if flags["a"]: # Duplicate the headers at the bottom of the table so they can be viewed # without having to scroll back to the top. table.append(table_column_names) @@ -451,7 +462,9 @@ for row in table: divider_string = table_row_chars[0] for cell_i in range(len(table[0])): - divider_string += table_row_chars[1] + table_row_chars[2] * (table_column_sizes[cell_i]) + table_row_chars[1] + table_row_chars[0] + divider_string += ( + table_row_chars[1] + table_row_chars[2] * (table_column_sizes[cell_i]) + table_row_chars[1] + table_row_chars[0] + ) print(divider_string) for row_i, row in enumerate(table): @@ -461,7 +474,11 @@ for row_i, row in enumerate(table): if cell_i == 0: row_string += table_row_chars[3] + cell + table_row_chars[3] * (padding_needed - 1) else: - row_string += table_row_chars[3] * int(math.floor(float(padding_needed) / 2)) + cell + table_row_chars[3] * int(math.ceil(float(padding_needed) / 2)) + row_string += ( + table_row_chars[3] * int(math.floor(float(padding_needed) / 2)) + + cell + + table_row_chars[3] * int(math.ceil(float(padding_needed) / 2)) + ) row_string += table_column_chars print(row_string) @@ -474,5 +491,5 @@ for row_i, row in enumerate(table): print(divider_string) -if total_status.is_ok() and not flags['g']: - print('All listed classes are ' + color('part_good', 'OK') + '!') +if total_status.is_ok() and not flags["g"]: + print("All listed classes are " + color("part_good", "OK") + "!") diff --git a/doc/tools/makerst.py b/doc/tools/makerst.py index 9012de03b3..9de5eac31d 100755 --- a/doc/tools/makerst.py +++ b/doc/tools/makerst.py @@ -7,10 +7,12 @@ import xml.etree.ElementTree as ET from collections import OrderedDict # Uncomment to do type checks. I have it commented out so it works below Python 3.5 -#from typing import List, Dict, TextIO, Tuple, Iterable, Optional, DefaultDict, Any, Union +# from typing import List, Dict, TextIO, Tuple, Iterable, Optional, DefaultDict, Any, Union # http(s)://docs.godotengine.org/<langcode>/<tag>/path/to/page.html(#fragment-tag) -GODOT_DOCS_PATTERN = re.compile(r'^http(?:s)?://docs\.godotengine\.org/(?:[a-zA-Z0-9.\-_]*)/(?:[a-zA-Z0-9.\-_]*)/(.*)\.html(#.*)?$') +GODOT_DOCS_PATTERN = re.compile( + r"^http(?:s)?://docs\.godotengine\.org/(?:[a-zA-Z0-9.\-_]*)/(?:[a-zA-Z0-9.\-_]*)/(.*)\.html(#.*)?$" +) def print_error(error, state): # type: (str, State) -> None @@ -37,7 +39,9 @@ class TypeName: class PropertyDef: - def __init__(self, name, type_name, setter, getter, text, default_value, overridden): # type: (str, TypeName, Optional[str], Optional[str], Optional[str], Optional[str], Optional[bool]) -> None + def __init__( + self, name, type_name, setter, getter, text, default_value, overridden + ): # type: (str, TypeName, Optional[str], Optional[str], Optional[str], Optional[str], Optional[bool]) -> None self.name = name self.type_name = type_name self.setter = setter @@ -46,6 +50,7 @@ class PropertyDef: self.default_value = default_value self.overridden = overridden + class ParameterDef: def __init__(self, name, type_name, default_value): # type: (str, TypeName, Optional[str]) -> None self.name = name @@ -61,7 +66,9 @@ class SignalDef: class MethodDef: - def __init__(self, name, return_type, parameters, description, qualifiers): # type: (str, TypeName, List[ParameterDef], Optional[str], Optional[str]) -> None + def __init__( + self, name, return_type, parameters, description, qualifiers + ): # type: (str, TypeName, List[ParameterDef], Optional[str], Optional[str]) -> None self.name = name self.return_type = return_type self.parameters = parameters @@ -144,10 +151,12 @@ class State: getter = property.get("getter") or None default_value = property.get("default") or None if default_value is not None: - default_value = '``{}``'.format(default_value) + default_value = "``{}``".format(default_value) overridden = property.get("override") or False - property_def = PropertyDef(property_name, type_name, setter, getter, property.text, default_value, overridden) + property_def = PropertyDef( + property_name, type_name, setter, getter, property.text, default_value, overridden + ) class_def.properties[property_name] = property_def methods = class_root.find("methods") @@ -246,8 +255,6 @@ class State: if link.text is not None: class_def.tutorials.append(link.text) - - def sort_classes(self): # type: () -> None self.classes = OrderedDict(sorted(self.classes.items(), key=lambda t: t[0])) @@ -273,7 +280,11 @@ def main(): # type: () -> None parser.add_argument("path", nargs="+", help="A path to an XML file or a directory containing XML files to parse.") group = parser.add_mutually_exclusive_group() group.add_argument("--output", "-o", default=".", help="The directory to save output .rst files in.") - group.add_argument("--dry-run", action="store_true", help="If passed, no output will be generated and XML files are only checked for errors.") + group.add_argument( + "--dry-run", + action="store_true", + help="If passed, no output will be generated and XML files are only checked for errors.", + ) args = parser.parse_args() file_list = [] # type: List[str] @@ -283,15 +294,15 @@ def main(): # type: () -> None if path.endswith(os.sep): path = path[:-1] - if os.path.basename(path) == 'modules': + if os.path.basename(path) == "modules": for subdir, dirs, _ in os.walk(path): - if 'doc_classes' in dirs: - doc_dir = os.path.join(subdir, 'doc_classes') - class_file_names = (f for f in os.listdir(doc_dir) if f.endswith('.xml')) + if "doc_classes" in dirs: + doc_dir = os.path.join(subdir, "doc_classes") + class_file_names = (f for f in os.listdir(doc_dir) if f.endswith(".xml")) file_list += (os.path.join(doc_dir, f) for f in class_file_names) elif os.path.isdir(path): - file_list += (os.path.join(path, f) for f in os.listdir(path) if f.endswith('.xml')) + file_list += (os.path.join(path, f) for f in os.listdir(path) if f.endswith(".xml")) elif os.path.isfile(path): if not path.endswith(".xml"): @@ -311,7 +322,7 @@ def main(): # type: () -> None continue doc = tree.getroot() - if 'version' not in doc.attrib: + if "version" not in doc.attrib: print_error("Version missing from 'doc', file: {}".format(cur_file), state) continue @@ -337,13 +348,14 @@ def main(): # type: () -> None if state.errored: exit(1) + def make_rst_class(class_def, state, dry_run, output_dir): # type: (ClassDef, State, bool, str) -> None class_name = class_def.name if dry_run: - f = open(os.devnull, "w") + f = open(os.devnull, "w", encoding="utf-8") else: - f = open(os.path.join(output_dir, "class_" + class_name.lower() + '.rst'), 'w', encoding='utf-8') + f = open(os.path.join(output_dir, "class_" + class_name.lower() + ".rst"), "w", encoding="utf-8") # Warn contributors not to edit this file directly f.write(":github_url: hide\n\n") @@ -352,13 +364,13 @@ def make_rst_class(class_def, state, dry_run, output_dir): # type: (ClassDef, S f.write(".. The source is found in doc/classes or modules/<name>/doc_classes.\n\n") f.write(".. _class_" + class_name + ":\n\n") - f.write(make_heading(class_name, '=')) + f.write(make_heading(class_name, "=")) # Inheritance tree # Ascendants if class_def.inherits: inh = class_def.inherits.strip() - f.write('**Inherits:** ') + f.write("**Inherits:** ") first = True while inh in state.classes: if not first: @@ -381,7 +393,7 @@ def make_rst_class(class_def, state, dry_run, output_dir): # type: (ClassDef, S inherited.append(c.name) if len(inherited): - f.write('**Inherited By:** ') + f.write("**Inherited By:** ") for i, child in enumerate(inherited): if i > 0: f.write(", ") @@ -393,20 +405,20 @@ def make_rst_class(class_def, state, dry_run, output_dir): # type: (ClassDef, S f.write(rstize_text(class_def.brief_description.strip(), state) + "\n\n") # Class description - if class_def.description is not None and class_def.description.strip() != '': - f.write(make_heading('Description', '-')) + if class_def.description is not None and class_def.description.strip() != "": + f.write(make_heading("Description", "-")) f.write(rstize_text(class_def.description.strip(), state) + "\n\n") # Online tutorials if len(class_def.tutorials) > 0: - f.write(make_heading('Tutorials', '-')) + f.write(make_heading("Tutorials", "-")) for t in class_def.tutorials: link = t.strip() f.write("- " + make_url(link) + "\n\n") # Properties overview if len(class_def.properties) > 0: - f.write(make_heading('Properties', '-')) + f.write(make_heading("Properties", "-")) ml = [] # type: List[Tuple[str, str, str]] for property_def in class_def.properties.values(): type_rst = property_def.type_name.to_rst(state) @@ -420,7 +432,7 @@ def make_rst_class(class_def, state, dry_run, output_dir): # type: (ClassDef, S # Methods overview if len(class_def.methods) > 0: - f.write(make_heading('Methods', '-')) + f.write(make_heading("Methods", "-")) ml = [] for method_list in class_def.methods.values(): for m in method_list: @@ -429,7 +441,7 @@ def make_rst_class(class_def, state, dry_run, output_dir): # type: (ClassDef, S # Theme properties if class_def.theme_items is not None and len(class_def.theme_items) > 0: - f.write(make_heading('Theme Properties', '-')) + f.write(make_heading("Theme Properties", "-")) pl = [] for theme_item_list in class_def.theme_items.values(): for theme_item in theme_item_list: @@ -438,30 +450,30 @@ def make_rst_class(class_def, state, dry_run, output_dir): # type: (ClassDef, S # Signals if len(class_def.signals) > 0: - f.write(make_heading('Signals', '-')) + f.write(make_heading("Signals", "-")) index = 0 for signal in class_def.signals.values(): if index != 0: - f.write('----\n\n') + f.write("----\n\n") f.write(".. _class_{}_signal_{}:\n\n".format(class_name, signal.name)) _, signature = make_method_signature(class_def, signal, False, state) f.write("- {}\n\n".format(signature)) - if signal.description is not None and signal.description.strip() != '': - f.write(rstize_text(signal.description.strip(), state) + '\n\n') + if signal.description is not None and signal.description.strip() != "": + f.write(rstize_text(signal.description.strip(), state) + "\n\n") index += 1 # Enums if len(class_def.enums) > 0: - f.write(make_heading('Enumerations', '-')) + f.write(make_heading("Enumerations", "-")) index = 0 for e in class_def.enums.values(): if index != 0: - f.write('----\n\n') + f.write("----\n\n") f.write(".. _enum_{}_{}:\n\n".format(class_name, e.name)) # Sphinx seems to divide the bullet list into individual <ul> tags if we weave the labels into it. @@ -474,16 +486,16 @@ def make_rst_class(class_def, state, dry_run, output_dir): # type: (ClassDef, S f.write("enum **{}**:\n\n".format(e.name)) for value in e.values.values(): f.write("- **{}** = **{}**".format(value.name, value.value)) - if value.text is not None and value.text.strip() != '': - f.write(' --- ' + rstize_text(value.text.strip(), state)) + if value.text is not None and value.text.strip() != "": + f.write(" --- " + rstize_text(value.text.strip(), state)) - f.write('\n\n') + f.write("\n\n") index += 1 # Constants if len(class_def.constants) > 0: - f.write(make_heading('Constants', '-')) + f.write(make_heading("Constants", "-")) # Sphinx seems to divide the bullet list into individual <ul> tags if we weave the labels into it. # As such I'll put them all above the list. Won't be perfect but better than making the list visually broken. for constant in class_def.constants.values(): @@ -491,14 +503,14 @@ def make_rst_class(class_def, state, dry_run, output_dir): # type: (ClassDef, S for constant in class_def.constants.values(): f.write("- **{}** = **{}**".format(constant.name, constant.value)) - if constant.text is not None and constant.text.strip() != '': - f.write(' --- ' + rstize_text(constant.text.strip(), state)) + if constant.text is not None and constant.text.strip() != "": + f.write(" --- " + rstize_text(constant.text.strip(), state)) - f.write('\n\n') + f.write("\n\n") # Property descriptions if any(not p.overridden for p in class_def.properties.values()) > 0: - f.write(make_heading('Property Descriptions', '-')) + f.write(make_heading("Property Descriptions", "-")) index = 0 for property_def in class_def.properties.values(): @@ -506,36 +518,36 @@ def make_rst_class(class_def, state, dry_run, output_dir): # type: (ClassDef, S continue if index != 0: - f.write('----\n\n') + f.write("----\n\n") f.write(".. _class_{}_property_{}:\n\n".format(class_name, property_def.name)) - f.write('- {} **{}**\n\n'.format(property_def.type_name.to_rst(state), property_def.name)) + f.write("- {} **{}**\n\n".format(property_def.type_name.to_rst(state), property_def.name)) info = [] if property_def.default_value is not None: info.append(("*Default*", property_def.default_value)) if property_def.setter is not None and not property_def.setter.startswith("_"): - info.append(("*Setter*", property_def.setter + '(value)')) + info.append(("*Setter*", property_def.setter + "(value)")) if property_def.getter is not None and not property_def.getter.startswith("_"): - info.append(('*Getter*', property_def.getter + '()')) + info.append(("*Getter*", property_def.getter + "()")) if len(info) > 0: format_table(f, info) - if property_def.text is not None and property_def.text.strip() != '': - f.write(rstize_text(property_def.text.strip(), state) + '\n\n') + if property_def.text is not None and property_def.text.strip() != "": + f.write(rstize_text(property_def.text.strip(), state) + "\n\n") index += 1 # Method descriptions if len(class_def.methods) > 0: - f.write(make_heading('Method Descriptions', '-')) + f.write(make_heading("Method Descriptions", "-")) index = 0 for method_list in class_def.methods.values(): for i, m in enumerate(method_list): if index != 0: - f.write('----\n\n') + f.write("----\n\n") if i == 0: f.write(".. _class_{}_method_{}:\n\n".format(class_name, m.name)) @@ -543,24 +555,24 @@ def make_rst_class(class_def, state, dry_run, output_dir): # type: (ClassDef, S ret_type, signature = make_method_signature(class_def, m, False, state) f.write("- {} {}\n\n".format(ret_type, signature)) - if m.description is not None and m.description.strip() != '': - f.write(rstize_text(m.description.strip(), state) + '\n\n') + if m.description is not None and m.description.strip() != "": + f.write(rstize_text(m.description.strip(), state) + "\n\n") index += 1 def make_class_list(class_list, columns): # type: (List[str], int) -> None # This function is no longer used. - f = open('class_list.rst', 'w', encoding='utf-8') + f = open("class_list.rst", "w", encoding="utf-8") col_max = len(class_list) // columns + 1 - print(('col max is ', col_max)) + print(("col max is ", col_max)) fit_columns = [] # type: List[List[str]] for _ in range(0, columns): fit_columns.append([]) indexers = [] # type List[str] - last_initial = '' + last_initial = "" for idx, name in enumerate(class_list): col = idx // col_max @@ -590,7 +602,7 @@ def make_class_list(class_list, columns): # type: (List[str], int) -> None f.write("\n") for r in range(0, row_max): - s = '+ ' + s = "+ " for c in range(0, columns): if r >= len(fit_columns[c]): continue @@ -598,13 +610,13 @@ def make_class_list(class_list, columns): # type: (List[str], int) -> None classname = fit_columns[c][r] initial = classname[0] if classname in indexers: - s += '**' + initial + '** | ' + s += "**" + initial + "** | " else: - s += ' | ' + s += " | " - s += '[' + classname + '](class_' + classname.lower() + ') | ' + s += "[" + classname + "](class_" + classname.lower() + ") | " - s += '\n' + s += "\n" f.write(s) for n in range(0, columns): @@ -618,29 +630,29 @@ def escape_rst(text, until_pos=-1): # type: (str) -> str # Escape \ character, otherwise it ends up as an escape character in rst pos = 0 while True: - pos = text.find('\\', pos, until_pos) + pos = text.find("\\", pos, until_pos) if pos == -1: break - text = text[:pos] + "\\\\" + text[pos + 1:] + text = text[:pos] + "\\\\" + text[pos + 1 :] pos += 2 # Escape * character to avoid interpreting it as emphasis pos = 0 while True: - pos = text.find('*', pos, until_pos) + pos = text.find("*", pos, until_pos) if pos == -1: break - text = text[:pos] + "\*" + text[pos + 1:] + text = text[:pos] + "\*" + text[pos + 1 :] pos += 2 # Escape _ character at the end of a word to avoid interpreting it as an inline hyperlink pos = 0 while True: - pos = text.find('_', pos, until_pos) + pos = text.find("_", pos, until_pos) if pos == -1: break if not text[pos + 1].isalnum(): # don't escape within a snake_case word - text = text[:pos] + "\_" + text[pos + 1:] + text = text[:pos] + "\_" + text[pos + 1 :] pos += 2 else: pos += 1 @@ -652,16 +664,16 @@ def rstize_text(text, state): # type: (str, State) -> str # Linebreak + tabs in the XML should become two line breaks unless in a "codeblock" pos = 0 while True: - pos = text.find('\n', pos) + pos = text.find("\n", pos) if pos == -1: break pre_text = text[:pos] indent_level = 0 - while text[pos + 1] == '\t': + while text[pos + 1] == "\t": pos += 1 indent_level += 1 - post_text = text[pos + 1:] + post_text = text[pos + 1 :] # Handle codeblocks if post_text.startswith("[codeblock]"): @@ -670,28 +682,33 @@ def rstize_text(text, state): # type: (str, State) -> str print_error("[codeblock] without a closing tag, file: {}".format(state.current_class), state) return "" - code_text = post_text[len("[codeblock]"):end_pos] + code_text = post_text[len("[codeblock]") : end_pos] post_text = post_text[end_pos:] # Remove extraneous tabs code_pos = 0 while True: - code_pos = code_text.find('\n', code_pos) + code_pos = code_text.find("\n", code_pos) if code_pos == -1: break to_skip = 0 - while code_pos + to_skip + 1 < len(code_text) and code_text[code_pos + to_skip + 1] == '\t': + while code_pos + to_skip + 1 < len(code_text) and code_text[code_pos + to_skip + 1] == "\t": to_skip += 1 if to_skip > indent_level: - print_error("Four spaces should be used for indentation within [codeblock], file: {}".format(state.current_class), state) - - if len(code_text[code_pos + to_skip + 1:]) == 0: + print_error( + "Four spaces should be used for indentation within [codeblock], file: {}".format( + state.current_class + ), + state, + ) + + if len(code_text[code_pos + to_skip + 1 :]) == 0: code_text = code_text[:code_pos] + "\n" code_pos += 1 else: - code_text = code_text[:code_pos] + "\n " + code_text[code_pos + to_skip + 1:] + code_text = code_text[:code_pos] + "\n " + code_text[code_pos + to_skip + 1 :] code_pos += 5 - to_skip text = pre_text + "\n[codeblock]" + code_text + post_text @@ -702,7 +719,7 @@ def rstize_text(text, state): # type: (str, State) -> str text = pre_text + "\n\n" + post_text pos += 2 - next_brac_pos = text.find('[') + next_brac_pos = text.find("[") text = escape_rst(text, next_brac_pos) # Handle [tags] @@ -714,54 +731,59 @@ def rstize_text(text, state): # type: (str, State) -> str tag_depth = 0 previous_pos = 0 while True: - pos = text.find('[', pos) + pos = text.find("[", pos) if inside_url and (pos > previous_pos): url_has_name = True if pos == -1: break - endq_pos = text.find(']', pos + 1) + endq_pos = text.find("]", pos + 1) if endq_pos == -1: break pre_text = text[:pos] - post_text = text[endq_pos + 1:] - tag_text = text[pos + 1:endq_pos] + post_text = text[endq_pos + 1 :] + tag_text = text[pos + 1 : endq_pos] escape_post = False if tag_text in state.classes: if tag_text == state.current_class: # We don't want references to the same class - tag_text = '``{}``'.format(tag_text) + tag_text = "``{}``".format(tag_text) else: tag_text = make_type(tag_text, state) escape_post = True else: # command cmd = tag_text - space_pos = tag_text.find(' ') - if cmd == '/codeblock': - tag_text = '' + space_pos = tag_text.find(" ") + if cmd == "/codeblock": + tag_text = "" tag_depth -= 1 inside_code = False # Strip newline if the tag was alone on one - if pre_text[-1] == '\n': + if pre_text[-1] == "\n": pre_text = pre_text[:-1] - elif cmd == '/code': - tag_text = '``' + elif cmd == "/code": + tag_text = "``" tag_depth -= 1 inside_code = False escape_post = True elif inside_code: - tag_text = '[' + tag_text + ']' - elif cmd.find('html') == 0: - param = tag_text[space_pos + 1:] + tag_text = "[" + tag_text + "]" + elif cmd.find("html") == 0: + param = tag_text[space_pos + 1 :] tag_text = param - elif cmd.startswith('method') or cmd.startswith('member') or cmd.startswith('signal') or cmd.startswith('constant'): - param = tag_text[space_pos + 1:] - - if param.find('.') != -1: - ss = param.split('.') + elif ( + cmd.startswith("method") + or cmd.startswith("member") + or cmd.startswith("signal") + or cmd.startswith("constant") + ): + param = tag_text[space_pos + 1 :] + + if param.find(".") != -1: + ss = param.split(".") if len(ss) > 2: print_error("Bad reference: '{}', file: {}".format(param, state.current_class), state) class_param, method_param = ss @@ -794,7 +816,7 @@ def rstize_text(text, state): # type: (str, State) -> str # Search in the current class search_class_defs = [class_def] - if param.find('.') == -1: + if param.find(".") == -1: # Also search in @GlobalScope as a last resort if no class was specified search_class_defs.append(state.classes["@GlobalScope"]) @@ -815,66 +837,71 @@ def rstize_text(text, state): # type: (str, State) -> str ref_type = "_constant" else: - print_error("Unresolved type reference '{}' in method reference '{}', file: {}".format(class_param, param, state.current_class), state) + print_error( + "Unresolved type reference '{}' in method reference '{}', file: {}".format( + class_param, param, state.current_class + ), + state, + ) repl_text = method_param if class_param != state.current_class: repl_text = "{}.{}".format(class_param, method_param) - tag_text = ':ref:`{}<class_{}{}_{}>`'.format(repl_text, class_param, ref_type, method_param) + tag_text = ":ref:`{}<class_{}{}_{}>`".format(repl_text, class_param, ref_type, method_param) escape_post = True - elif cmd.find('image=') == 0: + elif cmd.find("image=") == 0: tag_text = "" # '' - elif cmd.find('url=') == 0: + elif cmd.find("url=") == 0: url_link = cmd[4:] - tag_text = '`' + tag_text = "`" tag_depth += 1 inside_url = True url_has_name = False - elif cmd == '/url': - tag_text = ('' if url_has_name else url_link) + " <" + url_link + ">`_" + elif cmd == "/url": + tag_text = ("" if url_has_name else url_link) + " <" + url_link + ">`_" tag_depth -= 1 escape_post = True inside_url = False url_has_name = False - elif cmd == 'center': + elif cmd == "center": tag_depth += 1 - tag_text = '' - elif cmd == '/center': + tag_text = "" + elif cmd == "/center": tag_depth -= 1 - tag_text = '' - elif cmd == 'codeblock': + tag_text = "" + elif cmd == "codeblock": tag_depth += 1 - tag_text = '\n::\n' + tag_text = "\n::\n" inside_code = True - elif cmd == 'br': + elif cmd == "br": # Make a new paragraph instead of a linebreak, rst is not so linebreak friendly - tag_text = '\n\n' + tag_text = "\n\n" # Strip potential leading spaces - while post_text[0] == ' ': + while post_text[0] == " ": post_text = post_text[1:] - elif cmd == 'i' or cmd == '/i': + elif cmd == "i" or cmd == "/i": if cmd == "/i": tag_depth -= 1 else: tag_depth += 1 - tag_text = '*' - elif cmd == 'b' or cmd == '/b': + tag_text = "*" + elif cmd == "b" or cmd == "/b": if cmd == "/b": tag_depth -= 1 else: tag_depth += 1 - tag_text = '**' - elif cmd == 'u' or cmd == '/u': + tag_text = "**" + elif cmd == "u" or cmd == "/u": if cmd == "/u": tag_depth -= 1 else: tag_depth += 1 - tag_text = '' - elif cmd == 'code': - tag_text = '``' + tag_text = "" + elif cmd == "code": + tag_text = "``" tag_depth += 1 inside_code = True - elif cmd.startswith('enum '): + elif cmd.startswith("enum "): tag_text = make_enum(cmd[5:], state) escape_post = True else: @@ -883,24 +910,24 @@ def rstize_text(text, state): # type: (str, State) -> str # Properly escape things like `[Node]s` if escape_post and post_text and (post_text[0].isalnum() or post_text[0] == "("): # not punctuation, escape - post_text = '\ ' + post_text + post_text = "\ " + post_text - next_brac_pos = post_text.find('[', 0) + next_brac_pos = post_text.find("[", 0) iter_pos = 0 while not inside_code: - iter_pos = post_text.find('*', iter_pos, next_brac_pos) + iter_pos = post_text.find("*", iter_pos, next_brac_pos) if iter_pos == -1: break - post_text = post_text[:iter_pos] + "\*" + post_text[iter_pos + 1:] + post_text = post_text[:iter_pos] + "\*" + post_text[iter_pos + 1 :] iter_pos += 2 iter_pos = 0 while not inside_code: - iter_pos = post_text.find('_', iter_pos, next_brac_pos) + iter_pos = post_text.find("_", iter_pos, next_brac_pos) if iter_pos == -1: break if not post_text[iter_pos + 1].isalnum(): # don't escape within a snake_case word - post_text = post_text[:iter_pos] + "\_" + post_text[iter_pos + 1:] + post_text = post_text[:iter_pos] + "\_" + post_text[iter_pos + 1 :] iter_pos += 2 else: iter_pos += 1 @@ -922,7 +949,7 @@ def format_table(f, data, remove_empty_columns=False): # type: (TextIO, Iterabl column_sizes = [0] * len(data[0]) for row in data: for i, text in enumerate(row): - text_length = len(text or '') + text_length = len(text or "") if text_length > column_sizes[i]: column_sizes[i] = text_length @@ -939,16 +966,16 @@ def format_table(f, data, remove_empty_columns=False): # type: (TextIO, Iterabl for i, text in enumerate(row): if column_sizes[i] == 0 and remove_empty_columns: continue - row_text += " " + (text or '').ljust(column_sizes[i]) + " |" + row_text += " " + (text or "").ljust(column_sizes[i]) + " |" row_text += "\n" f.write(row_text) f.write(sep) - f.write('\n') + f.write("\n") def make_type(t, state): # type: (str, State) -> str if t in state.classes: - return ':ref:`{0}<class_{0}>`'.format(t) + return ":ref:`{0}<class_{0}>`".format(t) print_error("Unresolved type '{}', file: {}".format(t, state.current_class), state) return t @@ -957,7 +984,7 @@ def make_enum(t, state): # type: (str, State) -> str p = t.find(".") if p >= 0: c = t[0:p] - e = t[p + 1:] + e = t[p + 1 :] # Variant enums live in GlobalScope but still use periods. if c == "Variant": c = "@GlobalScope" @@ -969,7 +996,7 @@ def make_enum(t, state): # type: (str, State) -> str c = "@GlobalScope" if not c in state.classes and c.startswith("_"): - c = c[1:] # Remove the underscore prefix + c = c[1:] # Remove the underscore prefix if c in state.classes and e in state.classes[c].enums: return ":ref:`{0}<enum_{1}_{0}>`".format(e, c) @@ -981,7 +1008,9 @@ def make_enum(t, state): # type: (str, State) -> str return t -def make_method_signature(class_def, method_def, make_ref, state): # type: (ClassDef, Union[MethodDef, SignalDef], bool, State) -> Tuple[str, str] +def make_method_signature( + class_def, method_def, make_ref, state +): # type: (ClassDef, Union[MethodDef, SignalDef], bool, State) -> Tuple[str, str] ret_type = " " ref_type = "signal" @@ -996,34 +1025,34 @@ def make_method_signature(class_def, method_def, make_ref, state): # type: (Cla else: out += "**{}** ".format(method_def.name) - out += '**(**' + out += "**(**" for i, arg in enumerate(method_def.parameters): if i > 0: - out += ', ' + out += ", " else: - out += ' ' + out += " " out += "{} {}".format(arg.type_name.to_rst(state), arg.name) if arg.default_value is not None: - out += '=' + arg.default_value + out += "=" + arg.default_value - if isinstance(method_def, MethodDef) and method_def.qualifiers is not None and 'vararg' in method_def.qualifiers: + if isinstance(method_def, MethodDef) and method_def.qualifiers is not None and "vararg" in method_def.qualifiers: if len(method_def.parameters) > 0: - out += ', ...' + out += ", ..." else: - out += ' ...' + out += " ..." - out += ' **)**' + out += " **)**" if isinstance(method_def, MethodDef) and method_def.qualifiers is not None: - out += ' ' + method_def.qualifiers + out += " " + method_def.qualifiers return ret_type, out def make_heading(title, underline): # type: (str, str) -> str - return title + '\n' + (underline * len(title)) + "\n\n" + return title + "\n" + (underline * len(title)) + "\n\n" def make_url(link): # type: (str) -> str @@ -1047,5 +1076,5 @@ def make_url(link): # type: (str) -> str return "`" + link + " <" + link + ">`_" -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/doc/translations/extract.py b/doc/translations/extract.py index cd06e13dda..a65f942b92 100644 --- a/doc/translations/extract.py +++ b/doc/translations/extract.py @@ -7,7 +7,7 @@ import shutil from collections import OrderedDict EXTRACT_TAGS = ["description", "brief_description", "member", "constant", "theme_item", "link"] -HEADER = '''\ +HEADER = """\ # LANGUAGE translation of the Godot Engine class reference. # Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. # Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). @@ -24,7 +24,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\\n" "Content-Transfer-Encoding: 8-bit\\n" -''' +""" # Some strings used by makerst.py are normally part of the editor translations, # so we need to include them manually here for the online docs. BASE_STRINGS = [ @@ -42,7 +42,8 @@ BASE_STRINGS = [ ## <xml-line-number-hack from="https://stackoverflow.com/a/36430270/10846399"> import sys -sys.modules['_elementtree'] = None + +sys.modules["_elementtree"] = None import xml.etree.ElementTree as ET ## override the parser to get the line number @@ -62,8 +63,11 @@ class LineNumberingParser(ET.XMLParser): element._end_column_number = self.parser.CurrentColumnNumber element._end_byte_index = self.parser.CurrentByteIndex return element + + ## </xml-line-number-hack> + class Desc: def __init__(self, line_no, msg, desc_list=None): ## line_no : the line number where the desc is @@ -73,6 +77,7 @@ class Desc: self.msg = msg self.desc_list = desc_list + class DescList: def __init__(self, doc, path): ## doc : root xml element of the document @@ -82,29 +87,32 @@ class DescList: self.path = path self.list = [] + def print_error(error): print("ERROR: {}".format(error)) + ## build classes with xml elements recursively def _collect_classes_dir(path, classes): if not os.path.isdir(path): print_error("Invalid directory path: {}".format(path)) exit(1) - for _dir in map(lambda dir : os.path.join(path, dir), os.listdir(path)): + for _dir in map(lambda dir: os.path.join(path, dir), os.listdir(path)): if os.path.isdir(_dir): _collect_classes_dir(_dir, classes) elif os.path.isfile(_dir): if not _dir.endswith(".xml"): - #print("Got non-.xml file '{}', skipping.".format(path)) + # print("Got non-.xml file '{}', skipping.".format(path)) continue _collect_classes_file(_dir, classes) + ## opens a file and parse xml add to classes def _collect_classes_file(path, classes): if not os.path.isfile(path) or not path.endswith(".xml"): print_error("Invalid xml file path: {}".format(path)) exit(1) - print('Collecting file: {}'.format(os.path.basename(path))) + print("Collecting file: {}".format(os.path.basename(path))) try: tree = ET.parse(path, parser=LineNumberingParser()) @@ -114,8 +122,8 @@ def _collect_classes_file(path, classes): doc = tree.getroot() - if 'name' in doc.attrib: - if 'version' not in doc.attrib: + if "name" in doc.attrib: + if "version" not in doc.attrib: print_error("Version missing from 'doc', file: {}".format(path)) name = doc.attrib["name"] @@ -124,7 +132,7 @@ def _collect_classes_file(path, classes): exit(1) classes[name] = DescList(doc, path) else: - print_error('Unknown XML file {}, skipping'.format(path)) + print_error("Unknown XML file {}, skipping".format(path)) ## regions are list of tuples with size 3 (start_index, end_index, indent) @@ -132,56 +140,64 @@ def _collect_classes_file(path, classes): ## if i inside the region returns the indent, else returns -1 def _get_xml_indent(i, regions): for region in regions: - if region[0] < i < region[1] : + if region[0] < i < region[1]: return region[2] return -1 + ## find and build all regions of codeblock which we need later -def _make_codeblock_regions(desc, path=''): +def _make_codeblock_regions(desc, path=""): code_block_end = False code_block_index = 0 code_block_regions = [] while not code_block_end: code_block_index = desc.find("[codeblock]", code_block_index) - if code_block_index < 0: break - xml_indent=0 - while True : + if code_block_index < 0: + break + xml_indent = 0 + while True: ## [codeblock] always have a trailing new line and some tabs ## those tabs are belongs to xml indentations not code indent - if desc[code_block_index+len("[codeblock]\n")+xml_indent] == '\t': - xml_indent+=1 - else: break + if desc[code_block_index + len("[codeblock]\n") + xml_indent] == "\t": + xml_indent += 1 + else: + break end_index = desc.find("[/codeblock]", code_block_index) - if end_index < 0 : - print_error('Non terminating codeblock: {}'.format(path)) + if end_index < 0: + print_error("Non terminating codeblock: {}".format(path)) exit(1) - code_block_regions.append( (code_block_index, end_index, xml_indent) ) + code_block_regions.append((code_block_index, end_index, xml_indent)) code_block_index += 1 return code_block_regions + def _strip_and_split_desc(desc, code_block_regions): - desc_strip = '' ## a stripped desc msg + desc_strip = "" ## a stripped desc msg total_indent = 0 ## code indent = total indent - xml indent for i in range(len(desc)): c = desc[i] - if c == '\n' : c = '\\n' - if c == '"': c = '\\"' - if c == '\\': c = '\\\\' ## <element \> is invalid for msgmerge - if c == '\t': + if c == "\n": + c = "\\n" + if c == '"': + c = '\\"' + if c == "\\": + c = "\\\\" ## <element \> is invalid for msgmerge + if c == "\t": xml_indent = _get_xml_indent(i, code_block_regions) if xml_indent >= 0: total_indent += 1 if xml_indent < total_indent: - c = '\\t' + c = "\\t" else: continue else: continue desc_strip += c - if c == '\\n': + if c == "\\n": total_indent = 0 return desc_strip + ## make catalog strings from xml elements def _make_translation_catalog(classes): unique_msgs = OrderedDict() @@ -189,8 +205,9 @@ def _make_translation_catalog(classes): desc_list = classes[class_name] for elem in desc_list.doc.iter(): if elem.tag in EXTRACT_TAGS: - if not elem.text or len(elem.text) == 0 : continue - line_no = elem._start_line_number if elem.text[0]!='\n' else elem._start_line_number+1 + if not elem.text or len(elem.text) == 0: + continue + line_no = elem._start_line_number if elem.text[0] != "\n" else elem._start_line_number + 1 desc_str = elem.text.strip() code_block_regions = _make_codeblock_regions(desc_str, desc_list.path) desc_msg = _strip_and_split_desc(desc_str, code_block_regions) @@ -203,44 +220,48 @@ def _make_translation_catalog(classes): unique_msgs[desc_msg].append(desc_obj) return unique_msgs + ## generate the catalog file def _generate_translation_catalog_file(unique_msgs, output): - with open(output, 'w', encoding='utf8') as f: + with open(output, "w", encoding="utf8") as f: f.write(HEADER) for msg in BASE_STRINGS: - f.write('#: doc/tools/makerst.py\n') + f.write("#: doc/tools/makerst.py\n") f.write('msgid "{}"\n'.format(msg)) f.write('msgstr ""\n\n') for msg in unique_msgs: if len(msg) == 0 or msg in BASE_STRINGS: continue - f.write('#:') + f.write("#:") desc_list = unique_msgs[msg] for desc in desc_list: - path = desc.desc_list.path.replace('\\', '/') - if path.startswith('./'): + path = desc.desc_list.path.replace("\\", "/") + if path.startswith("./"): path = path[2:] - f.write(' {}:{}'.format(path, desc.line_no)) - f.write('\n') + f.write(" {}:{}".format(path, desc.line_no)) + f.write("\n") f.write('msgid "{}"\n'.format(msg)) f.write('msgstr ""\n\n') ## TODO: what if 'nt'? - if (os.name == "posix"): + if os.name == "posix": print("Wrapping template at 79 characters for compatibility with Weblate.") os.system("msgmerge -w79 {0} {0} > {0}.wrap".format(output)) shutil.move("{}.wrap".format(output), output) + def main(): parser = argparse.ArgumentParser() - parser.add_argument("--path", "-p", nargs="+", default=".", help="The directory or directories containing XML files to collect.") + parser.add_argument( + "--path", "-p", nargs="+", default=".", help="The directory or directories containing XML files to collect." + ) parser.add_argument("--output", "-o", default="translation_catalog.pot", help="The path to the output file.") args = parser.parse_args() output = os.path.abspath(args.output) - if not os.path.isdir(os.path.dirname(output)) or not output.endswith('.pot'): + if not os.path.isdir(os.path.dirname(output)) or not output.endswith(".pot"): print_error("Invalid output path: {}".format(output)) exit(1) @@ -252,13 +273,14 @@ def main(): print("\nCurrent working dir: {}".format(path)) - path_classes = OrderedDict() ## dictionary of key=class_name, value=DescList objects + path_classes = OrderedDict() ## dictionary of key=class_name, value=DescList objects _collect_classes_dir(path, path_classes) classes.update(path_classes) - classes = OrderedDict(sorted(classes.items(), key = lambda kv: kv[0].lower())) + classes = OrderedDict(sorted(classes.items(), key=lambda kv: kv[0].lower())) unique_msgs = _make_translation_catalog(classes) _generate_translation_catalog_file(unique_msgs, output) -if __name__ == '__main__': + +if __name__ == "__main__": main() diff --git a/drivers/SCsub b/drivers/SCsub index 41c20d81ad..cc7bcbc640 100644 --- a/drivers/SCsub +++ b/drivers/SCsub @@ -1,41 +1,42 @@ #!/usr/bin/env python -Import('env') +Import("env") env.drivers_sources = [] # OS drivers -SConscript('unix/SCsub') -SConscript('windows/SCsub') +SConscript("unix/SCsub") +SConscript("windows/SCsub") # Sounds drivers -SConscript('alsa/SCsub') -SConscript('coreaudio/SCsub') -SConscript('pulseaudio/SCsub') -if (env["platform"] == "windows"): +SConscript("alsa/SCsub") +SConscript("coreaudio/SCsub") +SConscript("pulseaudio/SCsub") +if env["platform"] == "windows": SConscript("wasapi/SCsub") -if env['xaudio2']: +if env["xaudio2"]: SConscript("xaudio2/SCsub") # Midi drivers -SConscript('alsamidi/SCsub') -SConscript('coremidi/SCsub') -SConscript('winmidi/SCsub') +SConscript("alsamidi/SCsub") +SConscript("coremidi/SCsub") +SConscript("winmidi/SCsub") # Graphics drivers -if (env["platform"] != "server" and env["platform"] != "javascript"): -# SConscript('gles2/SCsub') - SConscript('vulkan/SCsub') - SConscript('gl_context/SCsub') +if env["platform"] != "server" and env["platform"] != "javascript": + # SConscript('gles2/SCsub') + SConscript("vulkan/SCsub") + SConscript("gl_context/SCsub") else: - SConscript('dummy/SCsub') + SConscript("dummy/SCsub") # Core dependencies SConscript("png/SCsub") SConscript("spirv-reflect/SCsub") -if env['vsproj']: +if env["vsproj"]: import os + path = os.getcwd() # Change directory so the path resolves correctly in the function call. os.chdir("..") diff --git a/drivers/alsa/SCsub b/drivers/alsa/SCsub index 28b315ae66..91e1140b75 100644 --- a/drivers/alsa/SCsub +++ b/drivers/alsa/SCsub @@ -1,5 +1,5 @@ #!/usr/bin/env python -Import('env') +Import("env") env.add_source_files(env.drivers_sources, "*.cpp") diff --git a/drivers/alsamidi/SCsub b/drivers/alsamidi/SCsub index 4c24925192..4e1b5f2a36 100644 --- a/drivers/alsamidi/SCsub +++ b/drivers/alsamidi/SCsub @@ -1,6 +1,6 @@ #!/usr/bin/env python -Import('env') +Import("env") # Driver source files env.add_source_files(env.drivers_sources, "*.cpp") diff --git a/drivers/coreaudio/SCsub b/drivers/coreaudio/SCsub index 4c24925192..4e1b5f2a36 100644 --- a/drivers/coreaudio/SCsub +++ b/drivers/coreaudio/SCsub @@ -1,6 +1,6 @@ #!/usr/bin/env python -Import('env') +Import("env") # Driver source files env.add_source_files(env.drivers_sources, "*.cpp") diff --git a/drivers/coremidi/SCsub b/drivers/coremidi/SCsub index 4c24925192..4e1b5f2a36 100644 --- a/drivers/coremidi/SCsub +++ b/drivers/coremidi/SCsub @@ -1,6 +1,6 @@ #!/usr/bin/env python -Import('env') +Import("env") # Driver source files env.add_source_files(env.drivers_sources, "*.cpp") diff --git a/drivers/dummy/SCsub b/drivers/dummy/SCsub index 28b315ae66..91e1140b75 100644 --- a/drivers/dummy/SCsub +++ b/drivers/dummy/SCsub @@ -1,5 +1,5 @@ #!/usr/bin/env python -Import('env') +Import("env") env.add_source_files(env.drivers_sources, "*.cpp") diff --git a/drivers/dummy/rasterizer_dummy.h b/drivers/dummy/rasterizer_dummy.h index a503492595..338e4b8501 100644 --- a/drivers/dummy/rasterizer_dummy.h +++ b/drivers/dummy/rasterizer_dummy.h @@ -77,7 +77,7 @@ public: void environment_set_camera_feed_id(RID p_env, int p_camera_feed_id) {} #endif - void environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_mix, float p_bloom_threshold, RS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, float p_hdr_luminance_cap, bool p_bicubic_upscale) {} + void environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_mix, float p_bloom_threshold, RS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, float p_hdr_luminance_cap) {} void environment_set_fog(RID p_env, bool p_enable, float p_begin, float p_end, RID p_gradient_texture) {} diff --git a/drivers/gl_context/SCsub b/drivers/gl_context/SCsub index d6945ee2eb..ddeec6f4c6 100644 --- a/drivers/gl_context/SCsub +++ b/drivers/gl_context/SCsub @@ -1,8 +1,8 @@ #!/usr/bin/env python -Import('env') +Import("env") -if (env["platform"] in ["haiku", "osx", "windows", "linuxbsd"]): +if env["platform"] in ["haiku", "osx", "windows", "linuxbsd"]: # Thirdparty source files thirdparty_dir = "#thirdparty/glad/" thirdparty_sources = [ @@ -12,8 +12,8 @@ if (env["platform"] in ["haiku", "osx", "windows", "linuxbsd"]): env.Prepend(CPPPATH=[thirdparty_dir]) - env.Append(CPPDEFINES=['GLAD_ENABLED']) - env.Append(CPPDEFINES=['GLES_OVER_GL']) + env.Append(CPPDEFINES=["GLAD_ENABLED"]) + env.Append(CPPDEFINES=["GLES_OVER_GL"]) env_thirdparty = env.Clone() env_thirdparty.disable_warnings() diff --git a/drivers/gles2/SCsub b/drivers/gles2/SCsub index 9923e52c73..987ddcd16e 100644 --- a/drivers/gles2/SCsub +++ b/drivers/gles2/SCsub @@ -1,6 +1,6 @@ #!/usr/bin/env python -Import('env') +Import("env") env.add_source_files(env.drivers_sources, "*.cpp") diff --git a/drivers/gles2/shaders/SCsub b/drivers/gles2/shaders/SCsub index d7ae0243e6..bcd6ea79fb 100644 --- a/drivers/gles2/shaders/SCsub +++ b/drivers/gles2/shaders/SCsub @@ -1,23 +1,23 @@ #!/usr/bin/env python -Import('env') +Import("env") -if 'GLES2_GLSL' in env['BUILDERS']: - env.GLES2_GLSL('copy.glsl'); -# env.GLES2_GLSL('resolve.glsl'); - env.GLES2_GLSL('canvas.glsl'); - env.GLES2_GLSL('canvas_shadow.glsl'); - env.GLES2_GLSL('scene.glsl'); - env.GLES2_GLSL('cubemap_filter.glsl'); - env.GLES2_GLSL('cube_to_dp.glsl'); -# env.GLES2_GLSL('blend_shape.glsl'); -# env.GLES2_GLSL('screen_space_reflection.glsl'); - env.GLES2_GLSL('effect_blur.glsl'); -# env.GLES2_GLSL('subsurf_scattering.glsl'); -# env.GLES2_GLSL('ssao.glsl'); -# env.GLES2_GLSL('ssao_minify.glsl'); -# env.GLES2_GLSL('ssao_blur.glsl'); -# env.GLES2_GLSL('exposure.glsl'); - env.GLES2_GLSL('tonemap.glsl'); -# env.GLES2_GLSL('particles.glsl'); - env.GLES2_GLSL('lens_distorted.glsl'); +if "GLES2_GLSL" in env["BUILDERS"]: + env.GLES2_GLSL("copy.glsl") + # env.GLES2_GLSL('resolve.glsl'); + env.GLES2_GLSL("canvas.glsl") + env.GLES2_GLSL("canvas_shadow.glsl") + env.GLES2_GLSL("scene.glsl") + env.GLES2_GLSL("cubemap_filter.glsl") + env.GLES2_GLSL("cube_to_dp.glsl") + # env.GLES2_GLSL('blend_shape.glsl'); + # env.GLES2_GLSL('screen_space_reflection.glsl'); + env.GLES2_GLSL("effect_blur.glsl") + # env.GLES2_GLSL('subsurf_scattering.glsl'); + # env.GLES2_GLSL('ssao.glsl'); + # env.GLES2_GLSL('ssao_minify.glsl'); + # env.GLES2_GLSL('ssao_blur.glsl'); + # env.GLES2_GLSL('exposure.glsl'); + env.GLES2_GLSL("tonemap.glsl") + # env.GLES2_GLSL('particles.glsl'); + env.GLES2_GLSL("lens_distorted.glsl") diff --git a/drivers/png/SCsub b/drivers/png/SCsub index 87b54cecaf..db08be0c47 100644 --- a/drivers/png/SCsub +++ b/drivers/png/SCsub @@ -1,11 +1,11 @@ #!/usr/bin/env python -Import('env') +Import("env") env_png = env.Clone() # Thirdparty source files -if env['builtin_libpng']: +if env["builtin_libpng"]: thirdparty_dir = "#thirdparty/libpng/" thirdparty_sources = [ "png.c", @@ -32,6 +32,7 @@ if env['builtin_libpng']: # Currently .ASM filter_neon.S does not compile on NT. import os + use_neon = "neon_enabled" in env and env["neon_enabled"] and os.name != "nt" if use_neon: env_png.Append(CPPDEFINES=[("PNG_ARM_NEON_OPT", 2)]) @@ -45,7 +46,7 @@ if env['builtin_libpng']: if use_neon: env_neon = env_thirdparty.Clone() if "S_compiler" in env: - env_neon['CC'] = env['S_compiler'] + env_neon["CC"] = env["S_compiler"] neon_sources = [] neon_sources.append(env_neon.Object(thirdparty_dir + "/arm/arm_init.c")) neon_sources.append(env_neon.Object(thirdparty_dir + "/arm/filter_neon_intrinsics.c")) @@ -56,4 +57,4 @@ if env['builtin_libpng']: # Godot source files env_png.add_source_files(env.drivers_sources, "*.cpp") -Export('env') +Export("env") diff --git a/drivers/pulseaudio/SCsub b/drivers/pulseaudio/SCsub index 28b315ae66..91e1140b75 100644 --- a/drivers/pulseaudio/SCsub +++ b/drivers/pulseaudio/SCsub @@ -1,5 +1,5 @@ #!/usr/bin/env python -Import('env') +Import("env") env.add_source_files(env.drivers_sources, "*.cpp") diff --git a/drivers/spirv-reflect/SCsub b/drivers/spirv-reflect/SCsub index 8ff27da114..d0ffaf068d 100644 --- a/drivers/spirv-reflect/SCsub +++ b/drivers/spirv-reflect/SCsub @@ -1,17 +1,17 @@ #!/usr/bin/env python -Import('env') +Import("env") env_spirv_reflect = env.Clone() env_spirv_reflect.disable_warnings() thirdparty_dir = "#thirdparty/spirv-reflect/" thirdparty_sources = [ - "spirv_reflect.c" + "spirv_reflect.c", ] thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] env_spirv_reflect.add_source_files(env.drivers_sources, thirdparty_sources) -Export('env') +Export("env") diff --git a/drivers/unix/SCsub b/drivers/unix/SCsub index 4888f56099..91ef613546 100644 --- a/drivers/unix/SCsub +++ b/drivers/unix/SCsub @@ -1,7 +1,7 @@ #!/usr/bin/env python -Import('env') +Import("env") env.add_source_files(env.drivers_sources, "*.cpp") -env["check_c_headers"] = [ [ "mntent.h", "HAVE_MNTENT" ] ] +env["check_c_headers"] = [["mntent.h", "HAVE_MNTENT"]] diff --git a/drivers/vulkan/SCsub b/drivers/vulkan/SCsub index de776b19b2..7ffdac27d5 100644 --- a/drivers/vulkan/SCsub +++ b/drivers/vulkan/SCsub @@ -1,10 +1,10 @@ #!/usr/bin/env python -Import('env') +Import("env") env.add_source_files(env.drivers_sources, "*.cpp") -if env['builtin_vulkan']: +if env["builtin_vulkan"]: # Use bundled Vulkan headers thirdparty_dir = "#thirdparty/vulkan" env.Prepend(CPPPATH=[thirdparty_dir, thirdparty_dir + "/include", thirdparty_dir + "/loader"]) @@ -27,48 +27,56 @@ if env['builtin_vulkan']: ] vma_sources = [thirdparty_dir + "/vk_mem_alloc.cpp"] - if env['platform'] == "windows": + if env["platform"] == "windows": loader_sources.append("dirent_on_windows.c") loader_sources.append("dxgi_loader.c") - env_thirdparty.AppendUnique(CPPDEFINES=[ - 'VK_USE_PLATFORM_WIN32_KHR', - 'VULKAN_NON_CMAKE_BUILD', - 'WIN32_LEAN_AND_MEAN', - 'API_NAME=\\"%s\\"' % 'Vulkan' - ]) - if not env.msvc: # Windows 7+, missing in mingw headers - env_thirdparty.AppendUnique(CPPDEFINES=[ - "CM_GETIDLIST_FILTER_CLASS=0x00000200", - "CM_GETIDLIST_FILTER_PRESENT=0x00000100" - ]) - elif env['platform'] == "osx": - env_thirdparty.AppendUnique(CPPDEFINES=[ - 'VK_USE_PLATFORM_MACOS_MVK', - 'VULKAN_NON_CMAKE_BUILD', - 'SYSCONFDIR=\\"%s\\"' % '/etc', - 'FALLBACK_DATA_DIRS=\\"%s\\"' % '/usr/local/share:/usr/share', - 'FALLBACK_CONFIG_DIRS=\\"%s\\"' % '/etc/xdg' - ]) - elif env['platform'] == "iphone": - env_thirdparty.AppendUnique(CPPDEFINES=[ - 'VK_USE_PLATFORM_IOS_MVK', - 'VULKAN_NON_CMAKE_BUILD', - 'SYSCONFDIR=\\"%s\\"' % '/etc', - 'FALLBACK_DATA_DIRS=\\"%s\\"' % '/usr/local/share:/usr/share', - 'FALLBACK_CONFIG_DIRS=\\"%s\\"' % '/etc/xdg' - ]) - elif env['platform'] == "linuxbsd": - env_thirdparty.AppendUnique(CPPDEFINES=[ - 'VK_USE_PLATFORM_XLIB_KHR', - 'VULKAN_NON_CMAKE_BUILD', - 'SYSCONFDIR=\\"%s\\"' % '/etc', - 'FALLBACK_DATA_DIRS=\\"%s\\"' % '/usr/local/share:/usr/share', - 'FALLBACK_CONFIG_DIRS=\\"%s\\"' % '/etc/xdg' - ]) + env_thirdparty.AppendUnique( + CPPDEFINES=[ + "VK_USE_PLATFORM_WIN32_KHR", + "VULKAN_NON_CMAKE_BUILD", + "WIN32_LEAN_AND_MEAN", + 'API_NAME=\\"%s\\"' % "Vulkan", + ] + ) + if not env.msvc: # Windows 7+, missing in mingw headers + env_thirdparty.AppendUnique( + CPPDEFINES=["CM_GETIDLIST_FILTER_CLASS=0x00000200", "CM_GETIDLIST_FILTER_PRESENT=0x00000100"] + ) + elif env["platform"] == "osx": + env_thirdparty.AppendUnique( + CPPDEFINES=[ + "VK_USE_PLATFORM_MACOS_MVK", + "VULKAN_NON_CMAKE_BUILD", + 'SYSCONFDIR=\\"%s\\"' % "/etc", + 'FALLBACK_DATA_DIRS=\\"%s\\"' % "/usr/local/share:/usr/share", + 'FALLBACK_CONFIG_DIRS=\\"%s\\"' % "/etc/xdg", + ] + ) + elif env["platform"] == "iphone": + env_thirdparty.AppendUnique( + CPPDEFINES=[ + "VK_USE_PLATFORM_IOS_MVK", + "VULKAN_NON_CMAKE_BUILD", + 'SYSCONFDIR=\\"%s\\"' % "/etc", + 'FALLBACK_DATA_DIRS=\\"%s\\"' % "/usr/local/share:/usr/share", + 'FALLBACK_CONFIG_DIRS=\\"%s\\"' % "/etc/xdg", + ] + ) + elif env["platform"] == "linuxbsd": + env_thirdparty.AppendUnique( + CPPDEFINES=[ + "VK_USE_PLATFORM_XLIB_KHR", + "VULKAN_NON_CMAKE_BUILD", + 'SYSCONFDIR=\\"%s\\"' % "/etc", + 'FALLBACK_DATA_DIRS=\\"%s\\"' % "/usr/local/share:/usr/share", + 'FALLBACK_CONFIG_DIRS=\\"%s\\"' % "/etc/xdg", + ] + ) import platform - if (platform.system() == "Linux"): + + if platform.system() == "Linux": # In glibc since 2.17 and musl libc since 1.1.24. Used by loader.c. - env_thirdparty.AppendUnique(CPPDEFINES=['HAVE_SECURE_GETENV']) + env_thirdparty.AppendUnique(CPPDEFINES=["HAVE_SECURE_GETENV"]) loader_sources = [thirdparty_dir + "/loader/" + file for file in loader_sources] env_thirdparty.add_source_files(env.drivers_sources, loader_sources) diff --git a/drivers/wasapi/SCsub b/drivers/wasapi/SCsub index 4c24925192..4e1b5f2a36 100644 --- a/drivers/wasapi/SCsub +++ b/drivers/wasapi/SCsub @@ -1,6 +1,6 @@ #!/usr/bin/env python -Import('env') +Import("env") # Driver source files env.add_source_files(env.drivers_sources, "*.cpp") diff --git a/drivers/windows/SCsub b/drivers/windows/SCsub index 28b315ae66..91e1140b75 100644 --- a/drivers/windows/SCsub +++ b/drivers/windows/SCsub @@ -1,5 +1,5 @@ #!/usr/bin/env python -Import('env') +Import("env") env.add_source_files(env.drivers_sources, "*.cpp") diff --git a/drivers/windows/dir_access_windows.cpp b/drivers/windows/dir_access_windows.cpp index cf09f79832..3df7eafe13 100644 --- a/drivers/windows/dir_access_windows.cpp +++ b/drivers/windows/dir_access_windows.cpp @@ -206,7 +206,13 @@ String DirAccessWindows::get_current_dir(bool p_include_drive) { if (p_include_drive) { return current_dir; } else { - return current_dir.right(current_dir.find(":") + 1); + if (_get_root_string() == "") { + int p = current_dir.find(":"); + if (p != -1) { + return current_dir.right(p + 1); + } + } + return current_dir; } } diff --git a/drivers/winmidi/SCsub b/drivers/winmidi/SCsub index 4c24925192..4e1b5f2a36 100644 --- a/drivers/winmidi/SCsub +++ b/drivers/winmidi/SCsub @@ -1,6 +1,6 @@ #!/usr/bin/env python -Import('env') +Import("env") # Driver source files env.add_source_files(env.drivers_sources, "*.cpp") diff --git a/drivers/xaudio2/SCsub b/drivers/xaudio2/SCsub index de750525ab..6778ad281e 100644 --- a/drivers/xaudio2/SCsub +++ b/drivers/xaudio2/SCsub @@ -1,7 +1,7 @@ #!/usr/bin/env python -Import('env') +Import("env") env.add_source_files(env.drivers_sources, "*.cpp") -env.Append(CPPDEFINES=['XAUDIO2_ENABLED']) -env.Append(LINKFLAGS=['xaudio2_8.lib']) +env.Append(CPPDEFINES=["XAUDIO2_ENABLED"]) +env.Append(LINKFLAGS=["xaudio2_8.lib"]) diff --git a/editor/SCsub b/editor/SCsub index 61562d70d3..72a168efe2 100644 --- a/editor/SCsub +++ b/editor/SCsub @@ -1,6 +1,6 @@ #!/usr/bin/env python -Import('env') +Import("env") env.editor_sources = [] @@ -16,24 +16,24 @@ def _make_doc_data_class_path(to_path): g.write("static const int _doc_data_class_path_count = " + str(len(env.doc_class_path)) + ";\n") g.write("struct _DocDataClassPath { const char* name; const char* path; };\n") - g.write("static const _DocDataClassPath _doc_data_class_paths[" + str(len(env.doc_class_path) + 1) + "] = {\n"); + g.write("static const _DocDataClassPath _doc_data_class_paths[" + str(len(env.doc_class_path) + 1) + "] = {\n") for c in sorted(env.doc_class_path): - g.write("\t{\"" + c + "\", \"" + env.doc_class_path[c] + "\"},\n") + g.write('\t{"' + c + '", "' + env.doc_class_path[c] + '"},\n') g.write("\t{NULL, NULL}\n") g.write("};\n") g.close() -if env['tools']: +if env["tools"]: # Register exporters reg_exporters_inc = '#include "register_exporters.h"\n' - reg_exporters = 'void register_exporters() {\n' + reg_exporters = "void register_exporters() {\n" for e in env.platform_exporters: env.add_source_files(env.editor_sources, "#platform/" + e + "/export/export.cpp") - reg_exporters += '\tregister_' + e + '_exporter();\n' + reg_exporters += "\tregister_" + e + "_exporter();\n" reg_exporters_inc += '#include "platform/' + e + '/export/export.h"\n' - reg_exporters += '}\n' + reg_exporters += "}\n" # NOTE: It is safe to generate this file here, since this is still executed serially with open("register_exporters.gen.cpp", "w", encoding="utf-8") as f: @@ -50,12 +50,12 @@ if env['tools']: for d in doc_dirs: try: - for f in os.listdir(os.path.join(env.Dir('#').abspath, d)): + for f in os.listdir(os.path.join(env.Dir("#").abspath, d)): docs.append("#" + os.path.join(d, f)) except OSError: pass - _make_doc_data_class_path(os.path.join(env.Dir('#').abspath, "editor")) + _make_doc_data_class_path(os.path.join(env.Dir("#").abspath, "editor")) docs = sorted(docs) env.Depends("#editor/doc_data_compressed.gen.h", docs) @@ -63,32 +63,36 @@ if env['tools']: import glob - path = env.Dir('.').abspath + path = env.Dir(".").abspath # Editor translations tlist = glob.glob(path + "/translations/*.po") - env.Depends('#editor/editor_translations.gen.h', tlist) - env.CommandNoCache('#editor/editor_translations.gen.h', tlist, run_in_subprocess(editor_builders.make_editor_translations_header)) + env.Depends("#editor/editor_translations.gen.h", tlist) + env.CommandNoCache( + "#editor/editor_translations.gen.h", tlist, run_in_subprocess(editor_builders.make_editor_translations_header) + ) # Documentation translations tlist = glob.glob(env.Dir("#doc").abspath + "/translations/*.po") - env.Depends('#editor/doc_translations.gen.h', tlist) - env.CommandNoCache('#editor/doc_translations.gen.h', tlist, run_in_subprocess(editor_builders.make_doc_translations_header)) + env.Depends("#editor/doc_translations.gen.h", tlist) + env.CommandNoCache( + "#editor/doc_translations.gen.h", tlist, run_in_subprocess(editor_builders.make_doc_translations_header) + ) # Fonts flist = glob.glob(path + "/../thirdparty/fonts/*.ttf") flist.extend(glob.glob(path + "/../thirdparty/fonts/*.otf")) flist.sort() - env.Depends('#editor/builtin_fonts.gen.h', flist) - env.CommandNoCache('#editor/builtin_fonts.gen.h', flist, run_in_subprocess(editor_builders.make_fonts_header)) + env.Depends("#editor/builtin_fonts.gen.h", flist) + env.CommandNoCache("#editor/builtin_fonts.gen.h", flist, run_in_subprocess(editor_builders.make_fonts_header)) env.add_source_files(env.editor_sources, "*.cpp") - SConscript('debugger/SCsub') - SConscript('fileserver/SCsub') - SConscript('icons/SCsub') - SConscript('import/SCsub') - SConscript('plugins/SCsub') + SConscript("debugger/SCsub") + SConscript("fileserver/SCsub") + SConscript("icons/SCsub") + SConscript("import/SCsub") + SConscript("plugins/SCsub") lib = env.add_library("editor", env.editor_sources) env.Prepend(LIBS=[lib]) diff --git a/editor/debugger/SCsub b/editor/debugger/SCsub index 2b1e889fb0..359d04e5df 100644 --- a/editor/debugger/SCsub +++ b/editor/debugger/SCsub @@ -1,5 +1,5 @@ #!/usr/bin/env python -Import('env') +Import("env") env.add_source_files(env.editor_sources, "*.cpp") diff --git a/editor/doc_data.cpp b/editor/doc_data.cpp index 66134b4428..845e7725f3 100644 --- a/editor/doc_data.cpp +++ b/editor/doc_data.cpp @@ -372,7 +372,7 @@ void DocData::generate(bool p_basic_types) { if (skip_setter_getter_methods && setters_getters.has(E->get().name)) { // Don't skip parametric setters and getters, i.e. method which require // one or more parameters to define what property should be set or retrieved. - // E.g. CPUParticles::set_param(Parameter param, float value). + // E.g. CPUParticles3D::set_param(Parameter param, float value). if (E->get().arguments.size() == 0 /* getter */ || (E->get().arguments.size() == 1 && E->get().return_val.type == Variant::NIL /* setter */)) { continue; } diff --git a/editor/editor_builders.py b/editor/editor_builders.py index 44c3e50dfc..0c9cf91b2f 100644 --- a/editor/editor_builders.py +++ b/editor/editor_builders.py @@ -25,6 +25,7 @@ def make_doc_header(target, source, env): buf = (docbegin + buf + docend).encode("utf-8") decomp_size = len(buf) import zlib + buf = zlib.compress(buf) g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") @@ -55,7 +56,7 @@ def make_fonts_header(target, source, env): # saving uncompressed, since freetype will reference from memory pointer xl_names = [] for i in range(len(source)): - with open(source[i], "rb")as f: + with open(source[i], "rb") as f: buf = f.read() name = os.path.splitext(os.path.basename(source[i]))[0] @@ -111,7 +112,9 @@ def make_translations_header(target, source, env, category): g.write("};\n\n") g.write("static {}TranslationList _{}_translations[] = {{\n".format(category.capitalize(), category)) for x in xl_names: - g.write("\t{{ \"{}\", {}, {}, _{}_translation_{}_compressed }},\n".format(x[0], str(x[1]), str(x[2]), category, x[0])) + g.write( + '\t{{ "{}", {}, {}, _{}_translation_{}_compressed }},\n'.format(x[0], str(x[1]), str(x[2]), category, x[0]) + ) g.write("\t{NULL, 0, 0, NULL}\n") g.write("};\n") @@ -128,5 +131,5 @@ def make_doc_translations_header(target, source, env): make_translations_header(target, source, env, "doc") -if __name__ == '__main__': +if __name__ == "__main__": subprocess_main(globals()) diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp index 5883b5eb1e..1321ee9144 100644 --- a/editor/editor_export.cpp +++ b/editor/editor_export.cpp @@ -582,6 +582,14 @@ String EditorExportPlugin::get_ios_cpp_code() const { return ios_cpp_code; } +void EditorExportPlugin::add_ios_project_static_lib(const String &p_path) { + ios_project_static_libs.push_back(p_path); +} + +Vector<String> EditorExportPlugin::get_ios_project_static_libs() const { + return ios_project_static_libs; +} + void EditorExportPlugin::_export_file_script(const String &p_path, const String &p_type, const Vector<String> &p_features) { if (get_script_instance()) { @@ -617,6 +625,7 @@ void EditorExportPlugin::skip() { void EditorExportPlugin::_bind_methods() { ClassDB::bind_method(D_METHOD("add_shared_object", "path", "tags"), &EditorExportPlugin::add_shared_object); + ClassDB::bind_method(D_METHOD("add_ios_project_static_lib", "path"), &EditorExportPlugin::add_ios_project_static_lib); ClassDB::bind_method(D_METHOD("add_file", "path", "file", "remap"), &EditorExportPlugin::add_file); ClassDB::bind_method(D_METHOD("add_ios_framework", "path"), &EditorExportPlugin::add_ios_framework); ClassDB::bind_method(D_METHOD("add_ios_plist_content", "plist_content"), &EditorExportPlugin::add_ios_plist_content); diff --git a/editor/editor_export.h b/editor/editor_export.h index 81790eb0a4..845638a691 100644 --- a/editor/editor_export.h +++ b/editor/editor_export.h @@ -291,6 +291,7 @@ class EditorExportPlugin : public Reference { bool skipped; Vector<String> ios_frameworks; + Vector<String> ios_project_static_libs; String ios_plist_content; String ios_linker_flags; Vector<String> ios_bundle_files; @@ -322,6 +323,7 @@ protected: void add_shared_object(const String &p_path, const Vector<String> &tags); void add_ios_framework(const String &p_path); + void add_ios_project_static_lib(const String &p_path); void add_ios_plist_content(const String &p_plist_content); void add_ios_linker_flags(const String &p_flags); void add_ios_bundle_file(const String &p_path); @@ -336,6 +338,7 @@ protected: public: Vector<String> get_ios_frameworks() const; + Vector<String> get_ios_project_static_libs() const; String get_ios_plist_content() const; String get_ios_linker_flags() const; Vector<String> get_ios_bundle_files() const; diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 2ba67ae879..37f78434df 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -365,6 +365,9 @@ void EditorNode::_notification(int p_what) { RS::get_singleton()->camera_effects_set_dof_blur_quality(dof_quality, dof_jitter); RS::get_singleton()->environment_set_ssao_quality(RS::EnvironmentSSAOQuality(int(GLOBAL_GET("rendering/quality/ssao/quality"))), GLOBAL_GET("rendering/quality/ssao/half_size")); RS::get_singleton()->screen_space_roughness_limiter_set_active(GLOBAL_GET("rendering/quality/filters/screen_space_roughness_limiter"), GLOBAL_GET("rendering/quality/filters/screen_space_roughness_limiter_curve")); + + bool glow_bicubic = int(GLOBAL_GET("rendering/quality/glow/upscale_mode")) > 0; + RS::get_singleton()->environment_glow_set_use_bicubic_upscale(glow_bicubic); } ResourceImporterTexture::get_singleton()->update_imports(); diff --git a/editor/fileserver/SCsub b/editor/fileserver/SCsub index 2b1e889fb0..359d04e5df 100644 --- a/editor/fileserver/SCsub +++ b/editor/fileserver/SCsub @@ -1,5 +1,5 @@ #!/usr/bin/env python -Import('env') +Import("env") env.add_source_files(env.editor_sources, "*.cpp") diff --git a/editor/icons/GizmoCPUParticles.svg b/editor/icons/GizmoCPUParticles3D.svg index d4e86d9c42..d4e86d9c42 100644 --- a/editor/icons/GizmoCPUParticles.svg +++ b/editor/icons/GizmoCPUParticles3D.svg diff --git a/editor/icons/GizmoParticles.svg b/editor/icons/GizmoGPUParticles3D.svg index 1c5d8c5f2d..1c5d8c5f2d 100644 --- a/editor/icons/GizmoParticles.svg +++ b/editor/icons/GizmoGPUParticles3D.svg diff --git a/editor/icons/SCsub b/editor/icons/SCsub index b39c74c66a..f0d51999f0 100644 --- a/editor/icons/SCsub +++ b/editor/icons/SCsub @@ -1,21 +1,21 @@ #!/usr/bin/env python -Import('env') +Import("env") from platform_methods import run_in_subprocess import editor_icons_builders -make_editor_icons_builder = Builder(action=run_in_subprocess(editor_icons_builders.make_editor_icons_action), - suffix='.h', - src_suffix='.svg') +make_editor_icons_builder = Builder( + action=run_in_subprocess(editor_icons_builders.make_editor_icons_action), suffix=".h", src_suffix=".svg" +) -env['BUILDERS']['MakeEditorIconsBuilder'] = make_editor_icons_builder +env["BUILDERS"]["MakeEditorIconsBuilder"] = make_editor_icons_builder # Editor's own icons icon_sources = Glob("*.svg") # Module icons for module_icons in env.module_icons_paths: - icon_sources += Glob('#' + module_icons + "/*.svg") + icon_sources += Glob("#" + module_icons + "/*.svg") -env.Alias('editor_icons', [env.MakeEditorIconsBuilder('#editor/editor_icons.gen.h', icon_sources)]) +env.Alias("editor_icons", [env.MakeEditorIconsBuilder("#editor/editor_icons.gen.h", icon_sources)]) diff --git a/editor/icons/SubViewport.svg b/editor/icons/SubViewport.svg new file mode 100644 index 0000000000..103b1006ad --- /dev/null +++ b/editor/icons/SubViewport.svg @@ -0,0 +1 @@ +<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m3 2c-.5304.0000801-1.0390625.2108475-1.4140625.5859375-.37509.37501-.5858575.8836225-.5859375 1.4140625v8c.0000803.5304.2108475 1.039063.5859375 1.414062.37501.375091.8836225.585858 1.4140625.585938h10c1.1046 0 2-.89543 2-2v-8c0-1.1046-.89543-2-2-2zm0 1h10c.55228.0000096.99999.44772 1 1v8c-.00001.55228-.44772.99999-1 1h-10c-.55228-.00001-.99999-.44772-1-1v-8c.0000096-.55228.44772-.99999 1-1zm3 1c-.5304.0001-1.0390625.2108375-1.4140625.5859375-.37509.375-.5858575.8836225-.5859375 1.4140625v4c.00008.5304.2108475 1.039062.5859375 1.414062.37501.3751.8836225.585838 1.4140625.585938h4c1.1046 0 2-.8954 2-2v-4c0-1.1046-.89543-2-2-2zm0 1h4c.55228 0 .99999.4477 1 1v4c-.00001.5523-.44772 1-1 1h-4c-.55228 0-.99999-.4477-1-1v-4c.00001-.5523.44772-1 1-1z" fill="#e0e0e0" fill-opacity=".996078"/></svg>
\ No newline at end of file diff --git a/editor/icons/editor_icons_builders.py b/editor/icons/editor_icons_builders.py index a00f21c265..d7145abe50 100644 --- a/editor/icons/editor_icons_builders.py +++ b/editor/icons/editor_icons_builders.py @@ -22,16 +22,16 @@ def make_editor_icons_action(target, source, env): icons_string.write('\t"') - with open(fname, 'rb') as svgf: + with open(fname, "rb") as svgf: b = svgf.read(1) - while(len(b) == 1): + while len(b) == 1: icons_string.write("\\" + str(hex(ord(b)))[1:]) b = svgf.read(1) icons_string.write('"') if fname != svg_icons[-1]: icons_string.write(",") - icons_string.write('\n') + icons_string.write("\n") s = StringIO() s.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") @@ -40,7 +40,7 @@ def make_editor_icons_action(target, source, env): s.write("static const int editor_icons_count = {};\n".format(len(svg_icons))) s.write("static const char *editor_icons_sources[] = {\n") s.write(icons_string.getvalue()) - s.write('};\n\n') + s.write("};\n\n") s.write("static const char *editor_icons_names[] = {\n") # this is used to store the indices of thumbnail icons @@ -63,11 +63,11 @@ def make_editor_icons_action(target, source, env): if fname != svg_icons[-1]: s.write(",") - s.write('\n') + s.write("\n") index += 1 - s.write('};\n') + s.write("};\n") if thumb_medium_indices: s.write("\n\n") @@ -91,5 +91,5 @@ def make_editor_icons_action(target, source, env): icons_string.close() -if __name__ == '__main__': +if __name__ == "__main__": subprocess_main(globals()) diff --git a/editor/import/SCsub b/editor/import/SCsub index 2b1e889fb0..359d04e5df 100644 --- a/editor/import/SCsub +++ b/editor/import/SCsub @@ -1,5 +1,5 @@ #!/usr/bin/env python -Import('env') +Import("env") env.add_source_files(env.editor_sources, "*.cpp") diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp index 6c089d7020..f16c3a9e68 100644 --- a/editor/import/editor_import_collada.cpp +++ b/editor/import/editor_import_collada.cpp @@ -318,7 +318,7 @@ Error ColladaImport::_create_scene(Collada::Node *p_node, Node3D *p_parent) { } else { //mesh since nothing else node = memnew(MeshInstance3D); - //Object::cast_to<MeshInstance>(node)->set_flag(GeometryInstance::FLAG_USE_BAKED_LIGHT, true); + //Object::cast_to<MeshInstance3D>(node)->set_flag(GeometryInstance3D::FLAG_USE_BAKED_LIGHT, true); } } break; case Collada::Node::TYPE_SKELETON: { diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp index fb57773b18..7a1de78001 100644 --- a/editor/import/resource_importer_scene.cpp +++ b/editor/import/resource_importer_scene.cpp @@ -448,7 +448,7 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh> } else if (empty_draw_type == "IMAGE") { WorldMarginShape3D *world_margin_shape = memnew(WorldMarginShape3D); colshape->set_shape(world_margin_shape); - colshape->set_name("WorldMarginShape"); + colshape->set_name("WorldMarginShape3D"); } else { SphereShape3D *sphereShape = memnew(SphereShape3D); sphereShape->set_radius(1); diff --git a/editor/import/resource_importer_texture.cpp b/editor/import/resource_importer_texture.cpp index c218697423..c92251ca60 100644 --- a/editor/import/resource_importer_texture.cpp +++ b/editor/import/resource_importer_texture.cpp @@ -424,7 +424,7 @@ Error ResourceImporterTexture::import(const String &p_source_file, const String String normal_map = p_options["roughness/src_normal"]; Ref<Image> normal_image; - Image::RoughnessChannel roughness_channel; + Image::RoughnessChannel roughness_channel = Image::ROUGHNESS_CHANNEL_R; if (mipmaps && roughness > 1 && FileAccess::exists(normal_map)) { normal_image.instance(); diff --git a/editor/node_3d_editor_gizmos.cpp b/editor/node_3d_editor_gizmos.cpp index 40c17a9fc3..b0f7d2e460 100644 --- a/editor/node_3d_editor_gizmos.cpp +++ b/editor/node_3d_editor_gizmos.cpp @@ -1971,7 +1971,7 @@ bool RayCastNode3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { } String RayCastNode3DGizmoPlugin::get_name() const { - return "RayCast"; + return "RayCast3D"; } int RayCastNode3DGizmoPlugin::get_priority() const { @@ -2025,7 +2025,7 @@ bool SpringArmNode3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { } String SpringArmNode3DGizmoPlugin::get_name() const { - return "SpringArm"; + return "SpringArm3D"; } int SpringArmNode3DGizmoPlugin::get_priority() const { @@ -2045,7 +2045,7 @@ bool VehicleWheelNode3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { } String VehicleWheelNode3DGizmoPlugin::get_name() const { - return "VehicleWheel"; + return "VehicleWheel3D"; } int VehicleWheelNode3DGizmoPlugin::get_priority() const { @@ -2119,7 +2119,7 @@ bool SoftBodyNode3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { } String SoftBodyNode3DGizmoPlugin::get_name() const { - return "SoftBody"; + return "SoftBody3D"; } int SoftBodyNode3DGizmoPlugin::get_priority() const { @@ -2162,7 +2162,7 @@ void SoftBodyNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { } String SoftBodyNode3DGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, int p_idx) const { - return "SoftBody pin point"; + return "SoftBody3D pin point"; } Variant SoftBodyNode3DGizmoPlugin::get_handle_value(EditorNode3DGizmo *p_gizmo, int p_idx) const { @@ -2195,7 +2195,7 @@ bool VisibilityNotifierGizmoPlugin::has_gizmo(Node3D *p_spatial) { } String VisibilityNotifierGizmoPlugin::get_name() const { - return "VisibilityNotifier"; + return "VisibilityNotifier3D"; } int VisibilityNotifierGizmoPlugin::get_priority() const { @@ -2342,59 +2342,59 @@ void VisibilityNotifierGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { //// -CPUParticlesGizmoPlugin::CPUParticlesGizmoPlugin() { - create_icon_material("particles_icon", Node3DEditor::get_singleton()->get_theme_icon("GizmoCPUParticles", "EditorIcons")); +CPUParticles3DGizmoPlugin::CPUParticles3DGizmoPlugin() { + create_icon_material("particles_icon", Node3DEditor::get_singleton()->get_theme_icon("GizmoCPUParticles3D", "EditorIcons")); } -bool CPUParticlesGizmoPlugin::has_gizmo(Node3D *p_spatial) { +bool CPUParticles3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { return Object::cast_to<CPUParticles3D>(p_spatial) != NULL; } -String CPUParticlesGizmoPlugin::get_name() const { - return "CPUParticles"; +String CPUParticles3DGizmoPlugin::get_name() const { + return "CPUParticles3D"; } -int CPUParticlesGizmoPlugin::get_priority() const { +int CPUParticles3DGizmoPlugin::get_priority() const { return -1; } -bool CPUParticlesGizmoPlugin::is_selectable_when_hidden() const { +bool CPUParticles3DGizmoPlugin::is_selectable_when_hidden() const { return true; } -void CPUParticlesGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { +void CPUParticles3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { Ref<Material> icon = get_material("particles_icon", p_gizmo); p_gizmo->add_unscaled_billboard(icon, 0.05); } //// -ParticlesGizmoPlugin::ParticlesGizmoPlugin() { +GPUParticles3DGizmoPlugin::GPUParticles3DGizmoPlugin() { Color gizmo_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/particles", Color(0.8, 0.7, 0.4)); create_material("particles_material", gizmo_color); gizmo_color.a = 0.1; create_material("particles_solid_material", gizmo_color); - create_icon_material("particles_icon", Node3DEditor::get_singleton()->get_theme_icon("GizmoParticles", "EditorIcons")); + create_icon_material("particles_icon", Node3DEditor::get_singleton()->get_theme_icon("GizmoGPUParticles3D", "EditorIcons")); create_handle_material("handles"); } -bool ParticlesGizmoPlugin::has_gizmo(Node3D *p_spatial) { +bool GPUParticles3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { return Object::cast_to<GPUParticles3D>(p_spatial) != NULL; } -String ParticlesGizmoPlugin::get_name() const { - return "Particles"; +String GPUParticles3DGizmoPlugin::get_name() const { + return "GPUParticles3D"; } -int ParticlesGizmoPlugin::get_priority() const { +int GPUParticles3DGizmoPlugin::get_priority() const { return -1; } -bool ParticlesGizmoPlugin::is_selectable_when_hidden() const { +bool GPUParticles3DGizmoPlugin::is_selectable_when_hidden() const { return true; } -String ParticlesGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, int p_idx) const { +String GPUParticles3DGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, int p_idx) const { switch (p_idx) { case 0: return "Size X"; @@ -2407,12 +2407,12 @@ String ParticlesGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, i return ""; } -Variant ParticlesGizmoPlugin::get_handle_value(EditorNode3DGizmo *p_gizmo, int p_idx) const { +Variant GPUParticles3DGizmoPlugin::get_handle_value(EditorNode3DGizmo *p_gizmo, int p_idx) const { GPUParticles3D *particles = Object::cast_to<GPUParticles3D>(p_gizmo->get_spatial_node()); return particles->get_visibility_aabb(); } -void ParticlesGizmoPlugin::set_handle(EditorNode3DGizmo *p_gizmo, int p_idx, Camera3D *p_camera, const Point2 &p_point) { +void GPUParticles3DGizmoPlugin::set_handle(EditorNode3DGizmo *p_gizmo, int p_idx, Camera3D *p_camera, const Point2 &p_point) { GPUParticles3D *particles = Object::cast_to<GPUParticles3D>(p_gizmo->get_spatial_node()); @@ -2464,7 +2464,7 @@ void ParticlesGizmoPlugin::set_handle(EditorNode3DGizmo *p_gizmo, int p_idx, Cam } } -void ParticlesGizmoPlugin::commit_handle(EditorNode3DGizmo *p_gizmo, int p_idx, const Variant &p_restore, bool p_cancel) { +void GPUParticles3DGizmoPlugin::commit_handle(EditorNode3DGizmo *p_gizmo, int p_idx, const Variant &p_restore, bool p_cancel) { GPUParticles3D *particles = Object::cast_to<GPUParticles3D>(p_gizmo->get_spatial_node()); @@ -2480,7 +2480,7 @@ void ParticlesGizmoPlugin::commit_handle(EditorNode3DGizmo *p_gizmo, int p_idx, ur->commit_action(); } -void ParticlesGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { +void GPUParticles3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { GPUParticles3D *particles = Object::cast_to<GPUParticles3D>(p_gizmo->get_spatial_node()); @@ -3725,7 +3725,7 @@ bool NavigationMeshNode3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { } String NavigationMeshNode3DGizmoPlugin::get_name() const { - return "NavigationRegion"; + return "NavigationRegion3D"; } int NavigationMeshNode3DGizmoPlugin::get_priority() const { diff --git a/editor/node_3d_editor_gizmos.h b/editor/node_3d_editor_gizmos.h index 014b736a0d..f8339b4c6c 100644 --- a/editor/node_3d_editor_gizmos.h +++ b/editor/node_3d_editor_gizmos.h @@ -236,8 +236,8 @@ public: VisibilityNotifierGizmoPlugin(); }; -class CPUParticlesGizmoPlugin : public EditorNode3DGizmoPlugin { - GDCLASS(CPUParticlesGizmoPlugin, EditorNode3DGizmoPlugin); +class CPUParticles3DGizmoPlugin : public EditorNode3DGizmoPlugin { + GDCLASS(CPUParticles3DGizmoPlugin, EditorNode3DGizmoPlugin); public: bool has_gizmo(Node3D *p_spatial); @@ -245,12 +245,12 @@ public: int get_priority() const; bool is_selectable_when_hidden() const; void redraw(EditorNode3DGizmo *p_gizmo); - CPUParticlesGizmoPlugin(); + CPUParticles3DGizmoPlugin(); }; -class ParticlesGizmoPlugin : public EditorNode3DGizmoPlugin { +class GPUParticles3DGizmoPlugin : public EditorNode3DGizmoPlugin { - GDCLASS(ParticlesGizmoPlugin, EditorNode3DGizmoPlugin); + GDCLASS(GPUParticles3DGizmoPlugin, EditorNode3DGizmoPlugin); public: bool has_gizmo(Node3D *p_spatial); @@ -264,7 +264,7 @@ public: void set_handle(EditorNode3DGizmo *p_gizmo, int p_idx, Camera3D *p_camera, const Point2 &p_point); void commit_handle(EditorNode3DGizmo *p_gizmo, int p_idx, const Variant &p_restore, bool p_cancel = false); - ParticlesGizmoPlugin(); + GPUParticles3DGizmoPlugin(); }; class ReflectionProbeGizmoPlugin : public EditorNode3DGizmoPlugin { diff --git a/editor/plugins/SCsub b/editor/plugins/SCsub index 2b1e889fb0..359d04e5df 100644 --- a/editor/plugins/SCsub +++ b/editor/plugins/SCsub @@ -1,5 +1,5 @@ #!/usr/bin/env python -Import('env') +Import("env") env.add_source_files(env.editor_sources, "*.cpp") diff --git a/editor/plugins/camera_3d_editor_plugin.cpp b/editor/plugins/camera_3d_editor_plugin.cpp index 3d9b74c2da..759f01135e 100644 --- a/editor/plugins/camera_3d_editor_plugin.cpp +++ b/editor/plugins/camera_3d_editor_plugin.cpp @@ -96,7 +96,7 @@ bool Camera3DEditorPlugin::handles(Object *p_object) const { void Camera3DEditorPlugin::make_visible(bool p_visible) { if (p_visible) { - //Node3DEditor::get_singleton()->set_can_preview(Object::cast_to<Camera>(p_object)); + //Node3DEditor::get_singleton()->set_can_preview(Object::cast_to<Camera3D>(p_object)); } else { Node3DEditor::get_singleton()->set_can_preview(NULL); } diff --git a/editor/plugins/cpu_particles_3d_editor_plugin.h b/editor/plugins/cpu_particles_3d_editor_plugin.h index aac9cc9a2f..796c842e07 100644 --- a/editor/plugins/cpu_particles_3d_editor_plugin.h +++ b/editor/plugins/cpu_particles_3d_editor_plugin.h @@ -72,7 +72,7 @@ class CPUParticles3DEditorPlugin : public EditorPlugin { EditorNode *editor; public: - virtual String get_name() const { return "CPUParticles"; } + virtual String get_name() const { return "CPUParticles3D"; } bool has_main_screen() const { return false; } virtual void edit(Object *p_object); virtual bool handles(Object *p_object) const; diff --git a/editor/plugins/gpu_particles_2d_editor_plugin.h b/editor/plugins/gpu_particles_2d_editor_plugin.h index 904786ffae..008d04a211 100644 --- a/editor/plugins/gpu_particles_2d_editor_plugin.h +++ b/editor/plugins/gpu_particles_2d_editor_plugin.h @@ -87,7 +87,7 @@ protected: static void _bind_methods(); public: - virtual String get_name() const { return "Particles2D"; } + virtual String get_name() const { return "GPUParticles2D"; } bool has_main_screen() const { return false; } virtual void edit(Object *p_object); virtual bool handles(Object *p_object) const; diff --git a/editor/plugins/gpu_particles_3d_editor_plugin.h b/editor/plugins/gpu_particles_3d_editor_plugin.h index d730457d01..cf1cff32c0 100644 --- a/editor/plugins/gpu_particles_3d_editor_plugin.h +++ b/editor/plugins/gpu_particles_3d_editor_plugin.h @@ -108,7 +108,7 @@ class GPUParticles3DEditorPlugin : public EditorPlugin { EditorNode *editor; public: - virtual String get_name() const { return "Particles"; } + virtual String get_name() const { return "GPUParticles3D"; } bool has_main_screen() const { return false; } virtual void edit(Object *p_object); virtual bool handles(Object *p_object) const; diff --git a/editor/plugins/mesh_instance_3d_editor_plugin.cpp b/editor/plugins/mesh_instance_3d_editor_plugin.cpp index a4e7b2df08..ccefdcd28f 100644 --- a/editor/plugins/mesh_instance_3d_editor_plugin.cpp +++ b/editor/plugins/mesh_instance_3d_editor_plugin.cpp @@ -337,18 +337,15 @@ void MeshInstance3DEditor::_create_uv_lines(int p_layer) { const Vector2 *r = uv.ptr(); Vector<int> indices = a[Mesh::ARRAY_INDEX]; - const int *ri; + const int *ri = NULL; int ic; - bool use_indices; if (indices.size()) { ic = indices.size(); ri = indices.ptr(); - use_indices = true; } else { ic = uv.size(); - use_indices = false; } for (int j = 0; j < ic; j += 3) { @@ -356,7 +353,7 @@ void MeshInstance3DEditor::_create_uv_lines(int p_layer) { for (int k = 0; k < 3; k++) { MeshInstance3DEditorEdgeSort edge; - if (use_indices) { + if (ri) { edge.a = r[ri[j + k]]; edge.b = r[ri[j + ((k + 1) % 3)]]; } else { @@ -392,17 +389,17 @@ void MeshInstance3DEditor::_create_outline_mesh() { Ref<Mesh> mesh = node->get_mesh(); if (mesh.is_null()) { - err_dialog->set_text(TTR("MeshInstance lacks a Mesh!")); + err_dialog->set_text(TTR("MeshInstance3D lacks a Mesh.")); err_dialog->popup_centered(); return; } if (mesh->get_surface_count() == 0) { - err_dialog->set_text(TTR("Mesh has not surface to create outlines from!")); + err_dialog->set_text(TTR("Mesh has not surface to create outlines from.")); err_dialog->popup_centered(); return; } else if (mesh->get_surface_count() == 1 && mesh->surface_get_primitive_type(0) != Mesh::PRIMITIVE_TRIANGLES) { - err_dialog->set_text(TTR("Mesh primitive type is not PRIMITIVE_TRIANGLES!")); + err_dialog->set_text(TTR("Mesh primitive type is not PRIMITIVE_TRIANGLES.")); err_dialog->popup_centered(); return; } @@ -410,7 +407,7 @@ void MeshInstance3DEditor::_create_outline_mesh() { Ref<Mesh> mesho = mesh->create_outline(outline_size->get_value()); if (mesho.is_null()) { - err_dialog->set_text(TTR("Could not create outline!")); + err_dialog->set_text(TTR("Could not create outline.")); err_dialog->popup_centered(); return; } @@ -447,7 +444,7 @@ MeshInstance3DEditor::MeshInstance3DEditor() { options->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("MeshInstance3D", "EditorIcons")); options->get_popup()->add_item(TTR("Create Trimesh Static Body"), MENU_OPTION_CREATE_STATIC_TRIMESH_BODY); - options->get_popup()->set_item_tooltip(options->get_popup()->get_item_count() - 1, TTR("Creates a StaticBody and assigns a polygon-based collision shape to it automatically.\nThis is the most accurate (but slowest) option for collision detection.")); + options->get_popup()->set_item_tooltip(options->get_popup()->get_item_count() - 1, TTR("Creates a StaticBody3D and assigns a polygon-based collision shape to it automatically.\nThis is the most accurate (but slowest) option for collision detection.")); options->get_popup()->add_separator(); options->get_popup()->add_item(TTR("Create Trimesh Collision Sibling"), MENU_OPTION_CREATE_TRIMESH_COLLISION_SHAPE); options->get_popup()->set_item_tooltip(options->get_popup()->get_item_count() - 1, TTR("Creates a polygon-based collision shape.\nThis is the most accurate (but slowest) option for collision detection.")); diff --git a/editor/plugins/multimesh_editor_plugin.cpp b/editor/plugins/multimesh_editor_plugin.cpp index 658e3ea565..3257db8751 100644 --- a/editor/plugins/multimesh_editor_plugin.cpp +++ b/editor/plugins/multimesh_editor_plugin.cpp @@ -82,7 +82,7 @@ void MultiMeshEditor::_populate() { if (!ms_instance) { - err_dialog->set_text(TTR("Mesh source is invalid (not a MeshInstance).")); + err_dialog->set_text(TTR("Mesh source is invalid (not a MeshInstance3D).")); err_dialog->popup_centered(); return; } diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index 6f6d06b09d..01868ba77e 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -5919,8 +5919,8 @@ void Node3DEditor::_register_all_gizmos() { add_gizmo_plugin(Ref<SpringArmNode3DGizmoPlugin>(memnew(SpringArmNode3DGizmoPlugin))); add_gizmo_plugin(Ref<VehicleWheelNode3DGizmoPlugin>(memnew(VehicleWheelNode3DGizmoPlugin))); add_gizmo_plugin(Ref<VisibilityNotifierGizmoPlugin>(memnew(VisibilityNotifierGizmoPlugin))); - add_gizmo_plugin(Ref<ParticlesGizmoPlugin>(memnew(ParticlesGizmoPlugin))); - add_gizmo_plugin(Ref<CPUParticlesGizmoPlugin>(memnew(CPUParticlesGizmoPlugin))); + add_gizmo_plugin(Ref<GPUParticles3DGizmoPlugin>(memnew(GPUParticles3DGizmoPlugin))); + add_gizmo_plugin(Ref<CPUParticles3DGizmoPlugin>(memnew(CPUParticles3DGizmoPlugin))); add_gizmo_plugin(Ref<ReflectionProbeGizmoPlugin>(memnew(ReflectionProbeGizmoPlugin))); add_gizmo_plugin(Ref<GIProbeGizmoPlugin>(memnew(GIProbeGizmoPlugin))); // add_gizmo_plugin(Ref<BakedIndirectLightGizmoPlugin>(memnew(BakedIndirectLightGizmoPlugin))); diff --git a/editor/plugins/path_3d_editor_plugin.cpp b/editor/plugins/path_3d_editor_plugin.cpp index f3729a3e89..cf8ddb84cd 100644 --- a/editor/plugins/path_3d_editor_plugin.cpp +++ b/editor/plugins/path_3d_editor_plugin.cpp @@ -637,7 +637,7 @@ Ref<EditorNode3DGizmo> PathNode3DGizmoPlugin::create_gizmo(Node3D *p_spatial) { } String PathNode3DGizmoPlugin::get_name() const { - return "Path"; + return "Path3D"; } int PathNode3DGizmoPlugin::get_priority() const { diff --git a/editor/plugins/path_3d_editor_plugin.h b/editor/plugins/path_3d_editor_plugin.h index ca051295f0..15804faa47 100644 --- a/editor/plugins/path_3d_editor_plugin.h +++ b/editor/plugins/path_3d_editor_plugin.h @@ -103,9 +103,7 @@ public: static Path3DEditorPlugin *singleton; virtual bool forward_spatial_gui_input(Camera3D *p_camera, const Ref<InputEvent> &p_event); - //virtual bool forward_gui_input(const InputEvent& p_event) { return collision_polygon_editor->forward_gui_input(p_event); } - //virtual Ref<Node3DEditorGizmo> create_spatial_gizmo(Spatial *p_spatial); - virtual String get_name() const { return "Path"; } + virtual String get_name() const { return "Path3D"; } bool has_main_screen() const { return false; } virtual void edit(Object *p_object); virtual bool handles(Object *p_object) const; diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp index f570baa885..a5bd5aed6b 100644 --- a/editor/plugins/polygon_2d_editor_plugin.cpp +++ b/editor/plugins/polygon_2d_editor_plugin.cpp @@ -1031,7 +1031,7 @@ void Polygon2DEditor::_uv_draw() { uvs = node->get_polygon(); } - const float *weight_r; + const float *weight_r = NULL; if (uv_edit_mode[3]->is_pressed()) { int bone_selected = -1; @@ -1044,7 +1044,6 @@ void Polygon2DEditor::_uv_draw() { } if (bone_selected != -1 && node->get_bone_weights(bone_selected).size() == uvs.size()) { - weight_r = node->get_bone_weights(bone_selected).ptr(); } } diff --git a/editor/plugins/skeleton_ik_3d_editor_plugin.h b/editor/plugins/skeleton_ik_3d_editor_plugin.h index 1466d670ba..88472a2963 100644 --- a/editor/plugins/skeleton_ik_3d_editor_plugin.h +++ b/editor/plugins/skeleton_ik_3d_editor_plugin.h @@ -51,7 +51,7 @@ protected: static void _bind_methods(); public: - virtual String get_name() const { return "SkeletonIK"; } + virtual String get_name() const { return "SkeletonIK3D"; } bool has_main_screen() const { return false; } virtual void edit(Object *p_object); virtual bool handles(Object *p_object) const; diff --git a/editor/plugins/sprite_2d_editor_plugin.h b/editor/plugins/sprite_2d_editor_plugin.h index d0ebf9c84e..0add77843b 100644 --- a/editor/plugins/sprite_2d_editor_plugin.h +++ b/editor/plugins/sprite_2d_editor_plugin.h @@ -104,7 +104,7 @@ class Sprite2DEditorPlugin : public EditorPlugin { EditorNode *editor; public: - virtual String get_name() const { return "Sprite"; } + virtual String get_name() const { return "Sprite2D"; } bool has_main_screen() const { return false; } virtual void edit(Object *p_object); virtual bool handles(Object *p_object) const; diff --git a/editor/translations/extract.py b/editor/translations/extract.py index 10859c7c90..749bad5fff 100755 --- a/editor/translations/extract.py +++ b/editor/translations/extract.py @@ -10,23 +10,23 @@ import sys line_nb = False for arg in sys.argv[1:]: - if (arg == "--with-line-nb"): + if arg == "--with-line-nb": print("Enabling line numbers in the context locations.") line_nb = True else: os.sys.exit("Non supported argument '" + arg + "'. Aborting.") -if (not os.path.exists("editor")): +if not os.path.exists("editor"): os.sys.exit("ERROR: This script should be started from the root of the git repo.") matches = [] -for root, dirnames, filenames in os.walk('.'): +for root, dirnames, filenames in os.walk("."): dirnames[:] = [d for d in dirnames if d not in ["thirdparty"]] - for filename in fnmatch.filter(filenames, '*.cpp'): + for filename in fnmatch.filter(filenames, "*.cpp"): matches.append(os.path.join(root, filename)) - for filename in fnmatch.filter(filenames, '*.h'): + for filename in fnmatch.filter(filenames, "*.h"): matches.append(os.path.join(root, filename)) matches.sort() @@ -51,52 +51,54 @@ msgstr "" "Content-Transfer-Encoding: 8-bit\\n" """ + def process_file(f, fname): global main_po, unique_str, unique_loc l = f.readline() lc = 1 - while (l): + while l: - patterns = ['RTR(\"', 'TTR(\"', 'TTRC(\"'] + patterns = ['RTR("', 'TTR("', 'TTRC("'] idx = 0 pos = 0 - while (pos >= 0): + while pos >= 0: pos = l.find(patterns[idx], pos) - if (pos == -1): - if (idx < len(patterns) - 1): + if pos == -1: + if idx < len(patterns) - 1: idx += 1 pos = 0 continue pos += len(patterns[idx]) msg = "" - while (pos < len(l) and (l[pos] != '"' or l[pos - 1] == '\\')): + while pos < len(l) and (l[pos] != '"' or l[pos - 1] == "\\"): msg += l[pos] pos += 1 - location = os.path.relpath(fname).replace('\\', '/') - if (line_nb): + location = os.path.relpath(fname).replace("\\", "/") + if line_nb: location += ":" + str(lc) - if (not msg in unique_str): + if not msg in unique_str: main_po += "\n#: " + location + "\n" main_po += 'msgid "' + msg + '"\n' main_po += 'msgstr ""\n' unique_str.append(msg) unique_loc[msg] = [location] - elif (not location in unique_loc[msg]): + elif not location in unique_loc[msg]: # Add additional location to previous occurrence too msg_pos = main_po.find('\nmsgid "' + msg + '"') - if (msg_pos == -1): + if msg_pos == -1: print("Someone apparently thought writing Python was as easy as GDScript. Ping Akien.") - main_po = main_po[:msg_pos] + ' ' + location + main_po[msg_pos:] + main_po = main_po[:msg_pos] + " " + location + main_po[msg_pos:] unique_loc[msg].append(location) l = f.readline() lc += 1 + print("Updating the editor.pot template...") for fname in matches: @@ -106,7 +108,7 @@ for fname in matches: with open("editor.pot", "w") as f: f.write(main_po) -if (os.name == "posix"): +if os.name == "posix": print("Wrapping template at 79 characters for compatibility with Weblate.") os.system("msgmerge -w79 editor.pot editor.pot > editor.pot.wrap") shutil.move("editor.pot.wrap", "editor.pot") @@ -114,7 +116,7 @@ if (os.name == "posix"): shutil.move("editor.pot", "editor/translations/editor.pot") # TODO: Make that in a portable way, if we care; if not, kudos to Unix users -if (os.name == "posix"): +if os.name == "posix": added = subprocess.check_output(r"git diff editor/translations/editor.pot | grep \+msgid | wc -l", shell=True) removed = subprocess.check_output(r"git diff editor/translations/editor.pot | grep \\\-msgid | wc -l", shell=True) print("\n# Template changes compared to the staged status:") diff --git a/gles_builders.py b/gles_builders.py index e4e5fafc85..e8928728fa 100644 --- a/gles_builders.py +++ b/gles_builders.py @@ -7,7 +7,6 @@ from platform_methods import subprocess_main class LegacyGLHeaderStruct: - def __init__(self): self.vertex_lines = [] self.fragment_lines = [] @@ -73,7 +72,7 @@ def include_file_in_legacygl_header(filename, header_data, depth): ifdefline = line.replace("#ifdef ", "").strip() if line.find("_EN_") != -1: - enumbase = ifdefline[:ifdefline.find("_EN_")] + enumbase = ifdefline[: ifdefline.find("_EN_")] ifdefline = ifdefline.replace("_EN_", "_") line = line.replace("_EN_", "_") if enumbase not in header_data.enums: @@ -86,12 +85,12 @@ def include_file_in_legacygl_header(filename, header_data, depth): if line.find("uniform") != -1 and line.lower().find("texunit:") != -1: # texture unit - texunitstr = line[line.find(":") + 1:].strip() + texunitstr = line[line.find(":") + 1 :].strip() if texunitstr == "auto": texunit = "-1" else: texunit = str(int(texunitstr)) - uline = line[:line.lower().find("//")] + uline = line[: line.lower().find("//")] uline = uline.replace("uniform", "") uline = uline.replace("highp", "") uline = uline.replace(";", "") @@ -99,10 +98,10 @@ def include_file_in_legacygl_header(filename, header_data, depth): for x in lines: x = x.strip() - x = x[x.rfind(" ") + 1:] + x = x[x.rfind(" ") + 1 :] if x.find("[") != -1: # unfiorm array - x = x[:x.find("[")] + x = x[: x.find("[")] if not x in header_data.texunit_names: header_data.texunits += [(x, texunit)] @@ -110,10 +109,10 @@ def include_file_in_legacygl_header(filename, header_data, depth): elif line.find("uniform") != -1 and line.lower().find("ubo:") != -1: # uniform buffer object - ubostr = line[line.find(":") + 1:].strip() + ubostr = line[line.find(":") + 1 :].strip() ubo = str(int(ubostr)) - uline = line[:line.lower().find("//")] - uline = uline[uline.find("uniform") + len("uniform"):] + uline = line[: line.lower().find("//")] + uline = uline[uline.find("uniform") + len("uniform") :] uline = uline.replace("highp", "") uline = uline.replace(";", "") uline = uline.replace("{", "").strip() @@ -121,10 +120,10 @@ def include_file_in_legacygl_header(filename, header_data, depth): for x in lines: x = x.strip() - x = x[x.rfind(" ") + 1:] + x = x[x.rfind(" ") + 1 :] if x.find("[") != -1: # unfiorm array - x = x[:x.find("[")] + x = x[: x.find("[")] if not x in header_data.ubo_names: header_data.ubos += [(x, ubo)] @@ -137,10 +136,10 @@ def include_file_in_legacygl_header(filename, header_data, depth): for x in lines: x = x.strip() - x = x[x.rfind(" ") + 1:] + x = x[x.rfind(" ") + 1 :] if x.find("[") != -1: # unfiorm array - x = x[:x.find("[")] + x = x[: x.find("[")] if not x in header_data.uniforms: header_data.uniforms += [x] @@ -150,7 +149,7 @@ def include_file_in_legacygl_header(filename, header_data, depth): uline = uline.replace("attribute ", "") uline = uline.replace("highp ", "") uline = uline.replace(";", "") - uline = uline[uline.find(" "):].strip() + uline = uline[uline.find(" ") :].strip() if uline.find("//") != -1: name, bind = uline.split("//") @@ -163,7 +162,7 @@ def include_file_in_legacygl_header(filename, header_data, depth): uline = line.replace("out ", "") uline = uline.replace("highp ", "") uline = uline.replace(";", "") - uline = uline[uline.find(" "):].strip() + uline = uline[uline.find(" ") :].strip() if uline.find("//") != -1: name, bind = uline.split("//") @@ -200,17 +199,19 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs, gles2 fd.write("/* WARNING, THIS FILE WAS GENERATED, DO NOT EDIT */\n") out_file_base = out_file - out_file_base = out_file_base[out_file_base.rfind("/") + 1:] - out_file_base = out_file_base[out_file_base.rfind("\\") + 1:] + out_file_base = out_file_base[out_file_base.rfind("/") + 1 :] + out_file_base = out_file_base[out_file_base.rfind("\\") + 1 :] out_file_ifdef = out_file_base.replace(".", "_").upper() fd.write("#ifndef " + out_file_ifdef + class_suffix + "_120\n") fd.write("#define " + out_file_ifdef + class_suffix + "_120\n") - out_file_class = out_file_base.replace(".glsl.gen.h", "").title().replace("_", "").replace(".", "") + "Shader" + class_suffix + out_file_class = ( + out_file_base.replace(".glsl.gen.h", "").title().replace("_", "").replace(".", "") + "Shader" + class_suffix + ) fd.write("\n\n") - fd.write("#include \"" + include + "\"\n\n\n") + fd.write('#include "' + include + '"\n\n\n') fd.write("class " + out_file_class + " : public Shader" + class_suffix + " {\n\n") - fd.write("\t virtual String get_shader_name() const { return \"" + out_file_class + "\"; }\n") + fd.write('\t virtual String get_shader_name() const { return "' + out_file_class + '"; }\n') fd.write("public:\n\n") @@ -228,29 +229,64 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs, gles2 fd.write("\t_FORCE_INLINE_ int get_uniform(Uniforms p_uniform) const { return _get_uniform(p_uniform); }\n\n") if header_data.conditionals: - fd.write("\t_FORCE_INLINE_ void set_conditional(Conditionals p_conditional,bool p_enable) { _set_conditional(p_conditional,p_enable); }\n\n") + fd.write( + "\t_FORCE_INLINE_ void set_conditional(Conditionals p_conditional,bool p_enable) { _set_conditional(p_conditional,p_enable); }\n\n" + ) fd.write("\t#ifdef DEBUG_ENABLED\n ") - fd.write("\t#define _FU if (get_uniform(p_uniform)<0) return; if (!is_version_valid()) return; ERR_FAIL_COND( get_active()!=this ); \n\n ") + fd.write( + "\t#define _FU if (get_uniform(p_uniform)<0) return; if (!is_version_valid()) return; ERR_FAIL_COND( get_active()!=this ); \n\n " + ) fd.write("\t#else\n ") fd.write("\t#define _FU if (get_uniform(p_uniform)<0) return; \n\n ") fd.write("\t#endif\n") - fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_value) { _FU glUniform1f(get_uniform(p_uniform),p_value); }\n\n") - fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, double p_value) { _FU glUniform1f(get_uniform(p_uniform),p_value); }\n\n") - fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint8_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n") - fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int8_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n") - fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint16_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n") - fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int16_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n") - fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint32_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n") - fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int32_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n") - fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Color& p_color) { _FU GLfloat col[4]={p_color.r,p_color.g,p_color.b,p_color.a}; glUniform4fv(get_uniform(p_uniform),1,col); }\n\n") - fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Vector2& p_vec2) { _FU GLfloat vec2[2]={p_vec2.x,p_vec2.y}; glUniform2fv(get_uniform(p_uniform),1,vec2); }\n\n") - fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Size2i& p_vec2) { _FU GLint vec2[2]={p_vec2.x,p_vec2.y}; glUniform2iv(get_uniform(p_uniform),1,vec2); }\n\n") - fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Vector3& p_vec3) { _FU GLfloat vec3[3]={p_vec3.x,p_vec3.y,p_vec3.z}; glUniform3fv(get_uniform(p_uniform),1,vec3); }\n\n") - fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b) { _FU glUniform2f(get_uniform(p_uniform),p_a,p_b); }\n\n") - fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b, float p_c) { _FU glUniform3f(get_uniform(p_uniform),p_a,p_b,p_c); }\n\n") - fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b, float p_c, float p_d) { _FU glUniform4f(get_uniform(p_uniform),p_a,p_b,p_c,p_d); }\n\n") - - fd.write("""\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Transform& p_transform) { _FU + fd.write( + "\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_value) { _FU glUniform1f(get_uniform(p_uniform),p_value); }\n\n" + ) + fd.write( + "\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, double p_value) { _FU glUniform1f(get_uniform(p_uniform),p_value); }\n\n" + ) + fd.write( + "\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint8_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n" + ) + fd.write( + "\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int8_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n" + ) + fd.write( + "\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint16_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n" + ) + fd.write( + "\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int16_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n" + ) + fd.write( + "\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint32_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n" + ) + fd.write( + "\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int32_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n" + ) + fd.write( + "\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Color& p_color) { _FU GLfloat col[4]={p_color.r,p_color.g,p_color.b,p_color.a}; glUniform4fv(get_uniform(p_uniform),1,col); }\n\n" + ) + fd.write( + "\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Vector2& p_vec2) { _FU GLfloat vec2[2]={p_vec2.x,p_vec2.y}; glUniform2fv(get_uniform(p_uniform),1,vec2); }\n\n" + ) + fd.write( + "\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Size2i& p_vec2) { _FU GLint vec2[2]={p_vec2.x,p_vec2.y}; glUniform2iv(get_uniform(p_uniform),1,vec2); }\n\n" + ) + fd.write( + "\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Vector3& p_vec3) { _FU GLfloat vec3[3]={p_vec3.x,p_vec3.y,p_vec3.z}; glUniform3fv(get_uniform(p_uniform),1,vec3); }\n\n" + ) + fd.write( + "\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b) { _FU glUniform2f(get_uniform(p_uniform),p_a,p_b); }\n\n" + ) + fd.write( + "\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b, float p_c) { _FU glUniform3f(get_uniform(p_uniform),p_a,p_b,p_c); }\n\n" + ) + fd.write( + "\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b, float p_c, float p_d) { _FU glUniform4f(get_uniform(p_uniform),p_a,p_b,p_c,p_d); }\n\n" + ) + + fd.write( + """\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Transform& p_transform) { _FU const Transform &tr = p_transform; @@ -276,9 +312,11 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs, gles2 glUniformMatrix4fv(get_uniform(p_uniform),1,false,matrix); } - """) + """ + ) - fd.write("""_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Transform2D& p_transform) { _FU + fd.write( + """_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Transform2D& p_transform) { _FU const Transform2D &tr = p_transform; @@ -304,9 +342,11 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs, gles2 glUniformMatrix4fv(get_uniform(p_uniform),1,false,matrix); } - """) + """ + ) - fd.write("""_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const CameraMatrix& p_matrix) { _FU + fd.write( + """_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const CameraMatrix& p_matrix) { _FU GLfloat matrix[16]; @@ -320,7 +360,8 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs, gles2 glUniformMatrix4fv(get_uniform(p_uniform),1,false,matrix); } - """) + """ + ) fd.write("\n\n#undef _FU\n\n\n") @@ -340,21 +381,25 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs, gles2 x = header_data.enums[xv] bits = 1 amt = len(x) - while (2 ** bits < amt): + while 2 ** bits < amt: bits += 1 strs = "{" for i in range(amt): - strs += "\"#define " + x[i] + "\\n\"," + strs += '"#define ' + x[i] + '\\n",' c = {} c["set_mask"] = "uint64_t(" + str(i) + ")<<" + str(bitofs) - c["clear_mask"] = "((uint64_t(1)<<40)-1) ^ (((uint64_t(1)<<" + str(bits) + ") - 1)<<" + str(bitofs) + ")" + c["clear_mask"] = ( + "((uint64_t(1)<<40)-1) ^ (((uint64_t(1)<<" + str(bits) + ") - 1)<<" + str(bitofs) + ")" + ) enum_vals.append(c) enum_constants.append(x[i]) strs += "NULL}" - fd.write("\t\t\t{(uint64_t(1<<" + str(bits) + ")-1)<<" + str(bitofs) + "," + str(bitofs) + "," + strs + "},\n") + fd.write( + "\t\t\t{(uint64_t(1<<" + str(bits) + ")-1)<<" + str(bitofs) + "," + str(bitofs) + "," + strs + "},\n" + ) bitofs += bits fd.write("\t\t};\n\n") @@ -373,7 +418,7 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs, gles2 fd.write("\t\tstatic const char* _conditional_strings[]={\n") if header_data.conditionals: for x in header_data.conditionals: - fd.write("\t\t\t\"#define " + x + "\\n\",\n") + fd.write('\t\t\t"#define ' + x + '\\n",\n') conditionals_found.append(x) fd.write("\t\t};\n\n") else: @@ -384,7 +429,7 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs, gles2 fd.write("\t\tstatic const char* _uniform_strings[]={\n") if header_data.uniforms: for x in header_data.uniforms: - fd.write("\t\t\t\"" + x + "\",\n") + fd.write('\t\t\t"' + x + '",\n') fd.write("\t\t};\n\n") else: fd.write("\t\tstatic const char **_uniform_strings=NULL;\n") @@ -394,7 +439,7 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs, gles2 fd.write("\t\tstatic AttributePair _attribute_pairs[]={\n") for x in header_data.attributes: - fd.write("\t\t\t{\"" + x[0] + "\"," + x[1] + "},\n") + fd.write('\t\t\t{"' + x[0] + '",' + x[1] + "},\n") fd.write("\t\t};\n\n") else: fd.write("\t\tstatic AttributePair *_attribute_pairs=NULL;\n") @@ -408,9 +453,9 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs, gles2 name = x[0] cond = x[1] if cond in conditionals_found: - fd.write("\t\t\t{\"" + name + "\"," + str(conditionals_found.index(cond)) + "},\n") + fd.write('\t\t\t{"' + name + '",' + str(conditionals_found.index(cond)) + "},\n") else: - fd.write("\t\t\t{\"" + name + "\",-1},\n") + fd.write('\t\t\t{"' + name + '",-1},\n') feedback_count += 1 @@ -424,7 +469,7 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs, gles2 if header_data.texunits: fd.write("\t\tstatic TexUnitPair _texunit_pairs[]={\n") for x in header_data.texunits: - fd.write("\t\t\t{\"" + x[0] + "\"," + x[1] + "},\n") + fd.write('\t\t\t{"' + x[0] + '",' + x[1] + "},\n") fd.write("\t\t};\n\n") else: fd.write("\t\tstatic TexUnitPair *_texunit_pairs=NULL;\n") @@ -432,7 +477,7 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs, gles2 if not gles2 and header_data.ubos: fd.write("\t\tstatic UBOPair _ubo_pairs[]={\n") for x in header_data.ubos: - fd.write("\t\t\t{\"" + x[0] + "\"," + x[1] + "},\n") + fd.write('\t\t\t{"' + x[0] + '",' + x[1] + "},\n") fd.write("\t\t};\n\n") else: if gles2: @@ -445,7 +490,7 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs, gles2 for c in x: fd.write(str(ord(c)) + ",") - fd.write(str(ord('\n')) + ",") + fd.write(str(ord("\n")) + ",") fd.write("\t\t0};\n\n") fd.write("\t\tstatic const int _vertex_code_start=" + str(header_data.vertex_offset) + ";\n") @@ -455,28 +500,73 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs, gles2 for c in x: fd.write(str(ord(c)) + ",") - fd.write(str(ord('\n')) + ",") + fd.write(str(ord("\n")) + ",") fd.write("\t\t0};\n\n") fd.write("\t\tstatic const int _fragment_code_start=" + str(header_data.fragment_offset) + ";\n") if output_attribs: if gles2: - fd.write("\t\tsetup(_conditional_strings," + str(len(header_data.conditionals)) + ",_uniform_strings," + str(len(header_data.uniforms)) + ",_attribute_pairs," + str( - len(header_data.attributes)) + ", _texunit_pairs," + str(len(header_data.texunits)) + ",_vertex_code,_fragment_code,_vertex_code_start,_fragment_code_start);\n") + fd.write( + "\t\tsetup(_conditional_strings," + + str(len(header_data.conditionals)) + + ",_uniform_strings," + + str(len(header_data.uniforms)) + + ",_attribute_pairs," + + str(len(header_data.attributes)) + + ", _texunit_pairs," + + str(len(header_data.texunits)) + + ",_vertex_code,_fragment_code,_vertex_code_start,_fragment_code_start);\n" + ) else: - fd.write("\t\tsetup(_conditional_strings," + str(len(header_data.conditionals)) + ",_uniform_strings," + str(len(header_data.uniforms)) + ",_attribute_pairs," + str( - len(header_data.attributes)) + ", _texunit_pairs," + str(len(header_data.texunits)) + ",_ubo_pairs," + str(len(header_data.ubos)) + ",_feedbacks," + str( - feedback_count) + ",_vertex_code,_fragment_code,_vertex_code_start,_fragment_code_start);\n") + fd.write( + "\t\tsetup(_conditional_strings," + + str(len(header_data.conditionals)) + + ",_uniform_strings," + + str(len(header_data.uniforms)) + + ",_attribute_pairs," + + str(len(header_data.attributes)) + + ", _texunit_pairs," + + str(len(header_data.texunits)) + + ",_ubo_pairs," + + str(len(header_data.ubos)) + + ",_feedbacks," + + str(feedback_count) + + ",_vertex_code,_fragment_code,_vertex_code_start,_fragment_code_start);\n" + ) else: if gles2: - fd.write("\t\tsetup(_conditional_strings," + str(len(header_data.conditionals)) + ",_uniform_strings," + str(len(header_data.uniforms)) + ",_texunit_pairs," + str( - len(header_data.texunits)) + ",_enums," + str(len(header_data.enums)) + ",_enum_values," + str( - enum_value_count) + ",_vertex_code,_fragment_code,_vertex_code_start,_fragment_code_start);\n") + fd.write( + "\t\tsetup(_conditional_strings," + + str(len(header_data.conditionals)) + + ",_uniform_strings," + + str(len(header_data.uniforms)) + + ",_texunit_pairs," + + str(len(header_data.texunits)) + + ",_enums," + + str(len(header_data.enums)) + + ",_enum_values," + + str(enum_value_count) + + ",_vertex_code,_fragment_code,_vertex_code_start,_fragment_code_start);\n" + ) else: - fd.write("\t\tsetup(_conditional_strings," + str(len(header_data.conditionals)) + ",_uniform_strings," + str(len(header_data.uniforms)) + ",_texunit_pairs," + str( - len(header_data.texunits)) + ",_enums," + str(len(header_data.enums)) + ",_enum_values," + str(enum_value_count) + ",_ubo_pairs," + str(len(header_data.ubos)) + ",_feedbacks," + str( - feedback_count) + ",_vertex_code,_fragment_code,_vertex_code_start,_fragment_code_start);\n") + fd.write( + "\t\tsetup(_conditional_strings," + + str(len(header_data.conditionals)) + + ",_uniform_strings," + + str(len(header_data.uniforms)) + + ",_texunit_pairs," + + str(len(header_data.texunits)) + + ",_enums," + + str(len(header_data.enums)) + + ",_enum_values," + + str(enum_value_count) + + ",_ubo_pairs," + + str(len(header_data.ubos)) + + ",_feedbacks," + + str(feedback_count) + + ",_vertex_code,_fragment_code,_vertex_code_start,_fragment_code_start);\n" + ) fd.write("\t}\n\n") @@ -495,12 +585,12 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs, gles2 def build_gles2_headers(target, source, env): for x in source: - build_legacygl_header(str(x), include="drivers/gles2/shader_gles2.h", class_suffix="GLES2", output_attribs=True, gles2=True) - + build_legacygl_header( + str(x), include="drivers/gles2/shader_gles2.h", class_suffix="GLES2", output_attribs=True, gles2=True + ) class RDHeaderStruct: - def __init__(self): self.vertex_lines = [] self.fragment_lines = [] @@ -594,30 +684,30 @@ def build_rd_header(filename): fd.write("/* WARNING, THIS FILE WAS GENERATED, DO NOT EDIT */\n") out_file_base = out_file - out_file_base = out_file_base[out_file_base.rfind("/") + 1:] - out_file_base = out_file_base[out_file_base.rfind("\\") + 1:] + out_file_base = out_file_base[out_file_base.rfind("/") + 1 :] + out_file_base = out_file_base[out_file_base.rfind("\\") + 1 :] out_file_ifdef = out_file_base.replace(".", "_").upper() fd.write("#ifndef " + out_file_ifdef + "_RD\n") fd.write("#define " + out_file_ifdef + "_RD\n") out_file_class = out_file_base.replace(".glsl.gen.h", "").title().replace("_", "").replace(".", "") + "ShaderRD" fd.write("\n") - fd.write("#include \"servers/rendering/rasterizer_rd/shader_rd.h\"\n\n") + fd.write('#include "servers/rendering/rasterizer_rd/shader_rd.h"\n\n') fd.write("class " + out_file_class + " : public ShaderRD {\n\n") fd.write("public:\n\n") fd.write("\t" + out_file_class + "() {\n\n") - if (len(header_data.compute_lines)): + if len(header_data.compute_lines): fd.write("\t\tstatic const char _compute_code[] = {\n") for x in header_data.compute_lines: for c in x: fd.write(str(ord(c)) + ",") - fd.write(str(ord('\n')) + ",") + fd.write(str(ord("\n")) + ",") fd.write("\t\t0};\n\n") - fd.write("\t\tsetup(nullptr, nullptr, _compute_code, \"" + out_file_class + "\");\n") + fd.write('\t\tsetup(nullptr, nullptr, _compute_code, "' + out_file_class + '");\n') fd.write("\t}\n") else: @@ -626,17 +716,17 @@ def build_rd_header(filename): for x in header_data.vertex_lines: for c in x: fd.write(str(ord(c)) + ",") - fd.write(str(ord('\n')) + ",") + fd.write(str(ord("\n")) + ",") fd.write("\t\t0};\n\n") - + fd.write("\t\tstatic const char _fragment_code[]={\n") for x in header_data.fragment_lines: for c in x: fd.write(str(ord(c)) + ",") - fd.write(str(ord('\n')) + ",") + fd.write(str(ord("\n")) + ",") fd.write("\t\t0};\n\n") - fd.write("\t\tsetup(_vertex_code, _fragment_code, nullptr, \"" + out_file_class + "\");\n") + fd.write('\t\tsetup(_vertex_code, _fragment_code, nullptr, "' + out_file_class + '");\n') fd.write("\t}\n") fd.write("};\n\n") @@ -650,5 +740,5 @@ def build_rd_headers(target, source, env): build_rd_header(str(x)) -if __name__ == '__main__': +if __name__ == "__main__": subprocess_main(globals()) diff --git a/main/SCsub b/main/SCsub index 0262701d79..7a301b82bc 100644 --- a/main/SCsub +++ b/main/SCsub @@ -1,6 +1,6 @@ #!/usr/bin/env python -Import('env') +Import("env") from platform_methods import run_in_subprocess import main_builders @@ -14,13 +14,15 @@ env.Depends("#main/splash.gen.h", "#main/splash.png") env.CommandNoCache("#main/splash.gen.h", "#main/splash.png", run_in_subprocess(main_builders.make_splash)) env.Depends("#main/splash_editor.gen.h", "#main/splash_editor.png") -env.CommandNoCache("#main/splash_editor.gen.h", "#main/splash_editor.png", run_in_subprocess(main_builders.make_splash_editor)) +env.CommandNoCache( + "#main/splash_editor.gen.h", "#main/splash_editor.png", run_in_subprocess(main_builders.make_splash_editor) +) env.Depends("#main/app_icon.gen.h", "#main/app_icon.png") env.CommandNoCache("#main/app_icon.gen.h", "#main/app_icon.png", run_in_subprocess(main_builders.make_app_icon)) if env["tools"]: - SConscript('tests/SCsub') + SConscript("tests/SCsub") lib = env.add_library("main", env.main_sources) env.Prepend(LIBS=[lib]) diff --git a/main/main_builders.py b/main/main_builders.py index aebac2b022..2ea774e3b4 100644 --- a/main/main_builders.py +++ b/main/main_builders.py @@ -18,7 +18,7 @@ def make_splash(target, source, env): g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") g.write("#ifndef BOOT_SPLASH_H\n") g.write("#define BOOT_SPLASH_H\n") - g.write('static const Color boot_splash_bg_color = Color(0.14, 0.14, 0.14);\n') + g.write("static const Color boot_splash_bg_color = Color(0.14, 0.14, 0.14);\n") g.write("static const unsigned char boot_splash_png[] = {\n") for i in range(len(buf)): g.write(str(buf[i]) + ",\n") @@ -37,7 +37,7 @@ def make_splash_editor(target, source, env): g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") g.write("#ifndef BOOT_SPLASH_EDITOR_H\n") g.write("#define BOOT_SPLASH_EDITOR_H\n") - g.write('static const Color boot_splash_editor_bg_color = Color(0.14, 0.14, 0.14);\n') + g.write("static const Color boot_splash_editor_bg_color = Color(0.14, 0.14, 0.14);\n") g.write("static const unsigned char boot_splash_editor_png[] = {\n") for i in range(len(buf)): g.write(str(buf[i]) + ",\n") @@ -63,5 +63,5 @@ def make_app_icon(target, source, env): g.write("#endif") -if __name__ == '__main__': +if __name__ == "__main__": subprocess_main(globals()) diff --git a/main/tests/SCsub b/main/tests/SCsub index 437d9ed777..cb1d35b12f 100644 --- a/main/tests/SCsub +++ b/main/tests/SCsub @@ -1,6 +1,6 @@ #!/usr/bin/python -Import('env') +Import("env") env.tests_sources = [] env.add_source_files(env.tests_sources, "*.cpp") diff --git a/methods.py b/methods.py index dc82c97361..89a229e4ab 100644 --- a/methods.py +++ b/methods.py @@ -8,13 +8,13 @@ def add_source_files(self, sources, files, warn_duplicates=True): # Convert string to list of absolute paths (including expanding wildcard) if isinstance(files, (str, bytes)): # Keep SCons project-absolute path as they are (no wildcard support) - if files.startswith('#'): - if '*' in files: + if files.startswith("#"): + if "*" in files: print("ERROR: Wildcards can't be expanded in SCons project-absolute path: '{}'".format(files)) return files = [files] else: - dir_path = self.Dir('.').abspath + dir_path = self.Dir(".").abspath files = sorted(glob.glob(dir_path + "/" + files)) # Add each path as compiled Object following environment (self) configuration @@ -22,7 +22,7 @@ def add_source_files(self, sources, files, warn_duplicates=True): obj = self.Object(path) if obj in sources: if warn_duplicates: - print("WARNING: Object \"{}\" already included in environment sources.".format(obj)) + print('WARNING: Object "{}" already included in environment sources.'.format(obj)) else: continue sources.append(obj) @@ -33,20 +33,20 @@ def disable_warnings(self): if self.msvc: # We have to remove existing warning level defines before appending /w, # otherwise we get: "warning D9025 : overriding '/W3' with '/w'" - warn_flags = ['/Wall', '/W4', '/W3', '/W2', '/W1', '/WX'] - self.Append(CCFLAGS=['/w']) - self.Append(CFLAGS=['/w']) - self.Append(CXXFLAGS=['/w']) - self['CCFLAGS'] = [x for x in self['CCFLAGS'] if not x in warn_flags] - self['CFLAGS'] = [x for x in self['CFLAGS'] if not x in warn_flags] - self['CXXFLAGS'] = [x for x in self['CXXFLAGS'] if not x in warn_flags] + warn_flags = ["/Wall", "/W4", "/W3", "/W2", "/W1", "/WX"] + self.Append(CCFLAGS=["/w"]) + self.Append(CFLAGS=["/w"]) + self.Append(CXXFLAGS=["/w"]) + self["CCFLAGS"] = [x for x in self["CCFLAGS"] if not x in warn_flags] + self["CFLAGS"] = [x for x in self["CFLAGS"] if not x in warn_flags] + self["CXXFLAGS"] = [x for x in self["CXXFLAGS"] if not x in warn_flags] else: - self.Append(CCFLAGS=['-w']) - self.Append(CFLAGS=['-w']) - self.Append(CXXFLAGS=['-w']) + self.Append(CCFLAGS=["-w"]) + self.Append(CFLAGS=["-w"]) + self.Append(CXXFLAGS=["-w"]) -def add_module_version_string(self,s): +def add_module_version_string(self, s): self.module_version_string += "." + s @@ -64,16 +64,16 @@ def update_version(module_version_string=""): f.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") f.write("#ifndef VERSION_GENERATED_GEN_H\n") f.write("#define VERSION_GENERATED_GEN_H\n") - f.write("#define VERSION_SHORT_NAME \"" + str(version.short_name) + "\"\n") - f.write("#define VERSION_NAME \"" + str(version.name) + "\"\n") + f.write('#define VERSION_SHORT_NAME "' + str(version.short_name) + '"\n') + f.write('#define VERSION_NAME "' + str(version.name) + '"\n') f.write("#define VERSION_MAJOR " + str(version.major) + "\n") f.write("#define VERSION_MINOR " + str(version.minor) + "\n") f.write("#define VERSION_PATCH " + str(version.patch) + "\n") - f.write("#define VERSION_STATUS \"" + str(version.status) + "\"\n") - f.write("#define VERSION_BUILD \"" + str(build_name) + "\"\n") - f.write("#define VERSION_MODULE_CONFIG \"" + str(version.module_config) + module_version_string + "\"\n") + f.write('#define VERSION_STATUS "' + str(version.status) + '"\n') + f.write('#define VERSION_BUILD "' + str(build_name) + '"\n') + f.write('#define VERSION_MODULE_CONFIG "' + str(version.module_config) + module_version_string + '"\n') f.write("#define VERSION_YEAR " + str(version.year) + "\n") - f.write("#define VERSION_WEBSITE \"" + str(version.website) + "\"\n") + f.write('#define VERSION_WEBSITE "' + str(version.website) + '"\n') f.write("#endif // VERSION_GENERATED_GEN_H\n") f.close() @@ -99,7 +99,7 @@ def update_version(module_version_string=""): else: githash = head - fhash.write("#define VERSION_HASH \"" + githash + "\"\n") + fhash.write('#define VERSION_HASH "' + githash + '"\n') fhash.write("#endif // VERSION_HASH_GEN_H\n") fhash.close() @@ -158,17 +158,17 @@ def detect_modules(): try: with open("modules/" + x + "/register_types.h"): includes_cpp += '#include "modules/' + x + '/register_types.h"\n' - register_cpp += '#ifdef MODULE_' + x.upper() + '_ENABLED\n' - register_cpp += '\tregister_' + x + '_types();\n' - register_cpp += '#endif\n' - preregister_cpp += '#ifdef MODULE_' + x.upper() + '_ENABLED\n' - preregister_cpp += '#ifdef MODULE_' + x.upper() + '_HAS_PREREGISTER\n' - preregister_cpp += '\tpreregister_' + x + '_types();\n' - preregister_cpp += '#endif\n' - preregister_cpp += '#endif\n' - unregister_cpp += '#ifdef MODULE_' + x.upper() + '_ENABLED\n' - unregister_cpp += '\tunregister_' + x + '_types();\n' - unregister_cpp += '#endif\n' + register_cpp += "#ifdef MODULE_" + x.upper() + "_ENABLED\n" + register_cpp += "\tregister_" + x + "_types();\n" + register_cpp += "#endif\n" + preregister_cpp += "#ifdef MODULE_" + x.upper() + "_ENABLED\n" + preregister_cpp += "#ifdef MODULE_" + x.upper() + "_HAS_PREREGISTER\n" + preregister_cpp += "\tpreregister_" + x + "_types();\n" + preregister_cpp += "#endif\n" + preregister_cpp += "#endif\n" + unregister_cpp += "#ifdef MODULE_" + x.upper() + "_ENABLED\n" + unregister_cpp += "\tunregister_" + x + "_types();\n" + unregister_cpp += "#endif\n" except IOError: pass @@ -191,7 +191,12 @@ void register_module_types() { void unregister_module_types() { %s } -""" % (includes_cpp, preregister_cpp, register_cpp, unregister_cpp) +""" % ( + includes_cpp, + preregister_cpp, + register_cpp, + unregister_cpp, + ) # NOTE: It is safe to generate this file here, since this is still executed serially with open("modules/register_module_types.gen.cpp", "w") as f: @@ -206,7 +211,7 @@ def disable_module(self): def use_windows_spawn_fix(self, platform=None): - if (os.name != "nt"): + if os.name != "nt": return # not needed, only for windows # On Windows, due to the limited command line length, when creating a static library @@ -217,14 +222,21 @@ def use_windows_spawn_fix(self, platform=None): # got built correctly regardless the invocation strategy. # Furthermore, since SCons will rebuild the library from scratch when an object file # changes, no multiple versions of the same object file will be present. - self.Replace(ARFLAGS='q') + self.Replace(ARFLAGS="q") def mySubProcess(cmdline, env): startupinfo = subprocess.STARTUPINFO() startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW - proc = subprocess.Popen(cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE, - stderr=subprocess.PIPE, startupinfo=startupinfo, shell=False, env=env) + proc = subprocess.Popen( + cmdline, + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + startupinfo=startupinfo, + shell=False, + env=env, + ) _, err = proc.communicate() rv = proc.wait() if rv: @@ -235,7 +247,7 @@ def use_windows_spawn_fix(self, platform=None): def mySpawn(sh, escape, cmd, args, env): - newargs = ' '.join(args[1:]) + newargs = " ".join(args[1:]) cmdline = cmd + " " + newargs rv = 0 @@ -251,15 +263,15 @@ def use_windows_spawn_fix(self, platform=None): return rv - self['SPAWN'] = mySpawn + self["SPAWN"] = mySpawn def save_active_platforms(apnames, ap): for x in ap: - names = ['logo'] + names = ["logo"] if os.path.isfile(x + "/run_icon.png"): - names.append('run_icon') + names.append("run_icon") for name in names: pngf = open(x + "/" + name + ".png", "rb") @@ -269,7 +281,7 @@ def save_active_platforms(apnames, ap): while len(b) == 1: str += hex(ord(b)) b = pngf.read(1) - if (len(b) == 1): + if len(b) == 1: str += "," str += "};\n" @@ -289,30 +301,46 @@ def no_verbose(sys, env): # Colors are disabled in non-TTY environments such as pipes. This means # that if output is redirected to a file, it will not contain color codes if sys.stdout.isatty(): - colors['cyan'] = '\033[96m' - colors['purple'] = '\033[95m' - colors['blue'] = '\033[94m' - colors['green'] = '\033[92m' - colors['yellow'] = '\033[93m' - colors['red'] = '\033[91m' - colors['end'] = '\033[0m' + colors["cyan"] = "\033[96m" + colors["purple"] = "\033[95m" + colors["blue"] = "\033[94m" + colors["green"] = "\033[92m" + colors["yellow"] = "\033[93m" + colors["red"] = "\033[91m" + colors["end"] = "\033[0m" else: - colors['cyan'] = '' - colors['purple'] = '' - colors['blue'] = '' - colors['green'] = '' - colors['yellow'] = '' - colors['red'] = '' - colors['end'] = '' - - compile_source_message = '%sCompiling %s==> %s$SOURCE%s' % (colors['blue'], colors['purple'], colors['yellow'], colors['end']) - java_compile_source_message = '%sCompiling %s==> %s$SOURCE%s' % (colors['blue'], colors['purple'], colors['yellow'], colors['end']) - compile_shared_source_message = '%sCompiling shared %s==> %s$SOURCE%s' % (colors['blue'], colors['purple'], colors['yellow'], colors['end']) - link_program_message = '%sLinking Program %s==> %s$TARGET%s' % (colors['red'], colors['purple'], colors['yellow'], colors['end']) - link_library_message = '%sLinking Static Library %s==> %s$TARGET%s' % (colors['red'], colors['purple'], colors['yellow'], colors['end']) - ranlib_library_message = '%sRanlib Library %s==> %s$TARGET%s' % (colors['red'], colors['purple'], colors['yellow'], colors['end']) - link_shared_library_message = '%sLinking Shared Library %s==> %s$TARGET%s' % (colors['red'], colors['purple'], colors['yellow'], colors['end']) - java_library_message = '%sCreating Java Archive %s==> %s$TARGET%s' % (colors['red'], colors['purple'], colors['yellow'], colors['end']) + colors["cyan"] = "" + colors["purple"] = "" + colors["blue"] = "" + colors["green"] = "" + colors["yellow"] = "" + colors["red"] = "" + colors["end"] = "" + + compile_source_message = "{}Compiling {}==> {}$SOURCE{}".format( + colors["blue"], colors["purple"], colors["yellow"], colors["end"] + ) + java_compile_source_message = "{}Compiling {}==> {}$SOURCE{}".format( + colors["blue"], colors["purple"], colors["yellow"], colors["end"] + ) + compile_shared_source_message = "{}Compiling shared {}==> {}$SOURCE{}".format( + colors["blue"], colors["purple"], colors["yellow"], colors["end"] + ) + link_program_message = "{}Linking Program {}==> {}$TARGET{}".format( + colors["red"], colors["purple"], colors["yellow"], colors["end"] + ) + link_library_message = "{}Linking Static Library {}==> {}$TARGET{}".format( + colors["red"], colors["purple"], colors["yellow"], colors["end"] + ) + ranlib_library_message = "{}Ranlib Library {}==> {}$TARGET{}".format( + colors["red"], colors["purple"], colors["yellow"], colors["end"] + ) + link_shared_library_message = "{}Linking Shared Library {}==> {}$TARGET{}".format( + colors["red"], colors["purple"], colors["yellow"], colors["end"] + ) + java_library_message = "{}Creating Java Archive {}==> {}$TARGET{}".format( + colors["red"], colors["purple"], colors["yellow"], colors["end"] + ) env.Append(CXXCOMSTR=[compile_source_message]) env.Append(CCCOMSTR=[compile_source_message]) @@ -353,70 +381,79 @@ def detect_visual_c_compiler_version(tools_env): vc_chosen_compiler_str = "" # Start with Pre VS 2017 checks which uses VCINSTALLDIR: - if 'VCINSTALLDIR' in tools_env: + if "VCINSTALLDIR" in tools_env: # print("Checking VCINSTALLDIR") # find() works with -1 so big ifs below are needed... the simplest solution, in fact # First test if amd64 and amd64_x86 compilers are present in the path vc_amd64_compiler_detection_index = tools_env["PATH"].find(tools_env["VCINSTALLDIR"] + "BIN\\amd64;") - if(vc_amd64_compiler_detection_index > -1): + if vc_amd64_compiler_detection_index > -1: vc_chosen_compiler_index = vc_amd64_compiler_detection_index vc_chosen_compiler_str = "amd64" vc_amd64_x86_compiler_detection_index = tools_env["PATH"].find(tools_env["VCINSTALLDIR"] + "BIN\\amd64_x86;") - if(vc_amd64_x86_compiler_detection_index > -1 - and (vc_chosen_compiler_index == -1 - or vc_chosen_compiler_index > vc_amd64_x86_compiler_detection_index)): + if vc_amd64_x86_compiler_detection_index > -1 and ( + vc_chosen_compiler_index == -1 or vc_chosen_compiler_index > vc_amd64_x86_compiler_detection_index + ): vc_chosen_compiler_index = vc_amd64_x86_compiler_detection_index vc_chosen_compiler_str = "amd64_x86" # Now check the 32 bit compilers vc_x86_compiler_detection_index = tools_env["PATH"].find(tools_env["VCINSTALLDIR"] + "BIN;") - if(vc_x86_compiler_detection_index > -1 - and (vc_chosen_compiler_index == -1 - or vc_chosen_compiler_index > vc_x86_compiler_detection_index)): + if vc_x86_compiler_detection_index > -1 and ( + vc_chosen_compiler_index == -1 or vc_chosen_compiler_index > vc_x86_compiler_detection_index + ): vc_chosen_compiler_index = vc_x86_compiler_detection_index vc_chosen_compiler_str = "x86" - vc_x86_amd64_compiler_detection_index = tools_env["PATH"].find(tools_env['VCINSTALLDIR'] + "BIN\\x86_amd64;") - if(vc_x86_amd64_compiler_detection_index > -1 - and (vc_chosen_compiler_index == -1 - or vc_chosen_compiler_index > vc_x86_amd64_compiler_detection_index)): + vc_x86_amd64_compiler_detection_index = tools_env["PATH"].find(tools_env["VCINSTALLDIR"] + "BIN\\x86_amd64;") + if vc_x86_amd64_compiler_detection_index > -1 and ( + vc_chosen_compiler_index == -1 or vc_chosen_compiler_index > vc_x86_amd64_compiler_detection_index + ): vc_chosen_compiler_index = vc_x86_amd64_compiler_detection_index vc_chosen_compiler_str = "x86_amd64" # and for VS 2017 and newer we check VCTOOLSINSTALLDIR: - if 'VCTOOLSINSTALLDIR' in tools_env: + if "VCTOOLSINSTALLDIR" in tools_env: # Newer versions have a different path available - vc_amd64_compiler_detection_index = tools_env["PATH"].upper().find(tools_env['VCTOOLSINSTALLDIR'].upper() + "BIN\\HOSTX64\\X64;") - if(vc_amd64_compiler_detection_index > -1): + vc_amd64_compiler_detection_index = ( + tools_env["PATH"].upper().find(tools_env["VCTOOLSINSTALLDIR"].upper() + "BIN\\HOSTX64\\X64;") + ) + if vc_amd64_compiler_detection_index > -1: vc_chosen_compiler_index = vc_amd64_compiler_detection_index vc_chosen_compiler_str = "amd64" - vc_amd64_x86_compiler_detection_index = tools_env["PATH"].upper().find(tools_env['VCTOOLSINSTALLDIR'].upper() + "BIN\\HOSTX64\\X86;") - if(vc_amd64_x86_compiler_detection_index > -1 - and (vc_chosen_compiler_index == -1 - or vc_chosen_compiler_index > vc_amd64_x86_compiler_detection_index)): + vc_amd64_x86_compiler_detection_index = ( + tools_env["PATH"].upper().find(tools_env["VCTOOLSINSTALLDIR"].upper() + "BIN\\HOSTX64\\X86;") + ) + if vc_amd64_x86_compiler_detection_index > -1 and ( + vc_chosen_compiler_index == -1 or vc_chosen_compiler_index > vc_amd64_x86_compiler_detection_index + ): vc_chosen_compiler_index = vc_amd64_x86_compiler_detection_index vc_chosen_compiler_str = "amd64_x86" - vc_x86_compiler_detection_index = tools_env["PATH"].upper().find(tools_env['VCTOOLSINSTALLDIR'].upper() + "BIN\\HOSTX86\\X86;") - if(vc_x86_compiler_detection_index > -1 - and (vc_chosen_compiler_index == -1 - or vc_chosen_compiler_index > vc_x86_compiler_detection_index)): + vc_x86_compiler_detection_index = ( + tools_env["PATH"].upper().find(tools_env["VCTOOLSINSTALLDIR"].upper() + "BIN\\HOSTX86\\X86;") + ) + if vc_x86_compiler_detection_index > -1 and ( + vc_chosen_compiler_index == -1 or vc_chosen_compiler_index > vc_x86_compiler_detection_index + ): vc_chosen_compiler_index = vc_x86_compiler_detection_index vc_chosen_compiler_str = "x86" - vc_x86_amd64_compiler_detection_index = tools_env["PATH"].upper().find(tools_env['VCTOOLSINSTALLDIR'].upper() + "BIN\\HOSTX86\\X64;") - if(vc_x86_amd64_compiler_detection_index > -1 - and (vc_chosen_compiler_index == -1 - or vc_chosen_compiler_index > vc_x86_amd64_compiler_detection_index)): + vc_x86_amd64_compiler_detection_index = ( + tools_env["PATH"].upper().find(tools_env["VCTOOLSINSTALLDIR"].upper() + "BIN\\HOSTX86\\X64;") + ) + if vc_x86_amd64_compiler_detection_index > -1 and ( + vc_chosen_compiler_index == -1 or vc_chosen_compiler_index > vc_x86_amd64_compiler_detection_index + ): vc_chosen_compiler_index = vc_x86_amd64_compiler_detection_index vc_chosen_compiler_str = "x86_amd64" return vc_chosen_compiler_str + def find_visual_c_batch_file(env): from SCons.Tool.MSCommon.vc import get_default_version, get_host_target, find_batch_file @@ -424,6 +461,7 @@ def find_visual_c_batch_file(env): (host_platform, target_platform, _) = get_host_target(env) return find_batch_file(env, version, host_platform, target_platform)[0] + def generate_cpp_hint_file(filename): if os.path.isfile(filename): # Don't overwrite an existing hint file since the user may have customized it. @@ -435,15 +473,19 @@ def generate_cpp_hint_file(filename): except IOError: print("Could not write cpp.hint file.") + def generate_vs_project(env, num_jobs): batch_file = find_visual_c_batch_file(env) if batch_file: + def build_commandline(commands): - common_build_prefix = ['cmd /V /C set "plat=$(PlatformTarget)"', - '(if "$(PlatformTarget)"=="x64" (set "plat=x86_amd64"))', - 'set "tools=yes"', - '(if "$(Configuration)"=="release" (set "tools=no"))', - 'call "' + batch_file + '" !plat!'] + common_build_prefix = [ + 'cmd /V /C set "plat=$(PlatformTarget)"', + '(if "$(PlatformTarget)"=="x64" (set "plat=x86_amd64"))', + 'set "tools=yes"', + '(if "$(Configuration)"=="release" (set "tools=no"))', + 'call "' + batch_file + '" !plat!', + ] result = " ^& ".join(common_build_prefix + [commands]) return result @@ -459,87 +501,104 @@ def generate_vs_project(env, num_jobs): # to double quote off the directory. However, the path ends # in a backslash, so we need to remove this, lest it escape the # last double quote off, confusing MSBuild - env['MSVSBUILDCOM'] = build_commandline('scons --directory="$(ProjectDir.TrimEnd(\'\\\'))" platform=windows progress=no target=$(Configuration) tools=!tools! -j' + str(num_jobs)) - env['MSVSREBUILDCOM'] = build_commandline('scons --directory="$(ProjectDir.TrimEnd(\'\\\'))" platform=windows progress=no target=$(Configuration) tools=!tools! vsproj=yes -j' + str(num_jobs)) - env['MSVSCLEANCOM'] = build_commandline('scons --directory="$(ProjectDir.TrimEnd(\'\\\'))" --clean platform=windows progress=no target=$(Configuration) tools=!tools! -j' + str(num_jobs)) + env["MSVSBUILDCOM"] = build_commandline( + "scons --directory=\"$(ProjectDir.TrimEnd('\\'))\" platform=windows progress=no target=$(Configuration) tools=!tools! -j" + + str(num_jobs) + ) + env["MSVSREBUILDCOM"] = build_commandline( + "scons --directory=\"$(ProjectDir.TrimEnd('\\'))\" platform=windows progress=no target=$(Configuration) tools=!tools! vsproj=yes -j" + + str(num_jobs) + ) + env["MSVSCLEANCOM"] = build_commandline( + "scons --directory=\"$(ProjectDir.TrimEnd('\\'))\" --clean platform=windows progress=no target=$(Configuration) tools=!tools! -j" + + str(num_jobs) + ) # This version information (Win32, x64, Debug, Release, Release_Debug seems to be # required for Visual Studio to understand that it needs to generate an NMAKE # project. Do not modify without knowing what you are doing. - debug_variants = ['debug|Win32'] + ['debug|x64'] - release_variants = ['release|Win32'] + ['release|x64'] - release_debug_variants = ['release_debug|Win32'] + ['release_debug|x64'] + debug_variants = ["debug|Win32"] + ["debug|x64"] + release_variants = ["release|Win32"] + ["release|x64"] + release_debug_variants = ["release_debug|Win32"] + ["release_debug|x64"] variants = debug_variants + release_variants + release_debug_variants - debug_targets = ['bin\\godot.windows.tools.32.exe'] + ['bin\\godot.windows.tools.64.exe'] - release_targets = ['bin\\godot.windows.opt.32.exe'] + ['bin\\godot.windows.opt.64.exe'] - release_debug_targets = ['bin\\godot.windows.opt.tools.32.exe'] + ['bin\\godot.windows.opt.tools.64.exe'] + debug_targets = ["bin\\godot.windows.tools.32.exe"] + ["bin\\godot.windows.tools.64.exe"] + release_targets = ["bin\\godot.windows.opt.32.exe"] + ["bin\\godot.windows.opt.64.exe"] + release_debug_targets = ["bin\\godot.windows.opt.tools.32.exe"] + ["bin\\godot.windows.opt.tools.64.exe"] targets = debug_targets + release_targets + release_debug_targets - if not env.get('MSVS'): - env['MSVS']['PROJECTSUFFIX'] = '.vcxproj' - env['MSVS']['SOLUTIONSUFFIX'] = '.sln' + if not env.get("MSVS"): + env["MSVS"]["PROJECTSUFFIX"] = ".vcxproj" + env["MSVS"]["SOLUTIONSUFFIX"] = ".sln" env.MSVSProject( - target=['#godot' + env['MSVSPROJECTSUFFIX']], + target=["#godot" + env["MSVSPROJECTSUFFIX"]], incs=env.vs_incs, srcs=env.vs_srcs, runfile=targets, buildtarget=targets, auto_build_solution=1, - variant=variants) + variant=variants, + ) else: - print("Could not locate Visual Studio batch file for setting up the build environment. Not generating VS project.") + print("Could not locate Visual Studio batch file to set up the build environment. Not generating VS project.") + def precious_program(env, program, sources, **args): program = env.ProgramOriginal(program, sources, **args) env.Precious(program) return program + def add_shared_library(env, name, sources, **args): library = env.SharedLibrary(name, sources, **args) env.NoCache(library) return library + def add_library(env, name, sources, **args): library = env.Library(name, sources, **args) env.NoCache(library) return library + def add_program(env, name, sources, **args): program = env.Program(name, sources, **args) env.NoCache(program) return program + def CommandNoCache(env, target, sources, command, **args): result = env.Command(target, sources, command, **args) env.NoCache(result) return result + def detect_darwin_sdk_path(platform, env): - sdk_name = '' - if platform == 'osx': - sdk_name = 'macosx' - var_name = 'MACOS_SDK_PATH' - elif platform == 'iphone': - sdk_name = 'iphoneos' - var_name = 'IPHONESDK' - elif platform == 'iphonesimulator': - sdk_name = 'iphonesimulator' - var_name = 'IPHONESDK' + sdk_name = "" + if platform == "osx": + sdk_name = "macosx" + var_name = "MACOS_SDK_PATH" + elif platform == "iphone": + sdk_name = "iphoneos" + var_name = "IPHONESDK" + elif platform == "iphonesimulator": + sdk_name = "iphonesimulator" + var_name = "IPHONESDK" else: raise Exception("Invalid platform argument passed to detect_darwin_sdk_path") if not env[var_name]: try: - sdk_path = subprocess.check_output(['xcrun', '--sdk', sdk_name, '--show-sdk-path']).strip().decode("utf-8") + sdk_path = subprocess.check_output(["xcrun", "--sdk", sdk_name, "--show-sdk-path"]).strip().decode("utf-8") if sdk_path: env[var_name] = sdk_path except (subprocess.CalledProcessError, OSError): print("Failed to find SDK path while running xcrun --sdk {} --show-sdk-path.".format(sdk_name)) raise + def is_vanilla_clang(env): if not using_clang(env): return False - version = subprocess.check_output([env['CXX'], '--version']).strip().decode("utf-8") + version = subprocess.check_output([env["CXX"], "--version"]).strip().decode("utf-8") return not version.startswith("Apple") @@ -552,20 +611,22 @@ def get_compiler_version(env): # Not using -dumpversion as some GCC distros only return major, and # Clang used to return hardcoded 4.2.1: # https://reviews.llvm.org/D56803 try: - version = subprocess.check_output([env.subst(env['CXX']), '--version']).strip().decode("utf-8") + version = subprocess.check_output([env.subst(env["CXX"]), "--version"]).strip().decode("utf-8") except (subprocess.CalledProcessError, OSError): print("Couldn't parse CXX environment variable to infer compiler version.") return None else: # TODO: Implement for MSVC return None - match = re.search('[0-9]+\.[0-9.]+', version) + match = re.search("[0-9]+\.[0-9.]+", version) if match is not None: - return list(map(int, match.group().split('.'))) + return list(map(int, match.group().split("."))) else: return None + def using_gcc(env): - return 'gcc' in os.path.basename(env["CC"]) + return "gcc" in os.path.basename(env["CC"]) + def using_clang(env): - return 'clang' in os.path.basename(env["CC"]) + return "clang" in os.path.basename(env["CC"]) diff --git a/misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj b/misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj index 0b8a508d2f..4b2870b67a 100644 --- a/misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj +++ b/misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj @@ -50,10 +50,10 @@ 1FF4C1841F584E3F00A41E41 /* GameKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GameKit.framework; path = System/Library/Frameworks/GameKit.framework; sourceTree = SDKROOT; }; 1FF4C1861F584E5600A41E41 /* StoreKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = StoreKit.framework; path = System/Library/Frameworks/StoreKit.framework; sourceTree = SDKROOT; }; 1FF4C1881F584E7600A41E41 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; - 1FF4C1881F584E6300A41E41 /* $binary.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = $binary.entitlements; sourceTree = "<group>"; }; + 1FF4C1881F584E6300A41E41 /* $binary.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "$binary.entitlements"; sourceTree = "<group>"; }; 1FF8DBB01FBA9DE1009DE660 /* dummy.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = dummy.cpp; sourceTree = "<group>"; }; D07CD44D1C5D589C00B7FB28 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; }; - D0BCFE3418AEBDA2004A7AAE /* $binary.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = $binary.app; sourceTree = BUILT_PRODUCTS_DIR; }; + D0BCFE3418AEBDA2004A7AAE /* $binary.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "$binary.app"; sourceTree = BUILT_PRODUCTS_DIR; }; D0BCFE3718AEBDA2004A7AAE /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; D0BCFE3918AEBDA2004A7AAE /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; E360193621F32F37009258C1 /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = System/Library/Frameworks/CoreVideo.framework; sourceTree = SDKROOT; }; @@ -62,7 +62,7 @@ D0BCFE3F18AEBDA2004A7AAE /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; }; D0BCFE4318AEBDA2004A7AAE /* $binary-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "$binary-Info.plist"; sourceTree = "<group>"; }; D0BCFE4518AEBDA2004A7AAE /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; }; - D0BCFE7718AEBFEB004A7AAE /* $binary.pck */ = {isa = PBXFileReference; lastKnownFileType = file; path = $binary.pck; sourceTree = "<group>"; }; + D0BCFE7718AEBFEB004A7AAE /* $binary.pck */ = {isa = PBXFileReference; lastKnownFileType = file; path = "$binary.pck"; sourceTree = "<group>"; }; /* End PBXFileReference section */ $additional_pbx_files @@ -155,7 +155,7 @@ D0BCFE4218AEBDA2004A7AAE /* Supporting Files */, 1FF8DBB01FBA9DE1009DE660 /* dummy.cpp */, ); - path = $binary; + path = "$binary"; sourceTree = "<group>"; }; D0BCFE4218AEBDA2004A7AAE /* Supporting Files */ = { @@ -422,7 +422,7 @@ ARCHS = "$godot_archs"; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; - CODE_SIGN_ENTITLEMENTS = $binary/$binary.entitlements; + CODE_SIGN_ENTITLEMENTS = "$binary/$binary.entitlements"; CODE_SIGN_IDENTITY = "$code_sign_identity_debug"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "$code_sign_identity_debug"; CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)"; @@ -448,7 +448,7 @@ ARCHS = "$godot_archs"; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; - CODE_SIGN_ENTITLEMENTS = $binary/$binary.entitlements; + CODE_SIGN_ENTITLEMENTS = "$binary/$binary.entitlements"; CODE_SIGN_IDENTITY = "$code_sign_identity_release"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "$code_sign_identity_release"; CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)"; diff --git a/misc/hooks/README.md b/misc/hooks/README.md index b18ba7df38..5661c239ed 100644 --- a/misc/hooks/README.md +++ b/misc/hooks/README.md @@ -5,16 +5,33 @@ contributors to make sure they comply with our requirements. ## List of hooks -- Pre-commit hook for clang-format: Applies clang-format to the staged files - before accepting a commit; blocks the commit and generates a patch if the - style is not respected. - Should work on Linux and macOS. You may need to edit the file if your - clang-format binary is not in the `$PATH`, or if you want to enable colored - output with pygmentize. -- Pre-commit hook for makerst: Checks the class reference syntax using `makerst.py`. - Should work on Linux and macOS. +- Pre-commit hook for `clang-format`: Applies `clang-format` to the staged + files before accepting a commit; blocks the commit and generates a patch if + the style is not respected. + You may need to edit the file if your `clang-format` binary is not in the + `PATH`, or if you want to enable colored output with `pygmentize`. +- Pre-commit hook for `black`: Applies `black` to the staged Python files + before accepting a commit. +- Pre-commit hook for `makerst`: Checks the class reference syntax using + `makerst.py`. ## Installation -Copy all the files from this folder into your `.git/hooks` folder, and make sure -the hooks and helper scripts are executable. +Copy all the files from this folder into your `.git/hooks` folder, and make +sure the hooks and helper scripts are executable. + +#### Linux/MacOS + +The hooks rely on bash scripts and tools which should be in the system `PATH`, +so they should work out of the box on Linux/macOS. + +#### Windows + +##### clang-format +- Download LLVM for Windows (version 8 or later) from + <https://releases.llvm.org/download.html> +- Make sure LLVM is added to the `PATH` during installation + +##### black +- Python installation: make sure Python is added to the `PATH` +- Install `black` - in any console: `pip3 install black` diff --git a/misc/hooks/pre-commit b/misc/hooks/pre-commit index 36e9935785..40cb00253b 100755 --- a/misc/hooks/pre-commit +++ b/misc/hooks/pre-commit @@ -14,7 +14,7 @@ # as this script. Hooks should return 0 if successful and nonzero to cancel the # commit. They are executed in the order in which they are listed. #HOOKS="pre-commit-compile pre-commit-uncrustify" -HOOKS="pre-commit-clang-format pre-commit-makerst" +HOOKS="pre-commit-clang-format pre-commit-black pre-commit-makerst" ########################################################### # There should be no need to change anything below this line. diff --git a/misc/hooks/pre-commit-black b/misc/hooks/pre-commit-black new file mode 100755 index 0000000000..2dcc2e8cf1 --- /dev/null +++ b/misc/hooks/pre-commit-black @@ -0,0 +1,132 @@ +#!/usr/bin/env bash + +# git pre-commit hook that runs a black stylecheck. +# Based on pre-commit-clang-format. + +################################################################## +# SETTINGS +# Set path to black binary. +BLACK=`which black` +BLACK_OPTIONS="-l 120" + +# Remove any older patches from previous commits. Set to true or false. +DELETE_OLD_PATCHES=false + +# File types to parse. +FILE_NAMES="SConstruct SCsub" +FILE_EXTS="py" + +# Use pygmentize instead of cat to parse diff with highlighting. +# Install it with `pip install pygments` (Linux) or `easy_install Pygments` (Mac) +PYGMENTIZE=`which pygmentize` +if [ ! -z "$PYGMENTIZE" ]; then + READER="pygmentize -l diff" +else + READER=cat +fi + +################################################################## +# There should be no need to change anything below this line. + +. "$(dirname -- "$0")/canonicalize_filename.sh" + +# exit on error +set -e + +# check whether the given file matches any of the set extensions +matches_name_or_extension() { + local filename=$(basename "$1") + local extension=".${filename##*.}" + + for name in $FILE_NAMES; do [[ "$name" == "$filename" ]] && return 0; done + for ext in $FILE_EXTS; do [[ "$ext" == "$extension" ]] && return 0; done + + return 1 +} + +# necessary check for initial commit +if git rev-parse --verify HEAD >/dev/null 2>&1 ; then + against=HEAD +else + # Initial commit: diff against an empty tree object + against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 +fi + +if [ ! -x "$BLACK" ] ; then + printf "Error: black executable not found.\n" + printf "Set the correct path in $(canonicalize_filename "$0").\n" + exit 1 +fi + +# create a random filename to store our generated patch +prefix="pre-commit-black" +suffix="$(date +%s)" +patch="/tmp/$prefix-$suffix.patch" + +# clean up any older black patches +$DELETE_OLD_PATCHES && rm -f /tmp/$prefix*.patch + +# create one patch containing all changes to the files +git diff-index --cached --diff-filter=ACMR --name-only $against -- | while read file; +do + # ignore thirdparty files + if grep -q "thirdparty" <<< $file; then + continue; + fi + + # ignore file if not one of the names or extensions we handle + if ! matches_name_or_extension "$file"; then + continue; + fi + + # format our file with black, create a patch with diff and append it to our $patch + # The sed call is necessary to transform the patch from + # --- $file timestamp + # +++ $file timestamp + # to both lines working on the same file and having a/ and b/ prefix. + # Else it can not be applied with 'git apply'. + "$BLACK" "$BLACK_OPTIONS" --diff "$file" | \ + sed -e "1s|--- |--- a/|" -e "2s|+++ |+++ b/|" >> "$patch" +done + +# if no patch has been generated all is ok, clean up the file stub and exit +if [ ! -s "$patch" ] ; then + printf "Files in this commit comply with the black formatter rules.\n" + rm -f "$patch" + exit 0 +fi + +# a patch has been created, notify the user and exit +printf "\nThe following differences were found between the code to commit " +printf "and the black formatter rules:\n\n" +$READER "$patch" +printf "\n" + +# Allows us to read user input below, assigns stdin to keyboard +exec < /dev/tty + +while true; do + read -p "Do you want to apply that patch (Y - Apply, N - Do not apply, S - Apply and stage files)? [Y/N/S] " yn + case $yn in + [Yy] ) git apply $patch; + printf "The patch was applied. You can now stage the changes and commit again.\n\n"; + break + ;; + [Nn] ) printf "\nYou can apply these changes with:\n git apply $patch\n"; + printf "(may need to be called from the root directory of your repository)\n"; + printf "Aborting commit. Apply changes and commit again or skip checking with"; + printf " --no-verify (not recommended).\n\n"; + break + ;; + [Ss] ) git apply $patch; + git diff-index --cached --diff-filter=ACMR --name-only $against -- | while read file; + do git add $file; + done + printf "The patch was applied and the changed files staged. You can now commit.\n\n"; + break + ;; + * ) echo "Please answer yes or no." + ;; + esac +done +exit 1 # we don't commit in any case diff --git a/misc/hooks/pre-commit-clang-format b/misc/hooks/pre-commit-clang-format index e309233a8b..c5cf4ecbb1 100755 --- a/misc/hooks/pre-commit-clang-format +++ b/misc/hooks/pre-commit-clang-format @@ -15,28 +15,28 @@ ################################################################## # SETTINGS -# Set path to clang-format binary -# CLANG_FORMAT="/usr/bin/clang-format" +# Set path to clang-format binary. CLANG_FORMAT=`which clang-format` # Remove any older patches from previous commits. Set to true or false. -# DELETE_OLD_PATCHES=false DELETE_OLD_PATCHES=false # Only parse files with the extensions in FILE_EXTS. Set to true or false. # If false every changed file in the commit will be parsed with clang-format. # If true only files matching one of the extensions are parsed with clang-format. -# PARSE_EXTS=true PARSE_EXTS=true # File types to parse. Only effective when PARSE_EXTS is true. -# FILE_EXTS=".c .h .cpp .hpp" FILE_EXTS=".c .h .cpp .hpp .cc .hh .cxx .m .mm .inc .java .glsl" # Use pygmentize instead of cat to parse diff with highlighting. # Install it with `pip install pygments` (Linux) or `easy_install Pygments` (Mac) -# READER="pygmentize -l diff" -READER=cat +PYGMENTIZE=`which pygmentize` +if [ ! -z "$PYGMENTIZE" ]; then + READER="pygmentize -l diff" +else + READER=cat +fi ################################################################## # There should be no need to change anything below this line. diff --git a/misc/hooks/pre-commit-makerst b/misc/hooks/pre-commit-makerst index d9b684e73b..b990788b99 100755 --- a/misc/hooks/pre-commit-makerst +++ b/misc/hooks/pre-commit-makerst @@ -2,4 +2,11 @@ # Git pre-commit hook that checks the class reference syntax using makerst.py. -doc/tools/makerst.py doc/classes modules --dry-run +# Workaround because we can't execute the .py file directly on windows +PYTHON=python +py_ver=$($PYTHON -c "import sys; print(sys.version_info.major)") +if [[ "$py_ver" != "3" ]]; then + PYTHON+=3 +fi + +$PYTHON doc/tools/makerst.py doc/classes modules --dry-run diff --git a/misc/scripts/fix_headers.py b/misc/scripts/fix_headers.py index f0038a8351..7af97eec4b 100755 --- a/misc/scripts/fix_headers.py +++ b/misc/scripts/fix_headers.py @@ -37,24 +37,24 @@ files = open("files", "r") fname = files.readline() -while (fname != ""): +while fname != "": # Handle replacing $filename with actual filename and keep alignment fsingle = fname.strip() - if (fsingle.find("/") != -1): - fsingle = fsingle[fsingle.rfind("/") + 1:] + if fsingle.find("/") != -1: + fsingle = fsingle[fsingle.rfind("/") + 1 :] rep_fl = "$filename" rep_fi = fsingle len_fl = len(rep_fl) len_fi = len(rep_fi) # Pad with spaces to keep alignment - if (len_fi < len_fl): + if len_fi < len_fl: for x in range(len_fl - len_fi): rep_fi += " " - elif (len_fl < len_fi): + elif len_fl < len_fi: for x in range(len_fi - len_fl): rep_fl += " " - if (header.find(rep_fl) != -1): + if header.find(rep_fl) != -1: text = header.replace(rep_fl, rep_fi) else: text = header.replace("$filename", fsingle) @@ -71,21 +71,21 @@ while (fname != ""): line = fileread.readline() header_done = False - while (line.strip() == ""): # Skip empty lines at the top + while line.strip() == "": # Skip empty lines at the top line = fileread.readline() - if (line.find("/**********") == -1): # Godot header starts this way + if line.find("/**********") == -1: # Godot header starts this way # Maybe starting with a non-Godot comment, abort header magic header_done = True - while (not header_done): # Handle header now - if (line.find("/*") != 0): # No more starting with a comment + while not header_done: # Handle header now + if line.find("/*") != 0: # No more starting with a comment header_done = True - if (line.strip() != ""): + if line.strip() != "": text += line line = fileread.readline() - while (line != ""): # Dump everything until EOF + while line != "": # Dump everything until EOF text += line line = fileread.readline() diff --git a/misc/scripts/fix_style.sh b/misc/scripts/fix_style.sh index b33cb0a7b4..2eee61a459 100755 --- a/misc/scripts/fix_style.sh +++ b/misc/scripts/fix_style.sh @@ -1,9 +1,10 @@ #!/usr/bin/env bash # Command line arguments +run_black=false run_clang_format=false run_fix_headers=false -usage="Invalid argument. Usage:\n$0 <option>\n\t--clang-format|-c\n\t--headers|-h\n\t--all|-a" +usage="Invalid argument. Usage:\n$0 <option>\n\t--black|-b\n\t--clang-format|-c\n\t--headers|-h\n\t--all|-a" if [ -z "$1" ]; then echo -e $usage @@ -12,6 +13,9 @@ fi while [ $# -gt 0 ]; do case "$1" in + --black|-b) + run_black=true + ;; --clang-format|-c) run_clang_format=true ;; @@ -19,6 +23,7 @@ while [ $# -gt 0 ]; do run_fix_headers=true ;; --all|-a) + run_black=true run_clang_format=true run_fix_headers=true ;; @@ -32,6 +37,19 @@ done echo "Removing generated files, some have binary data and make clang-format freeze." find -name "*.gen.*" -delete +# Apply black +if $run_black; then + echo -e "Formatting Python files..." + PY_FILES=$(find \( -path "./.git" \ + -o -path "./thirdparty" \ + \) -prune \ + -o \( -name "SConstruct" \ + -o -name "SCsub" \ + -o -name "*.py" \ + \) -print) + black -l 120 $PY_FILES +fi + # Apply clang-format if $run_clang_format; then # Sync list with pre-commit hook diff --git a/misc/travis/black-format.sh b/misc/travis/black-format.sh new file mode 100755 index 0000000000..75b153f6bb --- /dev/null +++ b/misc/travis/black-format.sh @@ -0,0 +1,48 @@ +#!/bin/sh + +BLACK=black +BLACK_OPTIONS="-l 120" + +if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then + # Travis only clones the PR branch and uses its HEAD commit as detached HEAD, + # so it's problematic when we want an exact commit range for format checks. + # We fetch upstream to ensure that we have the proper references to resolve. + # Ideally we would use $TRAVIS_COMMIT_RANGE but it doesn't play well with PR + # updates, as it only includes changes since the previous state of the PR. + if [ -z "$(git remote | grep upstream)" ]; then + git remote add upstream https://github.com/godotengine/godot \ + --no-tags -f -t $TRAVIS_BRANCH + fi + RANGE="upstream/$TRAVIS_BRANCH HEAD" +else + # Test only the last commit, since $TRAVIS_COMMIT_RANGE wouldn't support + # force pushes. + RANGE=HEAD +fi + +FILES=$(git diff-tree --no-commit-id --name-only -r $RANGE | grep -v thirdparty/| grep -E "(SConstruct|SCsub|\.py)$") +echo "Checking files:\n$FILES" + +# create a random filename to store our generated patch +prefix="static-check-black" +suffix="$(date +%s)" +patch="/tmp/$prefix-$suffix.patch" + +for file in $FILES; do + "$BLACK" "$BLACK_OPTIONS" --diff "$file" | \ + sed -e "1s|--- |--- a/|" -e "2s|+++ |+++ b/|" >> "$patch" +done + +# if no patch has been generated all is ok, clean up the file stub and exit +if [ ! -s "$patch" ] ; then + printf "Files in this commit comply with the black formatting rules.\n" + rm -f "$patch" + exit 0 +fi + +# a patch has been created, notify the user and exit +printf "\n*** The following differences were found between the code to commit " +printf "and the black formatting rules:\n\n" +pygmentize -l diff "$patch" +printf "\n*** Aborting, please fix your commit(s) with 'git commit --amend' or 'git rebase -i <hash>'\n" +exit 1 diff --git a/misc/travis/clang-format.sh b/misc/travis/clang-format.sh index a6585578e1..c917744ece 100755 --- a/misc/travis/clang-format.sh +++ b/misc/travis/clang-format.sh @@ -8,8 +8,10 @@ if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then # We fetch upstream to ensure that we have the proper references to resolve. # Ideally we would use $TRAVIS_COMMIT_RANGE but it doesn't play well with PR # updates, as it only includes changes since the previous state of the PR. - git remote add upstream https://github.com/godotengine/godot \ - --no-tags -f -t $TRAVIS_BRANCH + if [ -z "$(git remote | grep upstream)" ]; then + git remote add upstream https://github.com/godotengine/godot \ + --no-tags -f -t $TRAVIS_BRANCH + fi RANGE="upstream/$TRAVIS_BRANCH HEAD" else # Test only the last commit, since $TRAVIS_COMMIT_RANGE wouldn't support @@ -41,6 +43,6 @@ fi # a patch has been created, notify the user and exit printf "\n*** The following differences were found between the code to commit " printf "and the clang-format rules:\n\n" -cat "$patch" +pygmentize -l diff "$patch" printf "\n*** Aborting, please fix your commit(s) with 'git commit --amend' or 'git rebase -i <hash>'\n" exit 1 diff --git a/modules/SCsub b/modules/SCsub index 5b39b18334..1671b398e5 100644 --- a/modules/SCsub +++ b/modules/SCsub @@ -1,12 +1,12 @@ #!/usr/bin/env python -Import('env') +Import("env") import modules_builders env_modules = env.Clone() -Export('env_modules') +Export("env_modules") # Header with MODULE_*_ENABLED defines. env.CommandNoCache("modules_enabled.gen.h", Value(env.module_list), modules_builders.generate_modules_enabled) diff --git a/modules/arkit/SCsub b/modules/arkit/SCsub index c05595ea2a..61c0a8248c 100644 --- a/modules/arkit/SCsub +++ b/modules/arkit/SCsub @@ -1,7 +1,7 @@ #!/usr/bin/env python -Import('env') -Import('env_modules') +Import("env") +Import("env_modules") env_arkit = env_modules.Clone() @@ -9,4 +9,4 @@ env_arkit = env_modules.Clone() modules_sources = [] env_arkit.add_source_files(modules_sources, "*.cpp") env_arkit.add_source_files(modules_sources, "*.mm") -mod_lib = env_modules.add_library('#bin/libgodot_arkit_module' + env['LIBSUFFIX'], modules_sources) +mod_lib = env_modules.add_library("#bin/libgodot_arkit_module" + env["LIBSUFFIX"], modules_sources) diff --git a/modules/arkit/config.py b/modules/arkit/config.py index 96e41826c5..e68603fc93 100644 --- a/modules/arkit/config.py +++ b/modules/arkit/config.py @@ -1,5 +1,6 @@ def can_build(env, platform): - return platform == 'iphone' + return platform == "iphone" + def configure(env): pass diff --git a/modules/assimp/SCsub b/modules/assimp/SCsub index cef2396dfb..f1d0c742b4 100644 --- a/modules/assimp/SCsub +++ b/modules/assimp/SCsub @@ -1,7 +1,7 @@ #!/usr/bin/env python -Import('env') -Import('env_modules') +Import("env") +Import("env_modules") env_assimp = env_modules.Clone() @@ -10,85 +10,85 @@ env_assimp = env_modules.Clone() if True: # env['builtin_assimp']: thirdparty_dir = "#thirdparty/assimp" - env_assimp.Prepend(CPPPATH=['#thirdparty/assimp']) - env_assimp.Prepend(CPPPATH=['#thirdparty/assimp/code']) - env_assimp.Prepend(CPPPATH=['#thirdparty/assimp/include']) + env_assimp.Prepend(CPPPATH=["#thirdparty/assimp"]) + env_assimp.Prepend(CPPPATH=["#thirdparty/assimp/code"]) + env_assimp.Prepend(CPPPATH=["#thirdparty/assimp/include"]) - #env_assimp.Append(CPPDEFINES=['ASSIMP_DOUBLE_PRECISION']) # TODO default to what godot is compiled with for future double support - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_SINGLETHREADED']) - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_BOOST_WORKAROUND']) - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_OWN_ZLIB']) - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_EXPORT']) + # env_assimp.Append(CPPDEFINES=['ASSIMP_DOUBLE_PRECISION']) # TODO default to what godot is compiled with for future double support + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_SINGLETHREADED"]) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_BOOST_WORKAROUND"]) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_OWN_ZLIB"]) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_EXPORT"]) # Importers we don't need - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_3D_IMPORTER']) - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_3DS_IMPORTER']) - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_3MF_IMPORTER']) - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_AC_IMPORTER']) - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_AMF_IMPORTER']) - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_ASE_IMPORTER']) - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_ASSBIN_IMPORTER']) - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_B3D_IMPORTER']) - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_BLEND_IMPORTER']) - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_BVH_IMPORTER']) - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_C4D_IMPORTER']) - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_COB_IMPORTER']) - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_COLLADA_IMPORTER']) - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_CSM_IMPORTER']) - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_DXF_IMPORTER']) - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_GLTF2_IMPORTER']) - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_GLTF_IMPORTER']) - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_HMP_IMPORTER']) - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_IFC_IMPORTER']) - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_IRR_IMPORTER']) - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_IRRMESH_IMPORTER']) - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_LWO_IMPORTER']) - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_LWS_IMPORTER']) - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_M3D_IMPORTER']) - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_MD2_IMPORTER']) - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_MD3_IMPORTER']) - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_MD5_IMPORTER']) - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_MD5_IMPORTER']) - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_MDC_IMPORTER']) - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_MDL_IMPORTER']) - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_MMD_IMPORTER']) - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_MS3D_IMPORTER']) - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_NDO_IMPORTER']) - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_NFF_IMPORTER']) - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_OBJ_IMPORTER']) - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_OFF_IMPORTER']) - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_OGRE_IMPORTER']) - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_OPENGEX_IMPORTER']) - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_PLY_IMPORTER']) - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_Q3BSP_IMPORTER']) - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_Q3D_IMPORTER']) - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_RAW_IMPORTER']) - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_SIB_IMPORTER']) - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_SMD_IMPORTER']) - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_STEP_IMPORTER']) - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_STL_IMPORTER']) - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_TERRAGEN_IMPORTER']) - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_X3D_IMPORTER']) - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_XGL_IMPORTER']) - env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_X_IMPORTER']) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_3D_IMPORTER"]) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_3DS_IMPORTER"]) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_3MF_IMPORTER"]) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_AC_IMPORTER"]) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_AMF_IMPORTER"]) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_ASE_IMPORTER"]) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_ASSBIN_IMPORTER"]) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_B3D_IMPORTER"]) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_BLEND_IMPORTER"]) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_BVH_IMPORTER"]) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_C4D_IMPORTER"]) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_COB_IMPORTER"]) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_COLLADA_IMPORTER"]) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_CSM_IMPORTER"]) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_DXF_IMPORTER"]) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_GLTF2_IMPORTER"]) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_GLTF_IMPORTER"]) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_HMP_IMPORTER"]) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_IFC_IMPORTER"]) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_IRR_IMPORTER"]) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_IRRMESH_IMPORTER"]) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_LWO_IMPORTER"]) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_LWS_IMPORTER"]) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_M3D_IMPORTER"]) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_MD2_IMPORTER"]) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_MD3_IMPORTER"]) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_MD5_IMPORTER"]) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_MD5_IMPORTER"]) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_MDC_IMPORTER"]) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_MDL_IMPORTER"]) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_MMD_IMPORTER"]) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_MS3D_IMPORTER"]) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_NDO_IMPORTER"]) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_NFF_IMPORTER"]) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_OBJ_IMPORTER"]) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_OFF_IMPORTER"]) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_OGRE_IMPORTER"]) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_OPENGEX_IMPORTER"]) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_PLY_IMPORTER"]) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_Q3BSP_IMPORTER"]) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_Q3D_IMPORTER"]) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_RAW_IMPORTER"]) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_SIB_IMPORTER"]) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_SMD_IMPORTER"]) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_STEP_IMPORTER"]) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_STL_IMPORTER"]) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_TERRAGEN_IMPORTER"]) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_X3D_IMPORTER"]) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_XGL_IMPORTER"]) + env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_X_IMPORTER"]) + + if env["platform"] == "windows": + env_assimp.Append(CPPDEFINES=["PLATFORM_WINDOWS"]) + env_assimp.Append(CPPDEFINES=[("PLATFORM", "WINDOWS")]) + elif env["platform"] == "linuxbsd": + env_assimp.Append(CPPDEFINES=["PLATFORM_LINUX"]) + env_assimp.Append(CPPDEFINES=[("PLATFORM", "LINUX")]) + elif env["platform"] == "osx": + env_assimp.Append(CPPDEFINES=["PLATFORM_DARWIN"]) + env_assimp.Append(CPPDEFINES=[("PLATFORM", "DARWIN")]) - if(env['platform'] == 'windows'): - env_assimp.Append(CPPDEFINES=['PLATFORM_WINDOWS']) - env_assimp.Append(CPPDEFINES=[('PLATFORM', 'WINDOWS')]) - elif(env['platform'] == 'linuxbsd'): - env_assimp.Append(CPPDEFINES=['PLATFORM_LINUX']) - env_assimp.Append(CPPDEFINES=[('PLATFORM', 'LINUX')]) - elif(env['platform'] == 'osx'): - env_assimp.Append(CPPDEFINES=['PLATFORM_DARWIN']) - env_assimp.Append(CPPDEFINES=[('PLATFORM', 'DARWIN')]) - env_thirdparty = env_assimp.Clone() env_thirdparty.disable_warnings() - env_thirdparty.add_source_files(env.modules_sources, Glob('#thirdparty/assimp/code/CApi/*.cpp')) - env_thirdparty.add_source_files(env.modules_sources, Glob('#thirdparty/assimp/code/Common/*.cpp')) - env_thirdparty.add_source_files(env.modules_sources, Glob('#thirdparty/assimp/code/PostProcessing/*.cpp')) - env_thirdparty.add_source_files(env.modules_sources, Glob('#thirdparty/assimp/code/Material/*.cpp')) - env_thirdparty.add_source_files(env.modules_sources, Glob('#thirdparty/assimp/code/FBX/*.cpp')) + env_thirdparty.add_source_files(env.modules_sources, Glob("#thirdparty/assimp/code/CApi/*.cpp")) + env_thirdparty.add_source_files(env.modules_sources, Glob("#thirdparty/assimp/code/Common/*.cpp")) + env_thirdparty.add_source_files(env.modules_sources, Glob("#thirdparty/assimp/code/PostProcessing/*.cpp")) + env_thirdparty.add_source_files(env.modules_sources, Glob("#thirdparty/assimp/code/Material/*.cpp")) + env_thirdparty.add_source_files(env.modules_sources, Glob("#thirdparty/assimp/code/FBX/*.cpp")) # Godot's own source files env_assimp.add_source_files(env.modules_sources, "*.cpp") diff --git a/modules/assimp/config.py b/modules/assimp/config.py index 098f1eafa9..53b8f2f2e3 100644 --- a/modules/assimp/config.py +++ b/modules/assimp/config.py @@ -1,5 +1,6 @@ def can_build(env, platform): - return env['tools'] + return env["tools"] + def configure(env): pass diff --git a/modules/basis_universal/SCsub b/modules/basis_universal/SCsub index 63324e920b..dc7b176d24 100644 --- a/modules/basis_universal/SCsub +++ b/modules/basis_universal/SCsub @@ -1,7 +1,7 @@ #!/usr/bin/env python -Import('env') -Import('env_modules') +Import("env") +Import("env_modules") env_basisu = env_modules.Clone() @@ -9,36 +9,38 @@ env_basisu = env_modules.Clone() # Not unbundled so far since not widespread as shared library thirdparty_dir = "#thirdparty/basis_universal/" tool_sources = [ - "basisu_astc_decomp.cpp", - "basisu_backend.cpp", - "basisu_basis_file.cpp", - "basisu_comp.cpp", - "basisu_enc.cpp", - "basisu_etc.cpp", - "basisu_frontend.cpp", - "basisu_global_selector_palette_helpers.cpp", - "basisu_gpu_texture.cpp", - "basisu_pvrtc1_4.cpp", - "basisu_resample_filters.cpp", - "basisu_resampler.cpp", - "basisu_ssim.cpp", - "lodepng.cpp", + "basisu_astc_decomp.cpp", + "basisu_backend.cpp", + "basisu_basis_file.cpp", + "basisu_comp.cpp", + "basisu_enc.cpp", + "basisu_etc.cpp", + "basisu_frontend.cpp", + "basisu_global_selector_palette_helpers.cpp", + "basisu_gpu_texture.cpp", + "basisu_pvrtc1_4.cpp", + "basisu_resample_filters.cpp", + "basisu_resampler.cpp", + "basisu_ssim.cpp", + "lodepng.cpp", ] tool_sources = [thirdparty_dir + file for file in tool_sources] transcoder_sources = [thirdparty_dir + "transcoder/basisu_transcoder.cpp"] # Treat Basis headers as system headers to avoid raising warnings. Not supported on MSVC. if not env.msvc: - env_basisu.Append(CPPFLAGS=['-isystem', Dir(thirdparty_dir).path, '-isystem', Dir(thirdparty_dir + "transcoder").path]) + env_basisu.Append( + CPPFLAGS=["-isystem", Dir(thirdparty_dir).path, "-isystem", Dir(thirdparty_dir + "transcoder").path] + ) else: env_basisu.Prepend(CPPPATH=[thirdparty_dir, thirdparty_dir + "transcoder"]) -if env['target'] == "debug": - env_basisu.Append(CPPFLAGS=["-DBASISU_DEVEL_MESSAGES=1", "-DBASISD_ENABLE_DEBUG_FLAGS=1"]) +if env["target"] == "debug": + env_basisu.Append(CPPFLAGS=["-DBASISU_DEVEL_MESSAGES=1", "-DBASISD_ENABLE_DEBUG_FLAGS=1"]) env_thirdparty = env_basisu.Clone() env_thirdparty.disable_warnings() -if env['tools']: +if env["tools"]: env_thirdparty.add_source_files(env.modules_sources, tool_sources) env_thirdparty.add_source_files(env.modules_sources, transcoder_sources) diff --git a/modules/basis_universal/config.py b/modules/basis_universal/config.py index 1c8cd12a2d..d22f9454ed 100644 --- a/modules/basis_universal/config.py +++ b/modules/basis_universal/config.py @@ -1,5 +1,6 @@ def can_build(env, platform): return True + def configure(env): pass diff --git a/modules/basis_universal/register_types.cpp b/modules/basis_universal/register_types.cpp index bf6bc1debd..5784341d80 100644 --- a/modules/basis_universal/register_types.cpp +++ b/modules/basis_universal/register_types.cpp @@ -98,7 +98,7 @@ static Vector<uint8_t> basis_universal_packer(const Ref<Image> &p_image, Image:: params.m_mip_gen = false; //sorry, please some day support provided mipmaps. params.m_source_images.push_back(buimg); - BasisDecompressFormat decompress_format; + BasisDecompressFormat decompress_format = BASIS_DECOMPRESS_RG; params.m_check_for_alpha = false; switch (p_channels) { @@ -158,8 +158,8 @@ static Ref<Image> basis_universal_unpacker(const Vector<uint8_t> &p_buffer) { const uint8_t *ptr = r; int size = p_buffer.size(); - basist::transcoder_texture_format format; - Image::Format imgfmt; + basist::transcoder_texture_format format = basist::transcoder_texture_format::cTFTotalTextureFormats; + Image::Format imgfmt = Image::FORMAT_MAX; switch (*(uint32_t *)(ptr)) { case BASIS_DECOMPRESS_RG: { diff --git a/modules/bmp/SCsub b/modules/bmp/SCsub index e7da7cf108..4f3405ff28 100644 --- a/modules/bmp/SCsub +++ b/modules/bmp/SCsub @@ -1,7 +1,7 @@ #!/usr/bin/env python -Import('env') -Import('env_modules') +Import("env") +Import("env_modules") env_bmp = env_modules.Clone() diff --git a/modules/bmp/config.py b/modules/bmp/config.py index 1c8cd12a2d..d22f9454ed 100644 --- a/modules/bmp/config.py +++ b/modules/bmp/config.py @@ -1,5 +1,6 @@ def can_build(env, platform): return True + def configure(env): pass diff --git a/modules/bullet/SCsub b/modules/bullet/SCsub index 02d0a31a69..692c749886 100644 --- a/modules/bullet/SCsub +++ b/modules/bullet/SCsub @@ -1,208 +1,203 @@ #!/usr/bin/env python -Import('env') -Import('env_modules') +Import("env") +Import("env_modules") env_bullet = env_modules.Clone() # Thirdparty source files -if env['builtin_bullet']: +if env["builtin_bullet"]: # Build only version 2 for now (as of 2.89) # Sync file list with relevant upstream CMakeLists.txt for each folder. thirdparty_dir = "#thirdparty/bullet/" bullet2_src = [ # BulletCollision - "BulletCollision/BroadphaseCollision/btAxisSweep3.cpp" - , "BulletCollision/BroadphaseCollision/btBroadphaseProxy.cpp" - , "BulletCollision/BroadphaseCollision/btCollisionAlgorithm.cpp" - , "BulletCollision/BroadphaseCollision/btDbvt.cpp" - , "BulletCollision/BroadphaseCollision/btDbvtBroadphase.cpp" - , "BulletCollision/BroadphaseCollision/btDispatcher.cpp" - , "BulletCollision/BroadphaseCollision/btOverlappingPairCache.cpp" - , "BulletCollision/BroadphaseCollision/btQuantizedBvh.cpp" - , "BulletCollision/BroadphaseCollision/btSimpleBroadphase.cpp" - , "BulletCollision/CollisionDispatch/btActivatingCollisionAlgorithm.cpp" - , "BulletCollision/CollisionDispatch/btBoxBoxCollisionAlgorithm.cpp" - , "BulletCollision/CollisionDispatch/btBox2dBox2dCollisionAlgorithm.cpp" - , "BulletCollision/CollisionDispatch/btBoxBoxDetector.cpp" - , "BulletCollision/CollisionDispatch/btCollisionDispatcher.cpp" - , "BulletCollision/CollisionDispatch/btCollisionDispatcherMt.cpp" - , "BulletCollision/CollisionDispatch/btCollisionObject.cpp" - , "BulletCollision/CollisionDispatch/btCollisionWorld.cpp" - , "BulletCollision/CollisionDispatch/btCollisionWorldImporter.cpp" - , "BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.cpp" - , "BulletCollision/CollisionDispatch/btCompoundCompoundCollisionAlgorithm.cpp" - , "BulletCollision/CollisionDispatch/btConvexConcaveCollisionAlgorithm.cpp" - , "BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.cpp" - , "BulletCollision/CollisionDispatch/btConvexPlaneCollisionAlgorithm.cpp" - , "BulletCollision/CollisionDispatch/btConvex2dConvex2dAlgorithm.cpp" - , "BulletCollision/CollisionDispatch/btDefaultCollisionConfiguration.cpp" - , "BulletCollision/CollisionDispatch/btEmptyCollisionAlgorithm.cpp" - , "BulletCollision/CollisionDispatch/btGhostObject.cpp" - , "BulletCollision/CollisionDispatch/btHashedSimplePairCache.cpp" - , "BulletCollision/CollisionDispatch/btInternalEdgeUtility.cpp" - , "BulletCollision/CollisionDispatch/btManifoldResult.cpp" - , "BulletCollision/CollisionDispatch/btSimulationIslandManager.cpp" - , "BulletCollision/CollisionDispatch/btSphereBoxCollisionAlgorithm.cpp" - , "BulletCollision/CollisionDispatch/btSphereSphereCollisionAlgorithm.cpp" - , "BulletCollision/CollisionDispatch/btSphereTriangleCollisionAlgorithm.cpp" - , "BulletCollision/CollisionDispatch/btUnionFind.cpp" - , "BulletCollision/CollisionDispatch/SphereTriangleDetector.cpp" - , "BulletCollision/CollisionShapes/btBoxShape.cpp" - , "BulletCollision/CollisionShapes/btBox2dShape.cpp" - , "BulletCollision/CollisionShapes/btBvhTriangleMeshShape.cpp" - , "BulletCollision/CollisionShapes/btCapsuleShape.cpp" - , "BulletCollision/CollisionShapes/btCollisionShape.cpp" - , "BulletCollision/CollisionShapes/btCompoundShape.cpp" - , "BulletCollision/CollisionShapes/btConcaveShape.cpp" - , "BulletCollision/CollisionShapes/btConeShape.cpp" - , "BulletCollision/CollisionShapes/btConvexHullShape.cpp" - , "BulletCollision/CollisionShapes/btConvexInternalShape.cpp" - , "BulletCollision/CollisionShapes/btConvexPointCloudShape.cpp" - , "BulletCollision/CollisionShapes/btConvexPolyhedron.cpp" - , "BulletCollision/CollisionShapes/btConvexShape.cpp" - , "BulletCollision/CollisionShapes/btConvex2dShape.cpp" - , "BulletCollision/CollisionShapes/btConvexTriangleMeshShape.cpp" - , "BulletCollision/CollisionShapes/btCylinderShape.cpp" - , "BulletCollision/CollisionShapes/btEmptyShape.cpp" - , "BulletCollision/CollisionShapes/btHeightfieldTerrainShape.cpp" - , "BulletCollision/CollisionShapes/btMiniSDF.cpp" - , "BulletCollision/CollisionShapes/btMinkowskiSumShape.cpp" - , "BulletCollision/CollisionShapes/btMultimaterialTriangleMeshShape.cpp" - , "BulletCollision/CollisionShapes/btMultiSphereShape.cpp" - , "BulletCollision/CollisionShapes/btOptimizedBvh.cpp" - , "BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp" - , "BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.cpp" - , "BulletCollision/CollisionShapes/btSdfCollisionShape.cpp" - , "BulletCollision/CollisionShapes/btShapeHull.cpp" - , "BulletCollision/CollisionShapes/btSphereShape.cpp" - , "BulletCollision/CollisionShapes/btStaticPlaneShape.cpp" - , "BulletCollision/CollisionShapes/btStridingMeshInterface.cpp" - , "BulletCollision/CollisionShapes/btTetrahedronShape.cpp" - , "BulletCollision/CollisionShapes/btTriangleBuffer.cpp" - , "BulletCollision/CollisionShapes/btTriangleCallback.cpp" - , "BulletCollision/CollisionShapes/btTriangleIndexVertexArray.cpp" - , "BulletCollision/CollisionShapes/btTriangleIndexVertexMaterialArray.cpp" - , "BulletCollision/CollisionShapes/btTriangleMesh.cpp" - , "BulletCollision/CollisionShapes/btTriangleMeshShape.cpp" - , "BulletCollision/CollisionShapes/btUniformScalingShape.cpp" - , "BulletCollision/Gimpact/btContactProcessing.cpp" - , "BulletCollision/Gimpact/btGenericPoolAllocator.cpp" - , "BulletCollision/Gimpact/btGImpactBvh.cpp" - , "BulletCollision/Gimpact/btGImpactCollisionAlgorithm.cpp" - , "BulletCollision/Gimpact/btGImpactQuantizedBvh.cpp" - , "BulletCollision/Gimpact/btGImpactShape.cpp" - , "BulletCollision/Gimpact/btTriangleShapeEx.cpp" - , "BulletCollision/Gimpact/gim_box_set.cpp" - , "BulletCollision/Gimpact/gim_contact.cpp" - , "BulletCollision/Gimpact/gim_memory.cpp" - , "BulletCollision/Gimpact/gim_tri_collision.cpp" - , "BulletCollision/NarrowPhaseCollision/btContinuousConvexCollision.cpp" - , "BulletCollision/NarrowPhaseCollision/btConvexCast.cpp" - , "BulletCollision/NarrowPhaseCollision/btGjkConvexCast.cpp" - , "BulletCollision/NarrowPhaseCollision/btGjkEpa2.cpp" - , "BulletCollision/NarrowPhaseCollision/btGjkEpaPenetrationDepthSolver.cpp" - , "BulletCollision/NarrowPhaseCollision/btGjkPairDetector.cpp" - , "BulletCollision/NarrowPhaseCollision/btMinkowskiPenetrationDepthSolver.cpp" - , "BulletCollision/NarrowPhaseCollision/btPersistentManifold.cpp" - , "BulletCollision/NarrowPhaseCollision/btRaycastCallback.cpp" - , "BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.cpp" - , "BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.cpp" - , "BulletCollision/NarrowPhaseCollision/btPolyhedralContactClipping.cpp" - + "BulletCollision/BroadphaseCollision/btAxisSweep3.cpp", + "BulletCollision/BroadphaseCollision/btBroadphaseProxy.cpp", + "BulletCollision/BroadphaseCollision/btCollisionAlgorithm.cpp", + "BulletCollision/BroadphaseCollision/btDbvt.cpp", + "BulletCollision/BroadphaseCollision/btDbvtBroadphase.cpp", + "BulletCollision/BroadphaseCollision/btDispatcher.cpp", + "BulletCollision/BroadphaseCollision/btOverlappingPairCache.cpp", + "BulletCollision/BroadphaseCollision/btQuantizedBvh.cpp", + "BulletCollision/BroadphaseCollision/btSimpleBroadphase.cpp", + "BulletCollision/CollisionDispatch/btActivatingCollisionAlgorithm.cpp", + "BulletCollision/CollisionDispatch/btBoxBoxCollisionAlgorithm.cpp", + "BulletCollision/CollisionDispatch/btBox2dBox2dCollisionAlgorithm.cpp", + "BulletCollision/CollisionDispatch/btBoxBoxDetector.cpp", + "BulletCollision/CollisionDispatch/btCollisionDispatcher.cpp", + "BulletCollision/CollisionDispatch/btCollisionDispatcherMt.cpp", + "BulletCollision/CollisionDispatch/btCollisionObject.cpp", + "BulletCollision/CollisionDispatch/btCollisionWorld.cpp", + "BulletCollision/CollisionDispatch/btCollisionWorldImporter.cpp", + "BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.cpp", + "BulletCollision/CollisionDispatch/btCompoundCompoundCollisionAlgorithm.cpp", + "BulletCollision/CollisionDispatch/btConvexConcaveCollisionAlgorithm.cpp", + "BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.cpp", + "BulletCollision/CollisionDispatch/btConvexPlaneCollisionAlgorithm.cpp", + "BulletCollision/CollisionDispatch/btConvex2dConvex2dAlgorithm.cpp", + "BulletCollision/CollisionDispatch/btDefaultCollisionConfiguration.cpp", + "BulletCollision/CollisionDispatch/btEmptyCollisionAlgorithm.cpp", + "BulletCollision/CollisionDispatch/btGhostObject.cpp", + "BulletCollision/CollisionDispatch/btHashedSimplePairCache.cpp", + "BulletCollision/CollisionDispatch/btInternalEdgeUtility.cpp", + "BulletCollision/CollisionDispatch/btManifoldResult.cpp", + "BulletCollision/CollisionDispatch/btSimulationIslandManager.cpp", + "BulletCollision/CollisionDispatch/btSphereBoxCollisionAlgorithm.cpp", + "BulletCollision/CollisionDispatch/btSphereSphereCollisionAlgorithm.cpp", + "BulletCollision/CollisionDispatch/btSphereTriangleCollisionAlgorithm.cpp", + "BulletCollision/CollisionDispatch/btUnionFind.cpp", + "BulletCollision/CollisionDispatch/SphereTriangleDetector.cpp", + "BulletCollision/CollisionShapes/btBoxShape.cpp", + "BulletCollision/CollisionShapes/btBox2dShape.cpp", + "BulletCollision/CollisionShapes/btBvhTriangleMeshShape.cpp", + "BulletCollision/CollisionShapes/btCapsuleShape.cpp", + "BulletCollision/CollisionShapes/btCollisionShape.cpp", + "BulletCollision/CollisionShapes/btCompoundShape.cpp", + "BulletCollision/CollisionShapes/btConcaveShape.cpp", + "BulletCollision/CollisionShapes/btConeShape.cpp", + "BulletCollision/CollisionShapes/btConvexHullShape.cpp", + "BulletCollision/CollisionShapes/btConvexInternalShape.cpp", + "BulletCollision/CollisionShapes/btConvexPointCloudShape.cpp", + "BulletCollision/CollisionShapes/btConvexPolyhedron.cpp", + "BulletCollision/CollisionShapes/btConvexShape.cpp", + "BulletCollision/CollisionShapes/btConvex2dShape.cpp", + "BulletCollision/CollisionShapes/btConvexTriangleMeshShape.cpp", + "BulletCollision/CollisionShapes/btCylinderShape.cpp", + "BulletCollision/CollisionShapes/btEmptyShape.cpp", + "BulletCollision/CollisionShapes/btHeightfieldTerrainShape.cpp", + "BulletCollision/CollisionShapes/btMiniSDF.cpp", + "BulletCollision/CollisionShapes/btMinkowskiSumShape.cpp", + "BulletCollision/CollisionShapes/btMultimaterialTriangleMeshShape.cpp", + "BulletCollision/CollisionShapes/btMultiSphereShape.cpp", + "BulletCollision/CollisionShapes/btOptimizedBvh.cpp", + "BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp", + "BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.cpp", + "BulletCollision/CollisionShapes/btSdfCollisionShape.cpp", + "BulletCollision/CollisionShapes/btShapeHull.cpp", + "BulletCollision/CollisionShapes/btSphereShape.cpp", + "BulletCollision/CollisionShapes/btStaticPlaneShape.cpp", + "BulletCollision/CollisionShapes/btStridingMeshInterface.cpp", + "BulletCollision/CollisionShapes/btTetrahedronShape.cpp", + "BulletCollision/CollisionShapes/btTriangleBuffer.cpp", + "BulletCollision/CollisionShapes/btTriangleCallback.cpp", + "BulletCollision/CollisionShapes/btTriangleIndexVertexArray.cpp", + "BulletCollision/CollisionShapes/btTriangleIndexVertexMaterialArray.cpp", + "BulletCollision/CollisionShapes/btTriangleMesh.cpp", + "BulletCollision/CollisionShapes/btTriangleMeshShape.cpp", + "BulletCollision/CollisionShapes/btUniformScalingShape.cpp", + "BulletCollision/Gimpact/btContactProcessing.cpp", + "BulletCollision/Gimpact/btGenericPoolAllocator.cpp", + "BulletCollision/Gimpact/btGImpactBvh.cpp", + "BulletCollision/Gimpact/btGImpactCollisionAlgorithm.cpp", + "BulletCollision/Gimpact/btGImpactQuantizedBvh.cpp", + "BulletCollision/Gimpact/btGImpactShape.cpp", + "BulletCollision/Gimpact/btTriangleShapeEx.cpp", + "BulletCollision/Gimpact/gim_box_set.cpp", + "BulletCollision/Gimpact/gim_contact.cpp", + "BulletCollision/Gimpact/gim_memory.cpp", + "BulletCollision/Gimpact/gim_tri_collision.cpp", + "BulletCollision/NarrowPhaseCollision/btContinuousConvexCollision.cpp", + "BulletCollision/NarrowPhaseCollision/btConvexCast.cpp", + "BulletCollision/NarrowPhaseCollision/btGjkConvexCast.cpp", + "BulletCollision/NarrowPhaseCollision/btGjkEpa2.cpp", + "BulletCollision/NarrowPhaseCollision/btGjkEpaPenetrationDepthSolver.cpp", + "BulletCollision/NarrowPhaseCollision/btGjkPairDetector.cpp", + "BulletCollision/NarrowPhaseCollision/btMinkowskiPenetrationDepthSolver.cpp", + "BulletCollision/NarrowPhaseCollision/btPersistentManifold.cpp", + "BulletCollision/NarrowPhaseCollision/btRaycastCallback.cpp", + "BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.cpp", + "BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.cpp", + "BulletCollision/NarrowPhaseCollision/btPolyhedralContactClipping.cpp", # BulletDynamics - , "BulletDynamics/Character/btKinematicCharacterController.cpp" - , "BulletDynamics/ConstraintSolver/btConeTwistConstraint.cpp" - , "BulletDynamics/ConstraintSolver/btContactConstraint.cpp" - , "BulletDynamics/ConstraintSolver/btFixedConstraint.cpp" - , "BulletDynamics/ConstraintSolver/btGearConstraint.cpp" - , "BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.cpp" - , "BulletDynamics/ConstraintSolver/btGeneric6DofSpringConstraint.cpp" - , "BulletDynamics/ConstraintSolver/btGeneric6DofSpring2Constraint.cpp" - , "BulletDynamics/ConstraintSolver/btHinge2Constraint.cpp" - , "BulletDynamics/ConstraintSolver/btHingeConstraint.cpp" - , "BulletDynamics/ConstraintSolver/btPoint2PointConstraint.cpp" - , "BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.cpp" - , "BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolverMt.cpp" - , "BulletDynamics/ConstraintSolver/btBatchedConstraints.cpp" - , "BulletDynamics/ConstraintSolver/btNNCGConstraintSolver.cpp" - , "BulletDynamics/ConstraintSolver/btSliderConstraint.cpp" - , "BulletDynamics/ConstraintSolver/btSolve2LinearConstraint.cpp" - , "BulletDynamics/ConstraintSolver/btTypedConstraint.cpp" - , "BulletDynamics/ConstraintSolver/btUniversalConstraint.cpp" - , "BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp" - , "BulletDynamics/Dynamics/btDiscreteDynamicsWorldMt.cpp" - , "BulletDynamics/Dynamics/btSimulationIslandManagerMt.cpp" - , "BulletDynamics/Dynamics/btRigidBody.cpp" - , "BulletDynamics/Dynamics/btSimpleDynamicsWorld.cpp" - #, "BulletDynamics/Dynamics/Bullet-C-API.cpp" - , "BulletDynamics/Vehicle/btRaycastVehicle.cpp" - , "BulletDynamics/Vehicle/btWheelInfo.cpp" - , "BulletDynamics/Featherstone/btMultiBody.cpp" - , "BulletDynamics/Featherstone/btMultiBodyConstraint.cpp" - , "BulletDynamics/Featherstone/btMultiBodyConstraintSolver.cpp" - , "BulletDynamics/Featherstone/btMultiBodyDynamicsWorld.cpp" - , "BulletDynamics/Featherstone/btMultiBodyFixedConstraint.cpp" - , "BulletDynamics/Featherstone/btMultiBodyGearConstraint.cpp" - , "BulletDynamics/Featherstone/btMultiBodyJointLimitConstraint.cpp" - , "BulletDynamics/Featherstone/btMultiBodyJointMotor.cpp" - , "BulletDynamics/Featherstone/btMultiBodyMLCPConstraintSolver.cpp" - , "BulletDynamics/Featherstone/btMultiBodyPoint2Point.cpp" - , "BulletDynamics/Featherstone/btMultiBodySliderConstraint.cpp" - , "BulletDynamics/Featherstone/btMultiBodySphericalJointMotor.cpp" - , "BulletDynamics/MLCPSolvers/btDantzigLCP.cpp" - , "BulletDynamics/MLCPSolvers/btMLCPSolver.cpp" - , "BulletDynamics/MLCPSolvers/btLemkeAlgorithm.cpp" - + "BulletDynamics/Character/btKinematicCharacterController.cpp", + "BulletDynamics/ConstraintSolver/btConeTwistConstraint.cpp", + "BulletDynamics/ConstraintSolver/btContactConstraint.cpp", + "BulletDynamics/ConstraintSolver/btFixedConstraint.cpp", + "BulletDynamics/ConstraintSolver/btGearConstraint.cpp", + "BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.cpp", + "BulletDynamics/ConstraintSolver/btGeneric6DofSpringConstraint.cpp", + "BulletDynamics/ConstraintSolver/btGeneric6DofSpring2Constraint.cpp", + "BulletDynamics/ConstraintSolver/btHinge2Constraint.cpp", + "BulletDynamics/ConstraintSolver/btHingeConstraint.cpp", + "BulletDynamics/ConstraintSolver/btPoint2PointConstraint.cpp", + "BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.cpp", + "BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolverMt.cpp", + "BulletDynamics/ConstraintSolver/btBatchedConstraints.cpp", + "BulletDynamics/ConstraintSolver/btNNCGConstraintSolver.cpp", + "BulletDynamics/ConstraintSolver/btSliderConstraint.cpp", + "BulletDynamics/ConstraintSolver/btSolve2LinearConstraint.cpp", + "BulletDynamics/ConstraintSolver/btTypedConstraint.cpp", + "BulletDynamics/ConstraintSolver/btUniversalConstraint.cpp", + "BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp", + "BulletDynamics/Dynamics/btDiscreteDynamicsWorldMt.cpp", + "BulletDynamics/Dynamics/btSimulationIslandManagerMt.cpp", + "BulletDynamics/Dynamics/btRigidBody.cpp", + "BulletDynamics/Dynamics/btSimpleDynamicsWorld.cpp", + # "BulletDynamics/Dynamics/Bullet-C-API.cpp", + "BulletDynamics/Vehicle/btRaycastVehicle.cpp", + "BulletDynamics/Vehicle/btWheelInfo.cpp", + "BulletDynamics/Featherstone/btMultiBody.cpp", + "BulletDynamics/Featherstone/btMultiBodyConstraint.cpp", + "BulletDynamics/Featherstone/btMultiBodyConstraintSolver.cpp", + "BulletDynamics/Featherstone/btMultiBodyDynamicsWorld.cpp", + "BulletDynamics/Featherstone/btMultiBodyFixedConstraint.cpp", + "BulletDynamics/Featherstone/btMultiBodyGearConstraint.cpp", + "BulletDynamics/Featherstone/btMultiBodyJointLimitConstraint.cpp", + "BulletDynamics/Featherstone/btMultiBodyJointMotor.cpp", + "BulletDynamics/Featherstone/btMultiBodyMLCPConstraintSolver.cpp", + "BulletDynamics/Featherstone/btMultiBodyPoint2Point.cpp", + "BulletDynamics/Featherstone/btMultiBodySliderConstraint.cpp", + "BulletDynamics/Featherstone/btMultiBodySphericalJointMotor.cpp", + "BulletDynamics/MLCPSolvers/btDantzigLCP.cpp", + "BulletDynamics/MLCPSolvers/btMLCPSolver.cpp", + "BulletDynamics/MLCPSolvers/btLemkeAlgorithm.cpp", # BulletInverseDynamics - , "BulletInverseDynamics/IDMath.cpp" - , "BulletInverseDynamics/MultiBodyTree.cpp" - , "BulletInverseDynamics/details/MultiBodyTreeInitCache.cpp" - , "BulletInverseDynamics/details/MultiBodyTreeImpl.cpp" - + "BulletInverseDynamics/IDMath.cpp", + "BulletInverseDynamics/MultiBodyTree.cpp", + "BulletInverseDynamics/details/MultiBodyTreeInitCache.cpp", + "BulletInverseDynamics/details/MultiBodyTreeImpl.cpp", # BulletSoftBody - , "BulletSoftBody/btSoftBody.cpp" - , "BulletSoftBody/btSoftBodyConcaveCollisionAlgorithm.cpp" - , "BulletSoftBody/btSoftBodyHelpers.cpp" - , "BulletSoftBody/btSoftBodyRigidBodyCollisionConfiguration.cpp" - , "BulletSoftBody/btSoftRigidCollisionAlgorithm.cpp" - , "BulletSoftBody/btSoftRigidDynamicsWorld.cpp" - , "BulletSoftBody/btSoftMultiBodyDynamicsWorld.cpp" - , "BulletSoftBody/btSoftSoftCollisionAlgorithm.cpp" - , "BulletSoftBody/btDefaultSoftBodySolver.cpp" - , "BulletSoftBody/btDeformableBackwardEulerObjective.cpp" - , "BulletSoftBody/btDeformableBodySolver.cpp" - , "BulletSoftBody/btDeformableMultiBodyConstraintSolver.cpp" - , "BulletSoftBody/btDeformableContactProjection.cpp" - , "BulletSoftBody/btDeformableMultiBodyDynamicsWorld.cpp" - , "BulletSoftBody/btDeformableContactConstraint.cpp" - + "BulletSoftBody/btSoftBody.cpp", + "BulletSoftBody/btSoftBodyConcaveCollisionAlgorithm.cpp", + "BulletSoftBody/btSoftBodyHelpers.cpp", + "BulletSoftBody/btSoftBodyRigidBodyCollisionConfiguration.cpp", + "BulletSoftBody/btSoftRigidCollisionAlgorithm.cpp", + "BulletSoftBody/btSoftRigidDynamicsWorld.cpp", + "BulletSoftBody/btSoftMultiBodyDynamicsWorld.cpp", + "BulletSoftBody/btSoftSoftCollisionAlgorithm.cpp", + "BulletSoftBody/btDefaultSoftBodySolver.cpp", + "BulletSoftBody/btDeformableBackwardEulerObjective.cpp", + "BulletSoftBody/btDeformableBodySolver.cpp", + "BulletSoftBody/btDeformableMultiBodyConstraintSolver.cpp", + "BulletSoftBody/btDeformableContactProjection.cpp", + "BulletSoftBody/btDeformableMultiBodyDynamicsWorld.cpp", + "BulletSoftBody/btDeformableContactConstraint.cpp", # clew - , "clew/clew.c" - + "clew/clew.c", # LinearMath - , "LinearMath/btAlignedAllocator.cpp" - , "LinearMath/btConvexHull.cpp" - , "LinearMath/btConvexHullComputer.cpp" - , "LinearMath/btGeometryUtil.cpp" - , "LinearMath/btPolarDecomposition.cpp" - , "LinearMath/btQuickprof.cpp" - , "LinearMath/btSerializer.cpp" - , "LinearMath/btSerializer64.cpp" - , "LinearMath/btThreads.cpp" - , "LinearMath/btVector3.cpp" - , "LinearMath/TaskScheduler/btTaskScheduler.cpp" - , "LinearMath/TaskScheduler/btThreadSupportPosix.cpp" - , "LinearMath/TaskScheduler/btThreadSupportWin32.cpp" + "LinearMath/btAlignedAllocator.cpp", + "LinearMath/btConvexHull.cpp", + "LinearMath/btConvexHullComputer.cpp", + "LinearMath/btGeometryUtil.cpp", + "LinearMath/btPolarDecomposition.cpp", + "LinearMath/btQuickprof.cpp", + "LinearMath/btSerializer.cpp", + "LinearMath/btSerializer64.cpp", + "LinearMath/btThreads.cpp", + "LinearMath/btVector3.cpp", + "LinearMath/TaskScheduler/btTaskScheduler.cpp", + "LinearMath/TaskScheduler/btThreadSupportPosix.cpp", + "LinearMath/TaskScheduler/btThreadSupportWin32.cpp", ] thirdparty_sources = [thirdparty_dir + file for file in bullet2_src] # Treat Bullet headers as system headers to avoid raising warnings. Not supported on MSVC. if not env.msvc: - env_bullet.Append(CPPFLAGS=['-isystem', Dir(thirdparty_dir).path]) + env_bullet.Append(CPPFLAGS=["-isystem", Dir(thirdparty_dir).path]) else: env_bullet.Prepend(CPPPATH=[thirdparty_dir]) # if env['target'] == "debug" or env['target'] == "release_debug": diff --git a/modules/bullet/bullet_physics_server.cpp b/modules/bullet/bullet_physics_server.cpp index 5b3fe1bfac..5f7860e797 100644 --- a/modules/bullet/bullet_physics_server.cpp +++ b/modules/bullet/bullet_physics_server.cpp @@ -862,7 +862,7 @@ bool BulletPhysicsServer3D::body_is_ray_pickable(RID p_body) const { PhysicsDirectBodyState3D *BulletPhysicsServer3D::body_get_direct_state(RID p_body) { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND_V(!body, NULL); - return BulletPhysicsDirectBodyState::get_singleton(body); + return BulletPhysicsDirectBodyState3D::get_singleton(body); } bool BulletPhysicsServer3D::body_test_motion(RID p_body, const Transform &p_from, const Vector3 &p_motion, bool p_infinite_inertia, MotionResult *r_result, bool p_exclude_raycast_shapes) { @@ -1553,14 +1553,14 @@ void BulletPhysicsServer3D::free(RID p_rid) { } void BulletPhysicsServer3D::init() { - BulletPhysicsDirectBodyState::initSingleton(); + BulletPhysicsDirectBodyState3D::initSingleton(); } void BulletPhysicsServer3D::step(float p_deltaTime) { if (!active) return; - BulletPhysicsDirectBodyState::singleton_setDeltaTime(p_deltaTime); + BulletPhysicsDirectBodyState3D::singleton_setDeltaTime(p_deltaTime); for (int i = 0; i < active_spaces_count; ++i) { @@ -1575,7 +1575,7 @@ void BulletPhysicsServer3D::flush_queries() { } void BulletPhysicsServer3D::finish() { - BulletPhysicsDirectBodyState::destroySingleton(); + BulletPhysicsDirectBodyState3D::destroySingleton(); } int BulletPhysicsServer3D::get_process_info(ProcessInfo p_info) { diff --git a/modules/bullet/config.py b/modules/bullet/config.py index 92dbcf5cb0..e8ca273f61 100644 --- a/modules/bullet/config.py +++ b/modules/bullet/config.py @@ -1,14 +1,17 @@ def can_build(env, platform): return True + def configure(env): pass + def get_doc_classes(): return [ - "BulletPhysicsDirectBodyState", - "BulletPhysicsServer", + "BulletPhysicsDirectBodyState3D", + "BulletPhysicsServer3D", ] + def get_doc_path(): return "doc_classes" diff --git a/modules/bullet/doc_classes/BulletPhysicsDirectBodyState.xml b/modules/bullet/doc_classes/BulletPhysicsDirectBodyState3D.xml index 5ea1b810a1..1c0181bd9c 100644 --- a/modules/bullet/doc_classes/BulletPhysicsDirectBodyState.xml +++ b/modules/bullet/doc_classes/BulletPhysicsDirectBodyState3D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="BulletPhysicsDirectBodyState" inherits="PhysicsDirectBodyState" version="4.0"> +<class name="BulletPhysicsDirectBodyState3D" inherits="PhysicsDirectBodyState3D" version="4.0"> <brief_description> </brief_description> <description> diff --git a/modules/bullet/doc_classes/BulletPhysicsServer.xml b/modules/bullet/doc_classes/BulletPhysicsServer3D.xml index af8fb3c02c..b20595b4f6 100644 --- a/modules/bullet/doc_classes/BulletPhysicsServer.xml +++ b/modules/bullet/doc_classes/BulletPhysicsServer3D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="BulletPhysicsServer" inherits="PhysicsServer" version="4.0"> +<class name="BulletPhysicsServer3D" inherits="PhysicsServer3D" version="4.0"> <brief_description> </brief_description> <description> diff --git a/modules/bullet/hinge_joint_bullet.cpp b/modules/bullet/hinge_joint_bullet.cpp index eaac1d650d..4bea9f87c0 100644 --- a/modules/bullet/hinge_joint_bullet.cpp +++ b/modules/bullet/hinge_joint_bullet.cpp @@ -96,7 +96,7 @@ real_t HingeJointBullet::get_hinge_angle() { void HingeJointBullet::set_param(PhysicsServer3D::HingeJointParam p_param, real_t p_value) { switch (p_param) { case PhysicsServer3D::HINGE_JOINT_BIAS: - WARN_DEPRECATED_MSG("The HingeJoint parameter \"bias\" is deprecated."); + WARN_DEPRECATED_MSG("The HingeJoint3D parameter \"bias\" is deprecated."); break; case PhysicsServer3D::HINGE_JOINT_LIMIT_UPPER: hingeConstraint->setLimit(hingeConstraint->getLowerLimit(), p_value, hingeConstraint->getLimitSoftness(), hingeConstraint->getLimitBiasFactor(), hingeConstraint->getLimitRelaxationFactor()); @@ -128,7 +128,7 @@ void HingeJointBullet::set_param(PhysicsServer3D::HingeJointParam p_param, real_ real_t HingeJointBullet::get_param(PhysicsServer3D::HingeJointParam p_param) const { switch (p_param) { case PhysicsServer3D::HINGE_JOINT_BIAS: - WARN_DEPRECATED_MSG("The HingeJoint parameter \"bias\" is deprecated."); + WARN_DEPRECATED_MSG("The HingeJoint3D parameter \"bias\" is deprecated."); return 0; case PhysicsServer3D::HINGE_JOINT_LIMIT_UPPER: return hingeConstraint->getUpperLimit(); diff --git a/modules/bullet/rigid_body_bullet.cpp b/modules/bullet/rigid_body_bullet.cpp index b92166e653..6f799843de 100644 --- a/modules/bullet/rigid_body_bullet.cpp +++ b/modules/bullet/rigid_body_bullet.cpp @@ -48,141 +48,141 @@ @author AndreaCatania */ -BulletPhysicsDirectBodyState *BulletPhysicsDirectBodyState::singleton = NULL; +BulletPhysicsDirectBodyState3D *BulletPhysicsDirectBodyState3D::singleton = NULL; -Vector3 BulletPhysicsDirectBodyState::get_total_gravity() const { +Vector3 BulletPhysicsDirectBodyState3D::get_total_gravity() const { Vector3 gVec; B_TO_G(body->btBody->getGravity(), gVec); return gVec; } -float BulletPhysicsDirectBodyState::get_total_angular_damp() const { +float BulletPhysicsDirectBodyState3D::get_total_angular_damp() const { return body->btBody->getAngularDamping(); } -float BulletPhysicsDirectBodyState::get_total_linear_damp() const { +float BulletPhysicsDirectBodyState3D::get_total_linear_damp() const { return body->btBody->getLinearDamping(); } -Vector3 BulletPhysicsDirectBodyState::get_center_of_mass() const { +Vector3 BulletPhysicsDirectBodyState3D::get_center_of_mass() const { Vector3 gVec; B_TO_G(body->btBody->getCenterOfMassPosition(), gVec); return gVec; } -Basis BulletPhysicsDirectBodyState::get_principal_inertia_axes() const { +Basis BulletPhysicsDirectBodyState3D::get_principal_inertia_axes() const { return Basis(); } -float BulletPhysicsDirectBodyState::get_inverse_mass() const { +float BulletPhysicsDirectBodyState3D::get_inverse_mass() const { return body->btBody->getInvMass(); } -Vector3 BulletPhysicsDirectBodyState::get_inverse_inertia() const { +Vector3 BulletPhysicsDirectBodyState3D::get_inverse_inertia() const { Vector3 gVec; B_TO_G(body->btBody->getInvInertiaDiagLocal(), gVec); return gVec; } -Basis BulletPhysicsDirectBodyState::get_inverse_inertia_tensor() const { +Basis BulletPhysicsDirectBodyState3D::get_inverse_inertia_tensor() const { Basis gInertia; B_TO_G(body->btBody->getInvInertiaTensorWorld(), gInertia); return gInertia; } -void BulletPhysicsDirectBodyState::set_linear_velocity(const Vector3 &p_velocity) { +void BulletPhysicsDirectBodyState3D::set_linear_velocity(const Vector3 &p_velocity) { body->set_linear_velocity(p_velocity); } -Vector3 BulletPhysicsDirectBodyState::get_linear_velocity() const { +Vector3 BulletPhysicsDirectBodyState3D::get_linear_velocity() const { return body->get_linear_velocity(); } -void BulletPhysicsDirectBodyState::set_angular_velocity(const Vector3 &p_velocity) { +void BulletPhysicsDirectBodyState3D::set_angular_velocity(const Vector3 &p_velocity) { body->set_angular_velocity(p_velocity); } -Vector3 BulletPhysicsDirectBodyState::get_angular_velocity() const { +Vector3 BulletPhysicsDirectBodyState3D::get_angular_velocity() const { return body->get_angular_velocity(); } -void BulletPhysicsDirectBodyState::set_transform(const Transform &p_transform) { +void BulletPhysicsDirectBodyState3D::set_transform(const Transform &p_transform) { body->set_transform(p_transform); } -Transform BulletPhysicsDirectBodyState::get_transform() const { +Transform BulletPhysicsDirectBodyState3D::get_transform() const { return body->get_transform(); } -void BulletPhysicsDirectBodyState::add_central_force(const Vector3 &p_force) { +void BulletPhysicsDirectBodyState3D::add_central_force(const Vector3 &p_force) { body->apply_central_force(p_force); } -void BulletPhysicsDirectBodyState::add_force(const Vector3 &p_force, const Vector3 &p_pos) { +void BulletPhysicsDirectBodyState3D::add_force(const Vector3 &p_force, const Vector3 &p_pos) { body->apply_force(p_force, p_pos); } -void BulletPhysicsDirectBodyState::add_torque(const Vector3 &p_torque) { +void BulletPhysicsDirectBodyState3D::add_torque(const Vector3 &p_torque) { body->apply_torque(p_torque); } -void BulletPhysicsDirectBodyState::apply_central_impulse(const Vector3 &p_impulse) { +void BulletPhysicsDirectBodyState3D::apply_central_impulse(const Vector3 &p_impulse) { body->apply_central_impulse(p_impulse); } -void BulletPhysicsDirectBodyState::apply_impulse(const Vector3 &p_pos, const Vector3 &p_impulse) { +void BulletPhysicsDirectBodyState3D::apply_impulse(const Vector3 &p_pos, const Vector3 &p_impulse) { body->apply_impulse(p_pos, p_impulse); } -void BulletPhysicsDirectBodyState::apply_torque_impulse(const Vector3 &p_impulse) { +void BulletPhysicsDirectBodyState3D::apply_torque_impulse(const Vector3 &p_impulse) { body->apply_torque_impulse(p_impulse); } -void BulletPhysicsDirectBodyState::set_sleep_state(bool p_enable) { +void BulletPhysicsDirectBodyState3D::set_sleep_state(bool p_enable) { body->set_activation_state(p_enable); } -bool BulletPhysicsDirectBodyState::is_sleeping() const { +bool BulletPhysicsDirectBodyState3D::is_sleeping() const { return !body->is_active(); } -int BulletPhysicsDirectBodyState::get_contact_count() const { +int BulletPhysicsDirectBodyState3D::get_contact_count() const { return body->collisionsCount; } -Vector3 BulletPhysicsDirectBodyState::get_contact_local_position(int p_contact_idx) const { +Vector3 BulletPhysicsDirectBodyState3D::get_contact_local_position(int p_contact_idx) const { return body->collisions[p_contact_idx].hitLocalLocation; } -Vector3 BulletPhysicsDirectBodyState::get_contact_local_normal(int p_contact_idx) const { +Vector3 BulletPhysicsDirectBodyState3D::get_contact_local_normal(int p_contact_idx) const { return body->collisions[p_contact_idx].hitNormal; } -float BulletPhysicsDirectBodyState::get_contact_impulse(int p_contact_idx) const { +float BulletPhysicsDirectBodyState3D::get_contact_impulse(int p_contact_idx) const { return body->collisions[p_contact_idx].appliedImpulse; } -int BulletPhysicsDirectBodyState::get_contact_local_shape(int p_contact_idx) const { +int BulletPhysicsDirectBodyState3D::get_contact_local_shape(int p_contact_idx) const { return body->collisions[p_contact_idx].local_shape; } -RID BulletPhysicsDirectBodyState::get_contact_collider(int p_contact_idx) const { +RID BulletPhysicsDirectBodyState3D::get_contact_collider(int p_contact_idx) const { return body->collisions[p_contact_idx].otherObject->get_self(); } -Vector3 BulletPhysicsDirectBodyState::get_contact_collider_position(int p_contact_idx) const { +Vector3 BulletPhysicsDirectBodyState3D::get_contact_collider_position(int p_contact_idx) const { return body->collisions[p_contact_idx].hitWorldLocation; } -ObjectID BulletPhysicsDirectBodyState::get_contact_collider_id(int p_contact_idx) const { +ObjectID BulletPhysicsDirectBodyState3D::get_contact_collider_id(int p_contact_idx) const { return body->collisions[p_contact_idx].otherObject->get_instance_id(); } -int BulletPhysicsDirectBodyState::get_contact_collider_shape(int p_contact_idx) const { +int BulletPhysicsDirectBodyState3D::get_contact_collider_shape(int p_contact_idx) const { return body->collisions[p_contact_idx].other_object_shape; } -Vector3 BulletPhysicsDirectBodyState::get_contact_collider_velocity_at_position(int p_contact_idx) const { +Vector3 BulletPhysicsDirectBodyState3D::get_contact_collider_velocity_at_position(int p_contact_idx) const { RigidBodyBullet::CollisionData &colDat = body->collisions.write[p_contact_idx]; btVector3 hitLocation; @@ -194,7 +194,7 @@ Vector3 BulletPhysicsDirectBodyState::get_contact_collider_velocity_at_position( return velocityAtPoint; } -PhysicsDirectSpaceState3D *BulletPhysicsDirectBodyState::get_space_state() { +PhysicsDirectSpaceState3D *BulletPhysicsDirectBodyState3D::get_space_state() { return body->get_space()->get_direct_state(); } @@ -359,7 +359,7 @@ void RigidBodyBullet::dispatch_callbacks() { if (omit_forces_integration) btBody->clearForces(); - BulletPhysicsDirectBodyState *bodyDirect = BulletPhysicsDirectBodyState::get_singleton(this); + BulletPhysicsDirectBodyState3D *bodyDirect = BulletPhysicsDirectBodyState3D::get_singleton(this); Variant variantBodyDirect = bodyDirect; diff --git a/modules/bullet/rigid_body_bullet.h b/modules/bullet/rigid_body_bullet.h index bce3511282..b73e132103 100644 --- a/modules/bullet/rigid_body_bullet.h +++ b/modules/bullet/rigid_body_bullet.h @@ -45,7 +45,7 @@ class AreaBullet; class SpaceBullet; class btRigidBody; class GodotMotionState; -class BulletPhysicsDirectBodyState; +class BulletPhysicsDirectBodyState3D; /// This class could be used in multi thread with few changes but currently /// is set to be only in one single thread. @@ -53,16 +53,16 @@ class BulletPhysicsDirectBodyState; /// In the system there is only one object at a time that manage all bodies and is /// created by BulletPhysicsServer3D and is held by the "singleton" variable of this class /// Each time something require it, the body must be set again. -class BulletPhysicsDirectBodyState : public PhysicsDirectBodyState3D { - GDCLASS(BulletPhysicsDirectBodyState, PhysicsDirectBodyState3D); +class BulletPhysicsDirectBodyState3D : public PhysicsDirectBodyState3D { + GDCLASS(BulletPhysicsDirectBodyState3D, PhysicsDirectBodyState3D); - static BulletPhysicsDirectBodyState *singleton; + static BulletPhysicsDirectBodyState3D *singleton; public: /// This class avoid the creation of more object of this class static void initSingleton() { if (!singleton) { - singleton = memnew(BulletPhysicsDirectBodyState); + singleton = memnew(BulletPhysicsDirectBodyState3D); } } @@ -75,7 +75,7 @@ public: singleton->deltaTime = p_deltaTime; } - static BulletPhysicsDirectBodyState *get_singleton(RigidBodyBullet *p_body) { + static BulletPhysicsDirectBodyState3D *get_singleton(RigidBodyBullet *p_body) { singleton->body = p_body; return singleton; } @@ -85,7 +85,7 @@ public: real_t deltaTime; private: - BulletPhysicsDirectBodyState() {} + BulletPhysicsDirectBodyState3D() {} public: virtual Vector3 get_total_gravity() const; @@ -187,7 +187,7 @@ public: }; private: - friend class BulletPhysicsDirectBodyState; + friend class BulletPhysicsDirectBodyState3D; // This is required only for Kinematic movement KinematicUtilities *kinematic_utilities; diff --git a/modules/bullet/space_bullet.cpp b/modules/bullet/space_bullet.cpp index c40a1500f0..b1ff418748 100644 --- a/modules/bullet/space_bullet.cpp +++ b/modules/bullet/space_bullet.cpp @@ -885,8 +885,8 @@ void SpaceBullet::update_gravity() { #include "scene/3d/immediate_geometry.h" -static ImmediateGeometry *motionVec(NULL); -static ImmediateGeometry *normalLine(NULL); +static ImmediateGeometry3D *motionVec(NULL); +static ImmediateGeometry3D *normalLine(NULL); static Ref<StandardMaterial3D> red_mat; static Ref<StandardMaterial3D> blue_mat; #endif @@ -897,8 +897,8 @@ bool SpaceBullet::test_body_motion(RigidBodyBullet *p_body, const Transform &p_f /// Yes I know this is not good, but I've used it as fast debugging hack. /// I'm leaving it here just for speedup the other eventual debugs if (!normalLine) { - motionVec = memnew(ImmediateGeometry); - normalLine = memnew(ImmediateGeometry); + motionVec = memnew(ImmediateGeometry3D); + normalLine = memnew(ImmediateGeometry3D); SceneTree::get_singleton()->get_current_scene()->add_child(motionVec); SceneTree::get_singleton()->get_current_scene()->add_child(normalLine); diff --git a/modules/camera/SCsub b/modules/camera/SCsub index 23f031f06e..63c4e9fbab 100644 --- a/modules/camera/SCsub +++ b/modules/camera/SCsub @@ -1,7 +1,7 @@ #!/usr/bin/env python -Import('env') -Import('env_modules') +Import("env") +Import("env_modules") env_camera = env_modules.Clone() @@ -10,7 +10,7 @@ if env["platform"] == "iphone": modules_sources = [] env_camera.add_source_files(modules_sources, "register_types.cpp") env_camera.add_source_files(modules_sources, "camera_ios.mm") - mod_lib = env_modules.add_library('#bin/libgodot_camera_module' + env['LIBSUFFIX'], modules_sources) + mod_lib = env_modules.add_library("#bin/libgodot_camera_module" + env["LIBSUFFIX"], modules_sources) elif env["platform"] == "windows": env_camera.add_source_files(env.modules_sources, "register_types.cpp") @@ -19,4 +19,3 @@ elif env["platform"] == "windows": elif env["platform"] == "osx": env_camera.add_source_files(env.modules_sources, "register_types.cpp") env_camera.add_source_files(env.modules_sources, "camera_osx.mm") - diff --git a/modules/camera/config.py b/modules/camera/config.py index d308c04195..87d7542741 100644 --- a/modules/camera/config.py +++ b/modules/camera/config.py @@ -1,5 +1,6 @@ def can_build(env, platform): - return platform == 'iphone' or platform == 'osx' or platform == 'windows' + return platform == "iphone" or platform == "osx" or platform == "windows" + def configure(env): pass diff --git a/modules/csg/SCsub b/modules/csg/SCsub index 57c504efd8..641a42c187 100644 --- a/modules/csg/SCsub +++ b/modules/csg/SCsub @@ -1,7 +1,7 @@ #!/usr/bin/env python -Import('env') -Import('env_modules') +Import("env") +Import("env_modules") env_csg = env_modules.Clone() diff --git a/modules/csg/config.py b/modules/csg/config.py index 38ccc66d91..9106cbceca 100644 --- a/modules/csg/config.py +++ b/modules/csg/config.py @@ -1,21 +1,24 @@ def can_build(env, platform): return True + def configure(env): pass + def get_doc_classes(): return [ - "CSGBox", - "CSGCombiner", - "CSGCylinder", - "CSGMesh", - "CSGPolygon", - "CSGPrimitive", - "CSGShape", - "CSGSphere", - "CSGTorus", + "CSGBox3D", + "CSGCombiner3D", + "CSGCylinder3D", + "CSGMesh3D", + "CSGPolygon3D", + "CSGPrimitive3D", + "CSGShape3D", + "CSGSphere3D", + "CSGTorus3D", ] + def get_doc_path(): return "doc_classes" diff --git a/modules/csg/csg_shape.cpp b/modules/csg/csg_shape.cpp index 848b865efb..1ed48a573c 100644 --- a/modules/csg/csg_shape.cpp +++ b/modules/csg/csg_shape.cpp @@ -742,18 +742,14 @@ CSGBrush *CSGMesh3D::_build_brush() { Vector<Vector3> anormals = arrays[Mesh::ARRAY_NORMAL]; const Vector3 *nr = NULL; - bool nr_used = false; if (anormals.size()) { nr = anormals.ptr(); - nr_used = true; } Vector<Vector2> auvs = arrays[Mesh::ARRAY_TEX_UV]; const Vector2 *uvr = NULL; - bool uvr_used = false; if (auvs.size()) { uvr = auvs.ptr(); - uvr_used = true; } Ref<Material> mat; @@ -789,10 +785,10 @@ CSGBrush *CSGMesh3D::_build_brush() { for (int k = 0; k < 3; k++) { int idx = ir[j + k]; vertex[k] = vr[idx]; - if (nr_used) { + if (nr) { normal[k] = nr[idx]; } - if (uvr_used) { + if (uvr) { uv[k] = uvr[idx]; } } @@ -832,10 +828,10 @@ CSGBrush *CSGMesh3D::_build_brush() { for (int k = 0; k < 3; k++) { vertex[k] = vr[j + k]; - if (nr_used) { + if (nr) { normal[k] = nr[j + k]; } - if (uvr_used) { + if (uvr) { uv[k] = uvr[j + k]; } } diff --git a/modules/csg/doc_classes/CSGBox.xml b/modules/csg/doc_classes/CSGBox3D.xml index e2f0f8488a..492bf68c44 100644 --- a/modules/csg/doc_classes/CSGBox.xml +++ b/modules/csg/doc_classes/CSGBox3D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="CSGBox" inherits="CSGPrimitive" version="4.0"> +<class name="CSGBox3D" inherits="CSGPrimitive3D" version="4.0"> <brief_description> A CSG Box shape. </brief_description> diff --git a/modules/csg/doc_classes/CSGCombiner.xml b/modules/csg/doc_classes/CSGCombiner.xml deleted file mode 100644 index ab95d3c3ee..0000000000 --- a/modules/csg/doc_classes/CSGCombiner.xml +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<class name="CSGCombiner" inherits="CSGShape" version="4.0"> - <brief_description> - A CSG node that allows you to combine other CSG modifiers. - </brief_description> - <description> - For complex arrangements of shapes, it is sometimes needed to add structure to your CSG nodes. The CSGCombiner node allows you to create this structure. The node encapsulates the result of the CSG operations of its children. In this way, it is possible to do operations on one set of shapes that are children of one CSGCombiner node, and a set of separate operations on a second set of shapes that are children of a second CSGCombiner node, and then do an operation that takes the two end results as its input to create the final shape. - </description> - <tutorials> - </tutorials> - <methods> - </methods> - <constants> - </constants> -</class> diff --git a/modules/csg/doc_classes/CSGCombiner3D.xml b/modules/csg/doc_classes/CSGCombiner3D.xml new file mode 100644 index 0000000000..b55111eee4 --- /dev/null +++ b/modules/csg/doc_classes/CSGCombiner3D.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="CSGCombiner3D" inherits="CSGShape3D" version="4.0"> + <brief_description> + A CSG node that allows you to combine other CSG modifiers. + </brief_description> + <description> + For complex arrangements of shapes, it is sometimes needed to add structure to your CSG nodes. The CSGCombiner3D node allows you to create this structure. The node encapsulates the result of the CSG operations of its children. In this way, it is possible to do operations on one set of shapes that are children of one CSGCombiner3D node, and a set of separate operations on a second set of shapes that are children of a second CSGCombiner3D node, and then do an operation that takes the two end results as its input to create the final shape. + </description> + <tutorials> + </tutorials> + <methods> + </methods> + <constants> + </constants> +</class> diff --git a/modules/csg/doc_classes/CSGCylinder.xml b/modules/csg/doc_classes/CSGCylinder3D.xml index 2dd8c6a8d0..bfd2a5d5f2 100644 --- a/modules/csg/doc_classes/CSGCylinder.xml +++ b/modules/csg/doc_classes/CSGCylinder3D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="CSGCylinder" inherits="CSGPrimitive" version="4.0"> +<class name="CSGCylinder3D" inherits="CSGPrimitive3D" version="4.0"> <brief_description> A CSG Cylinder shape. </brief_description> diff --git a/modules/csg/doc_classes/CSGMesh.xml b/modules/csg/doc_classes/CSGMesh3D.xml index f1fe2c286b..1bab8f4ee9 100644 --- a/modules/csg/doc_classes/CSGMesh.xml +++ b/modules/csg/doc_classes/CSGMesh3D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="CSGMesh" inherits="CSGPrimitive" version="4.0"> +<class name="CSGMesh3D" inherits="CSGPrimitive3D" version="4.0"> <brief_description> A CSG Mesh shape that uses a mesh resource. </brief_description> diff --git a/modules/csg/doc_classes/CSGPolygon.xml b/modules/csg/doc_classes/CSGPolygon3D.xml index 02b2e8b03f..c55fa0983e 100644 --- a/modules/csg/doc_classes/CSGPolygon.xml +++ b/modules/csg/doc_classes/CSGPolygon3D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="CSGPolygon" inherits="CSGPrimitive" version="4.0"> +<class name="CSGPolygon3D" inherits="CSGPrimitive3D" version="4.0"> <brief_description> Extrudes a 2D polygon shape to create a 3D mesh. </brief_description> @@ -17,7 +17,7 @@ <member name="material" type="Material" setter="set_material" getter="get_material"> Material to use for the resulting mesh. </member> - <member name="mode" type="int" setter="set_mode" getter="get_mode" enum="CSGPolygon.Mode" default="0"> + <member name="mode" type="int" setter="set_mode" getter="get_mode" enum="CSGPolygon3D.Mode" default="0"> Extrusion mode. </member> <member name="path_continuous_u" type="bool" setter="set_path_continuous_u" getter="is_path_continuous_u"> @@ -30,12 +30,12 @@ If [code]true[/code] the start and end of our path are joined together ensuring there is no seam when [member mode] is [constant MODE_PATH]. </member> <member name="path_local" type="bool" setter="set_path_local" getter="is_path_local"> - If [code]false[/code] we extrude centered on our path, if [code]true[/code] we extrude in relation to the position of our CSGPolygon when [member mode] is [constant MODE_PATH]. + If [code]false[/code] we extrude centered on our path, if [code]true[/code] we extrude in relation to the position of our CSGPolygon3D when [member mode] is [constant MODE_PATH]. </member> <member name="path_node" type="NodePath" setter="set_path_node" getter="get_path_node"> - The [Shape] object containing the path along which we extrude when [member mode] is [constant MODE_PATH]. + The [Shape3D] object containing the path along which we extrude when [member mode] is [constant MODE_PATH]. </member> - <member name="path_rotation" type="int" setter="set_path_rotation" getter="get_path_rotation" enum="CSGPolygon.PathRotation"> + <member name="path_rotation" type="int" setter="set_path_rotation" getter="get_path_rotation" enum="CSGPolygon3D.PathRotation"> The method by which each slice is rotated along the path when [member mode] is [constant MODE_PATH]. </member> <member name="polygon" type="PackedVector2Array" setter="set_polygon" getter="get_polygon" default="PackedVector2Array( 0, 0, 0, 1, 1, 1, 1, 0 )"> @@ -53,13 +53,13 @@ </members> <constants> <constant name="MODE_DEPTH" value="0" enum="Mode"> - Shape is extruded to [member depth]. + Shape3D is extruded to [member depth]. </constant> <constant name="MODE_SPIN" value="1" enum="Mode"> - Shape is extruded by rotating it around an axis. + Shape3D is extruded by rotating it around an axis. </constant> <constant name="MODE_PATH" value="2" enum="Mode"> - Shape is extruded along a path set by a [Shape] set in [member path_node]. + Shape3D is extruded along a path set by a [Shape3D] set in [member path_node]. </constant> <constant name="PATH_ROTATION_POLYGON" value="0" enum="PathRotation"> Slice is not rotated. diff --git a/modules/csg/doc_classes/CSGPrimitive.xml b/modules/csg/doc_classes/CSGPrimitive3D.xml index ba395b7edd..31b7360fac 100644 --- a/modules/csg/doc_classes/CSGPrimitive.xml +++ b/modules/csg/doc_classes/CSGPrimitive3D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="CSGPrimitive" inherits="CSGShape" version="4.0"> +<class name="CSGPrimitive3D" inherits="CSGShape3D" version="4.0"> <brief_description> Base class for CSG primitives. </brief_description> diff --git a/modules/csg/doc_classes/CSGShape.xml b/modules/csg/doc_classes/CSGShape3D.xml index 64a2fb1840..43ce988c30 100644 --- a/modules/csg/doc_classes/CSGShape.xml +++ b/modules/csg/doc_classes/CSGShape3D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="CSGShape" inherits="GeometryInstance" version="4.0"> +<class name="CSGShape3D" inherits="GeometryInstance3D" version="4.0"> <brief_description> The CSG base class. </brief_description> @@ -76,7 +76,7 @@ <member name="collision_mask" type="int" setter="set_collision_mask" getter="get_collision_mask" default="1"> The physics layers this CSG shape scans for collisions. </member> - <member name="operation" type="int" setter="set_operation" getter="get_operation" enum="CSGShape.Operation" default="0"> + <member name="operation" type="int" setter="set_operation" getter="get_operation" enum="CSGShape3D.Operation" default="0"> The operation that is performed on this shape. This is ignored for the first CSG child node as the operation is between this node and the previous child of this nodes parent. </member> <member name="snap" type="float" setter="set_snap" getter="get_snap" default="0.001"> diff --git a/modules/csg/doc_classes/CSGSphere.xml b/modules/csg/doc_classes/CSGSphere3D.xml index 847cc63586..4d5b3be099 100644 --- a/modules/csg/doc_classes/CSGSphere.xml +++ b/modules/csg/doc_classes/CSGSphere3D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="CSGSphere" inherits="CSGPrimitive" version="4.0"> +<class name="CSGSphere3D" inherits="CSGPrimitive3D" version="4.0"> <brief_description> A CSG Sphere shape. </brief_description> diff --git a/modules/csg/doc_classes/CSGTorus.xml b/modules/csg/doc_classes/CSGTorus3D.xml index 84a08edaf5..abe3eab913 100644 --- a/modules/csg/doc_classes/CSGTorus.xml +++ b/modules/csg/doc_classes/CSGTorus3D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="CSGTorus" inherits="CSGPrimitive" version="4.0"> +<class name="CSGTorus3D" inherits="CSGPrimitive3D" version="4.0"> <brief_description> A CSG Torus shape. </brief_description> diff --git a/modules/csg/register_types.cpp b/modules/csg/register_types.cpp index 1a12a6706d..40eef84b1b 100644 --- a/modules/csg/register_types.cpp +++ b/modules/csg/register_types.cpp @@ -47,15 +47,6 @@ void register_csg_types() { ClassDB::register_class<CSGPolygon3D>(); ClassDB::register_class<CSGCombiner3D>(); - ClassDB::add_compatibility_class("CSGShape", "CSGShape3D"); - ClassDB::add_compatibility_class("CSGMesh", "CSGMesh3D"); - ClassDB::add_compatibility_class("CSGSphere", "CSGSphere3D"); - ClassDB::add_compatibility_class("CSGBox", "CSGBox3D"); - ClassDB::add_compatibility_class("CSGCylinder", "CSGCylinder3D"); - ClassDB::add_compatibility_class("CSGTorus", "CSGTorus3D"); - ClassDB::add_compatibility_class("CSGPolygon", "CSGPolygon3D"); - ClassDB::add_compatibility_class("CSGCombiner", "CSGCombiner3D"); - #ifdef TOOLS_ENABLED EditorPlugins::add_by_type<EditorPluginCSG>(); #endif diff --git a/modules/cvtt/SCsub b/modules/cvtt/SCsub index 746b23ca28..5438f7ebac 100644 --- a/modules/cvtt/SCsub +++ b/modules/cvtt/SCsub @@ -1,14 +1,14 @@ #!/usr/bin/env python -Import('env') -Import('env_modules') +Import("env") +Import("env_modules") env_cvtt = env_modules.Clone() # Thirdparty source files thirdparty_dir = "#thirdparty/cvtt/" thirdparty_sources = [ - "ConvectionKernels.cpp" + "ConvectionKernels.cpp", ] thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] diff --git a/modules/cvtt/config.py b/modules/cvtt/config.py index 098f1eafa9..53b8f2f2e3 100644 --- a/modules/cvtt/config.py +++ b/modules/cvtt/config.py @@ -1,5 +1,6 @@ def can_build(env, platform): - return env['tools'] + return env["tools"] + def configure(env): pass diff --git a/modules/dds/SCsub b/modules/dds/SCsub index 3d92ff02d6..06980bd670 100644 --- a/modules/dds/SCsub +++ b/modules/dds/SCsub @@ -1,7 +1,7 @@ #!/usr/bin/env python -Import('env') -Import('env_modules') +Import("env") +Import("env_modules") env_dds = env_modules.Clone() diff --git a/modules/dds/config.py b/modules/dds/config.py index 1c8cd12a2d..d22f9454ed 100644 --- a/modules/dds/config.py +++ b/modules/dds/config.py @@ -1,5 +1,6 @@ def can_build(env, platform): return True + def configure(env): pass diff --git a/modules/enet/SCsub b/modules/enet/SCsub index 485c33b1a8..c8f4b3885e 100644 --- a/modules/enet/SCsub +++ b/modules/enet/SCsub @@ -1,13 +1,13 @@ #!/usr/bin/env python -Import('env') -Import('env_modules') +Import("env") +Import("env_modules") env_enet = env_modules.Clone() # Thirdparty source files -if env['builtin_enet']: +if env["builtin_enet"]: thirdparty_dir = "#thirdparty/enet/" thirdparty_sources = [ "godot.cpp", diff --git a/modules/enet/config.py b/modules/enet/config.py index 3e30bbe778..5fd343c75d 100644 --- a/modules/enet/config.py +++ b/modules/enet/config.py @@ -1,13 +1,16 @@ def can_build(env, platform): return True + def configure(env): pass + def get_doc_classes(): return [ "NetworkedMultiplayerENet", ] + def get_doc_path(): return "doc_classes" diff --git a/modules/etc/SCsub b/modules/etc/SCsub index 1742d3534f..383bbf83c3 100644 --- a/modules/etc/SCsub +++ b/modules/etc/SCsub @@ -1,7 +1,7 @@ #!/usr/bin/env python -Import('env') -Import('env_modules') +Import("env") +Import("env_modules") env_etc = env_modules.Clone() @@ -9,21 +9,21 @@ env_etc = env_modules.Clone() # Not unbundled so far since not widespread as shared library thirdparty_dir = "#thirdparty/etc2comp/" thirdparty_sources = [ - "EtcBlock4x4.cpp", - "EtcBlock4x4Encoding.cpp", - "EtcBlock4x4Encoding_ETC1.cpp", - "EtcBlock4x4Encoding_R11.cpp", - "EtcBlock4x4Encoding_RG11.cpp", - "EtcBlock4x4Encoding_RGB8A1.cpp", - "EtcBlock4x4Encoding_RGB8.cpp", - "EtcBlock4x4Encoding_RGBA8.cpp", - "Etc.cpp", - "EtcDifferentialTrys.cpp", - "EtcFilter.cpp", - "EtcImage.cpp", - "EtcIndividualTrys.cpp", - "EtcMath.cpp", - "EtcSortedBlockList.cpp", + "EtcBlock4x4.cpp", + "EtcBlock4x4Encoding.cpp", + "EtcBlock4x4Encoding_ETC1.cpp", + "EtcBlock4x4Encoding_R11.cpp", + "EtcBlock4x4Encoding_RG11.cpp", + "EtcBlock4x4Encoding_RGB8A1.cpp", + "EtcBlock4x4Encoding_RGB8.cpp", + "EtcBlock4x4Encoding_RGBA8.cpp", + "Etc.cpp", + "EtcDifferentialTrys.cpp", + "EtcFilter.cpp", + "EtcImage.cpp", + "EtcIndividualTrys.cpp", + "EtcMath.cpp", + "EtcSortedBlockList.cpp", ] thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] diff --git a/modules/etc/config.py b/modules/etc/config.py index 098f1eafa9..53b8f2f2e3 100644 --- a/modules/etc/config.py +++ b/modules/etc/config.py @@ -1,5 +1,6 @@ def can_build(env, platform): - return env['tools'] + return env["tools"] + def configure(env): pass diff --git a/modules/freetype/SCsub b/modules/freetype/SCsub index 9e1853c4cd..bfc1658bb4 100644 --- a/modules/freetype/SCsub +++ b/modules/freetype/SCsub @@ -1,12 +1,12 @@ #!/usr/bin/env python -Import('env') -Import('env_modules') +Import("env") +Import("env_modules") env_freetype = env_modules.Clone() # Thirdparty source files -if env['builtin_freetype']: +if env["builtin_freetype"]: thirdparty_dir = "#thirdparty/freetype/" thirdparty_sources = [ "src/autofit/autofit.c", @@ -53,31 +53,31 @@ if env['builtin_freetype']: ] thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] - if env['platform'] == 'uwp': + if env["platform"] == "uwp": # Include header for UWP to fix build issues - env_freetype.Append(CCFLAGS=['/FI', '"modules/freetype/uwpdef.h"']) + env_freetype.Append(CCFLAGS=["/FI", '"modules/freetype/uwpdef.h"']) # Globally too, as freetype is used in scene (see bottom) - env.Append(CCFLAGS=['/FI', '"modules/freetype/uwpdef.h"']) + env.Append(CCFLAGS=["/FI", '"modules/freetype/uwpdef.h"']) env_freetype.Prepend(CPPPATH=[thirdparty_dir + "/include"]) # Also needed in main env for scene/ env.Prepend(CPPPATH=[thirdparty_dir + "/include"]) - env_freetype.Append(CPPDEFINES=['FT2_BUILD_LIBRARY', 'FT_CONFIG_OPTION_USE_PNG']) - if (env['target'] == 'debug'): - env_freetype.Append(CPPDEFINES=['ZLIB_DEBUG']) + env_freetype.Append(CPPDEFINES=["FT2_BUILD_LIBRARY", "FT_CONFIG_OPTION_USE_PNG"]) + if env["target"] == "debug": + env_freetype.Append(CPPDEFINES=["ZLIB_DEBUG"]) # Also requires libpng headers - if env['builtin_libpng']: + if env["builtin_libpng"]: env_freetype.Prepend(CPPPATH=["#thirdparty/libpng"]) - sfnt = thirdparty_dir + 'src/sfnt/sfnt.c' + sfnt = thirdparty_dir + "src/sfnt/sfnt.c" # Must be done after all CPPDEFINES are being set so we can copy them. - if env['platform'] == 'javascript': + if env["platform"] == "javascript": # Forcibly undefine this macro so SIMD is not used in this file, # since currently unsupported in WASM tmp_env = env_freetype.Clone() - tmp_env.Append(CPPFLAGS=['-U__OPTIMIZE__']) + tmp_env.Append(CPPFLAGS=["-U__OPTIMIZE__"]) sfnt = tmp_env.Object(sfnt) thirdparty_sources += [sfnt] @@ -91,7 +91,7 @@ if env['builtin_freetype']: # and then plain strings for system library. We insert between the two. inserted = False for idx, linklib in enumerate(env["LIBS"]): - if isinstance(linklib, (str, bytes)): # first system lib such as "X11", otherwise SCons lib object + if isinstance(linklib, (str, bytes)): # first system lib such as "X11", otherwise SCons lib object env["LIBS"].insert(idx, lib) inserted = True break diff --git a/modules/freetype/config.py b/modules/freetype/config.py index 1c8cd12a2d..d22f9454ed 100644 --- a/modules/freetype/config.py +++ b/modules/freetype/config.py @@ -1,5 +1,6 @@ def can_build(env, platform): return True + def configure(env): pass diff --git a/modules/gdnative/SCsub b/modules/gdnative/SCsub index a18c75fa27..a788175b07 100644 --- a/modules/gdnative/SCsub +++ b/modules/gdnative/SCsub @@ -1,7 +1,7 @@ #!/usr/bin/env python -Import('env') -Import('env_modules') +Import("env") +Import("env_modules") env_gdnative = env_modules.Clone() env_gdnative.add_source_files(env.modules_sources, "gdnative.cpp") @@ -12,9 +12,9 @@ env_gdnative.add_source_files(env.modules_sources, "nativescript/*.cpp") env_gdnative.add_source_files(env.modules_sources, "gdnative_library_singleton_editor.cpp") env_gdnative.add_source_files(env.modules_sources, "gdnative_library_editor_plugin.cpp") -env_gdnative.Prepend(CPPPATH=['#modules/gdnative/include/']) +env_gdnative.Prepend(CPPPATH=["#modules/gdnative/include/"]) -Export('env_gdnative') +Export("env_gdnative") SConscript("net/SCsub") SConscript("arvr/SCsub") @@ -25,8 +25,11 @@ SConscript("videodecoder/SCsub") from platform_methods import run_in_subprocess import gdnative_builders -_, gensource = env_gdnative.CommandNoCache(['include/gdnative_api_struct.gen.h', 'gdnative_api_struct.gen.cpp'], - 'gdnative_api.json', run_in_subprocess(gdnative_builders.build_gdnative_api_struct)) +_, gensource = env_gdnative.CommandNoCache( + ["include/gdnative_api_struct.gen.h", "gdnative_api_struct.gen.cpp"], + "gdnative_api.json", + run_in_subprocess(gdnative_builders.build_gdnative_api_struct), +) env_gdnative.add_source_files(env.modules_sources, [gensource]) env.use_ptrcall = True diff --git a/modules/gdnative/arvr/SCsub b/modules/gdnative/arvr/SCsub index 20eaa99592..0b2db3b504 100644 --- a/modules/gdnative/arvr/SCsub +++ b/modules/gdnative/arvr/SCsub @@ -1,6 +1,6 @@ #!/usr/bin/env python -Import('env') -Import('env_gdnative') +Import("env") +Import("env_gdnative") -env_gdnative.add_source_files(env.modules_sources, '*.cpp') +env_gdnative.add_source_files(env.modules_sources, "*.cpp") diff --git a/modules/gdnative/arvr/config.py b/modules/gdnative/arvr/config.py index 53bc827027..d22f9454ed 100644 --- a/modules/gdnative/arvr/config.py +++ b/modules/gdnative/arvr/config.py @@ -1,5 +1,6 @@ def can_build(env, platform): - return True + return True + def configure(env): - pass + pass diff --git a/modules/gdnative/config.py b/modules/gdnative/config.py index b9e5afcdf3..37e25a46d4 100644 --- a/modules/gdnative/config.py +++ b/modules/gdnative/config.py @@ -1,9 +1,11 @@ def can_build(env, platform): return True + def configure(env): env.use_ptrcall = True + def get_doc_classes(): return [ "@NativeScript", @@ -20,5 +22,6 @@ def get_doc_classes(): "WebRTCDataChannelGDNative", ] + def get_doc_path(): return "doc_classes" diff --git a/modules/gdnative/gdnative_builders.py b/modules/gdnative/gdnative_builders.py index 0d95a65b7e..d0094fb869 100644 --- a/modules/gdnative/gdnative_builders.py +++ b/modules/gdnative/gdnative_builders.py @@ -8,209 +8,249 @@ from platform_methods import subprocess_main def _spaced(e): - return e if e[-1] == '*' else e + ' ' + return e if e[-1] == "*" else e + " " def _build_gdnative_api_struct_header(api): out = [ - '/* THIS FILE IS GENERATED DO NOT EDIT */', - '#ifndef GODOT_GDNATIVE_API_STRUCT_H', - '#define GODOT_GDNATIVE_API_STRUCT_H', - '', - '#include <gdnative/gdnative.h>', - '#include <android/godot_android.h>', - '#include <arvr/godot_arvr.h>', - '#include <nativescript/godot_nativescript.h>', - '#include <net/godot_net.h>', - '#include <pluginscript/godot_pluginscript.h>', - '#include <videodecoder/godot_videodecoder.h>', - '', - '#ifdef __cplusplus', + "/* THIS FILE IS GENERATED DO NOT EDIT */", + "#ifndef GODOT_GDNATIVE_API_STRUCT_H", + "#define GODOT_GDNATIVE_API_STRUCT_H", + "", + "#include <gdnative/gdnative.h>", + "#include <android/godot_android.h>", + "#include <arvr/godot_arvr.h>", + "#include <nativescript/godot_nativescript.h>", + "#include <net/godot_net.h>", + "#include <pluginscript/godot_pluginscript.h>", + "#include <videodecoder/godot_videodecoder.h>", + "", + "#ifdef __cplusplus", 'extern "C" {', - '#endif', - '', - 'enum GDNATIVE_API_TYPES {', - '\tGDNATIVE_' + api['core']['type'] + ',' + "#endif", + "", + "enum GDNATIVE_API_TYPES {", + "\tGDNATIVE_" + api["core"]["type"] + ",", ] - for ext in api['extensions']: - out += ['\tGDNATIVE_EXT_' + ext['type'] + ','] + for ext in api["extensions"]: + out += ["\tGDNATIVE_EXT_" + ext["type"] + ","] - out += ['};', ''] + out += ["};", ""] def generate_extension_struct(name, ext, include_version=True): ret_val = [] - if ext['next']: - ret_val += generate_extension_struct(name, ext['next']) + if ext["next"]: + ret_val += generate_extension_struct(name, ext["next"]) ret_val += [ - 'typedef struct godot_gdnative_ext_' + name + ('' if not include_version else ('_{0}_{1}'.format(ext['version']['major'], ext['version']['minor']))) + '_api_struct {', - '\tunsigned int type;', - '\tgodot_gdnative_api_version version;', - '\tconst godot_gdnative_api_struct *next;' + "typedef struct godot_gdnative_ext_" + + name + + ("" if not include_version else ("_{0}_{1}".format(ext["version"]["major"], ext["version"]["minor"]))) + + "_api_struct {", + "\tunsigned int type;", + "\tgodot_gdnative_api_version version;", + "\tconst godot_gdnative_api_struct *next;", ] - for funcdef in ext['api']: - args = ', '.join(['%s%s' % (_spaced(t), n) for t, n in funcdef['arguments']]) - ret_val.append('\t%s(*%s)(%s);' % (_spaced(funcdef['return_type']), funcdef['name'], args)) + for funcdef in ext["api"]: + args = ", ".join(["%s%s" % (_spaced(t), n) for t, n in funcdef["arguments"]]) + ret_val.append("\t%s(*%s)(%s);" % (_spaced(funcdef["return_type"]), funcdef["name"], args)) - ret_val += ['} godot_gdnative_ext_' + name + ('' if not include_version else ('_{0}_{1}'.format(ext['version']['major'], ext['version']['minor']))) + '_api_struct;', ''] + ret_val += [ + "} godot_gdnative_ext_" + + name + + ("" if not include_version else ("_{0}_{1}".format(ext["version"]["major"], ext["version"]["minor"]))) + + "_api_struct;", + "", + ] return ret_val - def generate_core_extension_struct(core): ret_val = [] - if core['next']: - ret_val += generate_core_extension_struct(core['next']) + if core["next"]: + ret_val += generate_core_extension_struct(core["next"]) ret_val += [ - 'typedef struct godot_gdnative_core_' + ('{0}_{1}'.format(core['version']['major'], core['version']['minor'])) + '_api_struct {', - '\tunsigned int type;', - '\tgodot_gdnative_api_version version;', - '\tconst godot_gdnative_api_struct *next;', + "typedef struct godot_gdnative_core_" + + ("{0}_{1}".format(core["version"]["major"], core["version"]["minor"])) + + "_api_struct {", + "\tunsigned int type;", + "\tgodot_gdnative_api_version version;", + "\tconst godot_gdnative_api_struct *next;", ] - for funcdef in core['api']: - args = ', '.join(['%s%s' % (_spaced(t), n) for t, n in funcdef['arguments']]) - ret_val.append('\t%s(*%s)(%s);' % (_spaced(funcdef['return_type']), funcdef['name'], args)) + for funcdef in core["api"]: + args = ", ".join(["%s%s" % (_spaced(t), n) for t, n in funcdef["arguments"]]) + ret_val.append("\t%s(*%s)(%s);" % (_spaced(funcdef["return_type"]), funcdef["name"], args)) - ret_val += ['} godot_gdnative_core_' + '{0}_{1}'.format(core['version']['major'], core['version']['minor']) + '_api_struct;', ''] + ret_val += [ + "} godot_gdnative_core_" + + "{0}_{1}".format(core["version"]["major"], core["version"]["minor"]) + + "_api_struct;", + "", + ] return ret_val - - for ext in api['extensions']: - name = ext['name'] + for ext in api["extensions"]: + name = ext["name"] out += generate_extension_struct(name, ext, False) - if api['core']['next']: - out += generate_core_extension_struct(api['core']['next']) + if api["core"]["next"]: + out += generate_core_extension_struct(api["core"]["next"]) out += [ - 'typedef struct godot_gdnative_core_api_struct {', - '\tunsigned int type;', - '\tgodot_gdnative_api_version version;', - '\tconst godot_gdnative_api_struct *next;', - '\tunsigned int num_extensions;', - '\tconst godot_gdnative_api_struct **extensions;', + "typedef struct godot_gdnative_core_api_struct {", + "\tunsigned int type;", + "\tgodot_gdnative_api_version version;", + "\tconst godot_gdnative_api_struct *next;", + "\tunsigned int num_extensions;", + "\tconst godot_gdnative_api_struct **extensions;", ] - for funcdef in api['core']['api']: - args = ', '.join(['%s%s' % (_spaced(t), n) for t, n in funcdef['arguments']]) - out.append('\t%s(*%s)(%s);' % (_spaced(funcdef['return_type']), funcdef['name'], args)) + for funcdef in api["core"]["api"]: + args = ", ".join(["%s%s" % (_spaced(t), n) for t, n in funcdef["arguments"]]) + out.append("\t%s(*%s)(%s);" % (_spaced(funcdef["return_type"]), funcdef["name"], args)) out += [ - '} godot_gdnative_core_api_struct;', - '', - '#ifdef __cplusplus', - '}', - '#endif', - '', - '#endif // GODOT_GDNATIVE_API_STRUCT_H', - '' + "} godot_gdnative_core_api_struct;", + "", + "#ifdef __cplusplus", + "}", + "#endif", + "", + "#endif // GODOT_GDNATIVE_API_STRUCT_H", + "", ] - return '\n'.join(out) + return "\n".join(out) def _build_gdnative_api_struct_source(api): - out = [ - '/* THIS FILE IS GENERATED DO NOT EDIT */', - '', - '#include <gdnative_api_struct.gen.h>', - '' - ] + out = ["/* THIS FILE IS GENERATED DO NOT EDIT */", "", "#include <gdnative_api_struct.gen.h>", ""] def get_extension_struct_name(name, ext, include_version=True): - return 'godot_gdnative_ext_' + name + ('' if not include_version else ('_{0}_{1}'.format(ext['version']['major'], ext['version']['minor']))) + '_api_struct' + return ( + "godot_gdnative_ext_" + + name + + ("" if not include_version else ("_{0}_{1}".format(ext["version"]["major"], ext["version"]["minor"]))) + + "_api_struct" + ) def get_extension_struct_instance_name(name, ext, include_version=True): - return 'api_extension_' + name + ('' if not include_version else ('_{0}_{1}'.format(ext['version']['major'], ext['version']['minor']))) + '_struct' + return ( + "api_extension_" + + name + + ("" if not include_version else ("_{0}_{1}".format(ext["version"]["major"], ext["version"]["minor"]))) + + "_struct" + ) def get_extension_struct_definition(name, ext, include_version=True): ret_val = [] - if ext['next']: - ret_val += get_extension_struct_definition(name, ext['next']) + if ext["next"]: + ret_val += get_extension_struct_definition(name, ext["next"]) ret_val += [ - 'extern const ' + get_extension_struct_name(name, ext, include_version) + ' ' + get_extension_struct_instance_name(name, ext, include_version) + ' = {', - '\tGDNATIVE_EXT_' + ext['type'] + ',', - '\t{' + str(ext['version']['major']) + ', ' + str(ext['version']['minor']) + '},', - '\t' + ('NULL' if not ext['next'] else ('(const godot_gdnative_api_struct *)&' + get_extension_struct_instance_name(name, ext['next']))) + ',' + "extern const " + + get_extension_struct_name(name, ext, include_version) + + " " + + get_extension_struct_instance_name(name, ext, include_version) + + " = {", + "\tGDNATIVE_EXT_" + ext["type"] + ",", + "\t{" + str(ext["version"]["major"]) + ", " + str(ext["version"]["minor"]) + "},", + "\t" + + ( + "NULL" + if not ext["next"] + else ("(const godot_gdnative_api_struct *)&" + get_extension_struct_instance_name(name, ext["next"])) + ) + + ",", ] - for funcdef in ext['api']: - ret_val.append('\t%s,' % funcdef['name']) + for funcdef in ext["api"]: + ret_val.append("\t%s," % funcdef["name"]) - ret_val += ['};\n'] + ret_val += ["};\n"] return ret_val - def get_core_struct_definition(core): ret_val = [] - if core['next']: - ret_val += get_core_struct_definition(core['next']) + if core["next"]: + ret_val += get_core_struct_definition(core["next"]) ret_val += [ - 'extern const godot_gdnative_core_' + ('{0}_{1}_api_struct api_{0}_{1}'.format(core['version']['major'], core['version']['minor'])) + ' = {', - '\tGDNATIVE_' + core['type'] + ',', - '\t{' + str(core['version']['major']) + ', ' + str(core['version']['minor']) + '},', - '\t' + ('NULL' if not core['next'] else ('(const godot_gdnative_api_struct *)& api_{0}_{1}'.format(core['next']['version']['major'], core['next']['version']['minor']))) + ',' + "extern const godot_gdnative_core_" + + ("{0}_{1}_api_struct api_{0}_{1}".format(core["version"]["major"], core["version"]["minor"])) + + " = {", + "\tGDNATIVE_" + core["type"] + ",", + "\t{" + str(core["version"]["major"]) + ", " + str(core["version"]["minor"]) + "},", + "\t" + + ( + "NULL" + if not core["next"] + else ( + "(const godot_gdnative_api_struct *)& api_{0}_{1}".format( + core["next"]["version"]["major"], core["next"]["version"]["minor"] + ) + ) + ) + + ",", ] - for funcdef in core['api']: - ret_val.append('\t%s,' % funcdef['name']) + for funcdef in core["api"]: + ret_val.append("\t%s," % funcdef["name"]) - ret_val += ['};\n'] + ret_val += ["};\n"] return ret_val - for ext in api['extensions']: - name = ext['name'] + for ext in api["extensions"]: + name = ext["name"] out += get_extension_struct_definition(name, ext, False) - out += ['', 'const godot_gdnative_api_struct *gdnative_extensions_pointers[] = {'] + out += ["", "const godot_gdnative_api_struct *gdnative_extensions_pointers[] = {"] - for ext in api['extensions']: - name = ext['name'] - out += ['\t(godot_gdnative_api_struct *)&api_extension_' + name + '_struct,'] + for ext in api["extensions"]: + name = ext["name"] + out += ["\t(godot_gdnative_api_struct *)&api_extension_" + name + "_struct,"] - out += ['};\n'] + out += ["};\n"] - if api['core']['next']: - out += get_core_struct_definition(api['core']['next']) + if api["core"]["next"]: + out += get_core_struct_definition(api["core"]["next"]) out += [ - 'extern const godot_gdnative_core_api_struct api_struct = {', - '\tGDNATIVE_' + api['core']['type'] + ',', - '\t{' + str(api['core']['version']['major']) + ', ' + str(api['core']['version']['minor']) + '},', - '\t(const godot_gdnative_api_struct *)&api_1_1,', - '\t' + str(len(api['extensions'])) + ',', - '\tgdnative_extensions_pointers,', + "extern const godot_gdnative_core_api_struct api_struct = {", + "\tGDNATIVE_" + api["core"]["type"] + ",", + "\t{" + str(api["core"]["version"]["major"]) + ", " + str(api["core"]["version"]["minor"]) + "},", + "\t(const godot_gdnative_api_struct *)&api_1_1,", + "\t" + str(len(api["extensions"])) + ",", + "\tgdnative_extensions_pointers,", ] - for funcdef in api['core']['api']: - out.append('\t%s,' % funcdef['name']) - out.append('};\n') + for funcdef in api["core"]["api"]: + out.append("\t%s," % funcdef["name"]) + out.append("};\n") - return '\n'.join(out) + return "\n".join(out) def build_gdnative_api_struct(target, source, env): - with open(source[0], 'r') as fd: + with open(source[0], "r") as fd: api = json.load(fd) header, source = target - with open(header, 'w') as fd: + with open(header, "w") as fd: fd.write(_build_gdnative_api_struct_header(api)) - with open(source, 'w') as fd: + with open(source, "w") as fd: fd.write(_build_gdnative_api_struct_source(api)) -if __name__ == '__main__': +if __name__ == "__main__": subprocess_main(globals()) diff --git a/modules/gdnative/nativescript/SCsub b/modules/gdnative/nativescript/SCsub index c28a1c8659..4212e87a87 100644 --- a/modules/gdnative/nativescript/SCsub +++ b/modules/gdnative/nativescript/SCsub @@ -1,9 +1,9 @@ #!/usr/bin/env python -Import('env') -Import('env_gdnative') +Import("env") +Import("env_gdnative") -env_gdnative.add_source_files(env.modules_sources, '*.cpp') +env_gdnative.add_source_files(env.modules_sources, "*.cpp") if "platform" in env and env["platform"] in ["linuxbsd", "iphone"]: env.Append(LINKFLAGS=["-rdynamic"]) diff --git a/modules/gdnative/net/SCsub b/modules/gdnative/net/SCsub index 18ab9986b0..b76500c003 100644 --- a/modules/gdnative/net/SCsub +++ b/modules/gdnative/net/SCsub @@ -1,13 +1,12 @@ #!/usr/bin/env python -Import('env') -Import('env_gdnative') +Import("env") +Import("env_gdnative") env_net = env_gdnative.Clone() has_webrtc = env_net["module_webrtc_enabled"] if has_webrtc: - env_net.Append(CPPDEFINES=['WEBRTC_GDNATIVE_ENABLED']) - -env_net.add_source_files(env.modules_sources, '*.cpp') + env_net.Append(CPPDEFINES=["WEBRTC_GDNATIVE_ENABLED"]) +env_net.add_source_files(env.modules_sources, "*.cpp") diff --git a/modules/gdnative/pluginscript/SCsub b/modules/gdnative/pluginscript/SCsub index 20eaa99592..0b2db3b504 100644 --- a/modules/gdnative/pluginscript/SCsub +++ b/modules/gdnative/pluginscript/SCsub @@ -1,6 +1,6 @@ #!/usr/bin/env python -Import('env') -Import('env_gdnative') +Import("env") +Import("env_gdnative") -env_gdnative.add_source_files(env.modules_sources, '*.cpp') +env_gdnative.add_source_files(env.modules_sources, "*.cpp") diff --git a/modules/gdnative/videodecoder/SCsub b/modules/gdnative/videodecoder/SCsub index 04cc8ed604..5948b9a3dd 100644 --- a/modules/gdnative/videodecoder/SCsub +++ b/modules/gdnative/videodecoder/SCsub @@ -1,9 +1,9 @@ #!/usr/bin/env python -Import('env') -Import('env_modules') +Import("env") +Import("env_modules") env_vsdecoder_gdnative = env_modules.Clone() -env_vsdecoder_gdnative.Prepend(CPPPATH=['#modules/gdnative/include/']) -env_vsdecoder_gdnative.add_source_files(env.modules_sources, '*.cpp') +env_vsdecoder_gdnative.Prepend(CPPPATH=["#modules/gdnative/include/"]) +env_vsdecoder_gdnative.add_source_files(env.modules_sources, "*.cpp") diff --git a/modules/gdnavigation/SCsub b/modules/gdnavigation/SCsub index 9d462f92a7..877d601c6a 100644 --- a/modules/gdnavigation/SCsub +++ b/modules/gdnavigation/SCsub @@ -1,25 +1,25 @@ #!/usr/bin/env python -Import('env') -Import('env_modules') +Import("env") +Import("env_modules") env_navigation = env_modules.Clone() # Recast Thirdparty source files -if env['builtin_recast']: +if env["builtin_recast"]: thirdparty_dir = "#thirdparty/recastnavigation/Recast/" thirdparty_sources = [ - "Source/Recast.cpp", - "Source/RecastAlloc.cpp", - "Source/RecastArea.cpp", - "Source/RecastAssert.cpp", - "Source/RecastContour.cpp", - "Source/RecastFilter.cpp", - "Source/RecastLayers.cpp", - "Source/RecastMesh.cpp", - "Source/RecastMeshDetail.cpp", - "Source/RecastRasterization.cpp", - "Source/RecastRegion.cpp", + "Source/Recast.cpp", + "Source/RecastAlloc.cpp", + "Source/RecastArea.cpp", + "Source/RecastAssert.cpp", + "Source/RecastContour.cpp", + "Source/RecastFilter.cpp", + "Source/RecastLayers.cpp", + "Source/RecastMesh.cpp", + "Source/RecastMeshDetail.cpp", + "Source/RecastRasterization.cpp", + "Source/RecastRegion.cpp", ] thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] @@ -31,11 +31,11 @@ if env['builtin_recast']: # RVO Thirdparty source files -if env['builtin_rvo2']: +if env["builtin_rvo2"]: thirdparty_dir = "#thirdparty/rvo2" thirdparty_sources = [ - "/src/Agent.cpp", - "/src/KdTree.cpp", + "/src/Agent.cpp", + "/src/KdTree.cpp", ] thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] diff --git a/modules/gdnavigation/config.py b/modules/gdnavigation/config.py index 1c8cd12a2d..d22f9454ed 100644 --- a/modules/gdnavigation/config.py +++ b/modules/gdnavigation/config.py @@ -1,5 +1,6 @@ def can_build(env, platform): return True + def configure(env): pass diff --git a/modules/gdnavigation/nav_map.cpp b/modules/gdnavigation/nav_map.cpp index 338e49eb9f..adb59f5e51 100644 --- a/modules/gdnavigation/nav_map.cpp +++ b/modules/gdnavigation/nav_map.cpp @@ -657,7 +657,7 @@ void NavMap::sync() { connection->get().B->edges[connection->get().B_edge].other_edge = connection->get().A_edge; } else { // The edge is already connected with another edge, skip. - ERR_PRINT("Attempted to merge a navigation mesh triangle edge with another already-merged edge. This happens when the Navigation's `cell_size` is different from the one used to generate the navigation mesh. This will cause navigation problem."); + ERR_PRINT("Attempted to merge a navigation mesh triangle edge with another already-merged edge. This happens when the Navigation3D's `cell_size` is different from the one used to generate the navigation mesh. This will cause navigation problem."); } } } diff --git a/modules/gdscript/SCsub b/modules/gdscript/SCsub index 74e653ce43..e58a1d8edc 100644 --- a/modules/gdscript/SCsub +++ b/modules/gdscript/SCsub @@ -1,19 +1,19 @@ #!/usr/bin/env python -Import('env') -Import('env_modules') +Import("env") +Import("env_modules") env_gdscript = env_modules.Clone() env_gdscript.add_source_files(env.modules_sources, "*.cpp") -if env['tools']: +if env["tools"]: env_gdscript.add_source_files(env.modules_sources, "./editor/*.cpp") # Those two modules are required for the language server protocol - if env['module_jsonrpc_enabled'] and env['module_websocket_enabled']: + if env["module_jsonrpc_enabled"] and env["module_websocket_enabled"]: env_gdscript.add_source_files(env.modules_sources, "./language_server/*.cpp") else: # Using a define in the disabled case, to avoid having an extra define # in regular builds where all modules are enabled. - env_gdscript.Append(CPPDEFINES=['GDSCRIPT_NO_LSP']) + env_gdscript.Append(CPPDEFINES=["GDSCRIPT_NO_LSP"]) diff --git a/modules/gdscript/config.py b/modules/gdscript/config.py index a525eedaaa..185a10bcb2 100644 --- a/modules/gdscript/config.py +++ b/modules/gdscript/config.py @@ -1,9 +1,11 @@ def can_build(env, platform): return True + def configure(env): pass + def get_doc_classes(): return [ "@GDScript", @@ -12,5 +14,6 @@ def get_doc_classes(): "GDScriptNativeClass", ] + def get_doc_path(): return "doc_classes" diff --git a/modules/gdscript/doc_classes/@GDScript.xml b/modules/gdscript/doc_classes/@GDScript.xml index 2f6f9f30a4..9324691df5 100644 --- a/modules/gdscript/doc_classes/@GDScript.xml +++ b/modules/gdscript/doc_classes/@GDScript.xml @@ -90,14 +90,18 @@ </return> <argument index="0" name="condition" type="bool"> </argument> + <argument index="1" name="message" type="String" default=""""> + </argument> <description> - Asserts that the [code]condition[/code] is [code]true[/code] . If the [code]condition[/code] is [code]false[/code], an error is generated and the program is halted until you resume it. Only executes in debug builds, or when running the game from the editor. Use it for debugging purposes, to make sure a statement is [code]true[/code] during development. + Asserts that the [code]condition[/code] is [code]true[/code]. If the [code]condition[/code] is [code]false[/code], an error is generated and the program is halted until you resume it. Only executes in debug builds, or when running the game from the editor. Use it for debugging purposes, to make sure a statement is [code]true[/code] during development. + The optional [code]message[/code] argument, if given, is shown in addition to the generic "Assertion failed" message. You can use this to provide additional details about why the assertion failed. [codeblock] # Imagine we always want speed to be between 0 and 20 speed = -10 assert(speed < 20) # True, the program will continue assert(speed >= 0) # False, the program will stop assert(speed >= 0 && speed < 20) # You can also combine the two conditional statements in one check + assert(speed < 20, "speed = %f, but the speed limit is 20" % speed) # Show a message with clarifying details [/codeblock] </description> </method> @@ -1216,7 +1220,7 @@ <description> Returns whether the given class exists in [ClassDB]. [codeblock] - type_exists("Sprite") # Returns true + type_exists("Sprite2D") # Returns true type_exists("Variant") # Returns false [/codeblock] </description> diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp index 98e09159ec..5437f03a04 100644 --- a/modules/gdscript/gdscript_editor.cpp +++ b/modules/gdscript/gdscript_editor.cpp @@ -430,6 +430,8 @@ void GDScriptLanguage::get_public_functions(List<MethodInfo> *p_functions) const mi.name = "assert"; mi.return_val.type = Variant::NIL; mi.arguments.push_back(PropertyInfo(Variant::BOOL, "condition")); + mi.arguments.push_back(PropertyInfo(Variant::STRING, "message")); + mi.default_arguments.push_back(String()); p_functions->push_back(mi); } } diff --git a/modules/glslang/SCsub b/modules/glslang/SCsub index ae102238f2..c1d23a138b 100644 --- a/modules/glslang/SCsub +++ b/modules/glslang/SCsub @@ -1,12 +1,12 @@ #!/usr/bin/env python -Import('env') -Import('env_modules') +Import("env") +Import("env_modules") env_glslang = env_modules.Clone() # Thirdparty source files -if env['builtin_glslang']: +if env["builtin_glslang"]: thirdparty_dir = "#thirdparty/glslang/" thirdparty_sources = [ "glslang/MachineIndependent/RemoveTree.cpp", @@ -48,10 +48,10 @@ if env['builtin_glslang']: "SPIRV/doc.cpp", "SPIRV/SPVRemapper.cpp", "SPIRV/SpvPostProcess.cpp", - "SPIRV/Logger.cpp" + "SPIRV/Logger.cpp", ] - if (env["platform"]=="windows"): + if env["platform"] == "windows": thirdparty_sources.append("glslang/OSDependent/Windows/ossource.cpp") else: thirdparty_sources.append("glslang/OSDependent/Unix/ossource.cpp") @@ -60,7 +60,7 @@ if env['builtin_glslang']: # Treat glslang headers as system headers to avoid raising warnings. Not supported on MSVC. if not env.msvc: - env_glslang.Append(CPPFLAGS=['-isystem', Dir(thirdparty_dir).path]) + env_glslang.Append(CPPFLAGS=["-isystem", Dir(thirdparty_dir).path]) else: env_glslang.Prepend(CPPPATH=[thirdparty_dir]) diff --git a/modules/glslang/config.py b/modules/glslang/config.py index 1c8cd12a2d..d22f9454ed 100644 --- a/modules/glslang/config.py +++ b/modules/glslang/config.py @@ -1,5 +1,6 @@ def can_build(env, platform): return True + def configure(env): pass diff --git a/modules/gridmap/SCsub b/modules/gridmap/SCsub index 62b8a0ff93..970ce534f0 100644 --- a/modules/gridmap/SCsub +++ b/modules/gridmap/SCsub @@ -1,7 +1,7 @@ #!/usr/bin/env python -Import('env') -Import('env_modules') +Import("env") +Import("env_modules") env_gridmap = env_modules.Clone() diff --git a/modules/gridmap/config.py b/modules/gridmap/config.py index 5022116c9b..a6319fe1ea 100644 --- a/modules/gridmap/config.py +++ b/modules/gridmap/config.py @@ -1,13 +1,16 @@ def can_build(env, platform): return True + def configure(env): pass + def get_doc_classes(): return [ "GridMap", ] + def get_doc_path(): return "doc_classes" diff --git a/modules/gridmap/doc_classes/GridMap.xml b/modules/gridmap/doc_classes/GridMap.xml index 37ebb3e5d5..a213069e19 100644 --- a/modules/gridmap/doc_classes/GridMap.xml +++ b/modules/gridmap/doc_classes/GridMap.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="GridMap" inherits="Spatial" version="4.0"> +<class name="GridMap" inherits="Node3D" version="4.0"> <brief_description> Node for 3D tile-based maps. </brief_description> diff --git a/modules/hdr/SCsub b/modules/hdr/SCsub index c960e8126b..a709397c9a 100644 --- a/modules/hdr/SCsub +++ b/modules/hdr/SCsub @@ -1,7 +1,7 @@ #!/usr/bin/env python -Import('env') -Import('env_modules') +Import("env") +Import("env_modules") env_hdr = env_modules.Clone() diff --git a/modules/hdr/config.py b/modules/hdr/config.py index 1c8cd12a2d..d22f9454ed 100644 --- a/modules/hdr/config.py +++ b/modules/hdr/config.py @@ -1,5 +1,6 @@ def can_build(env, platform): return True + def configure(env): pass diff --git a/modules/jpg/SCsub b/modules/jpg/SCsub index 96e8e704dd..8ee8e6dd6e 100644 --- a/modules/jpg/SCsub +++ b/modules/jpg/SCsub @@ -1,7 +1,7 @@ #!/usr/bin/env python -Import('env') -Import('env_modules') +Import("env") +Import("env_modules") env_jpg = env_modules.Clone() diff --git a/modules/jpg/config.py b/modules/jpg/config.py index 1c8cd12a2d..d22f9454ed 100644 --- a/modules/jpg/config.py +++ b/modules/jpg/config.py @@ -1,5 +1,6 @@ def can_build(env, platform): return True + def configure(env): pass diff --git a/modules/jsonrpc/SCsub b/modules/jsonrpc/SCsub index 13c9ffb253..fe5312670a 100644 --- a/modules/jsonrpc/SCsub +++ b/modules/jsonrpc/SCsub @@ -1,7 +1,7 @@ #!/usr/bin/env python -Import('env') -Import('env_modules') +Import("env") +Import("env_modules") env_jsonrpc = env_modules.Clone() env_jsonrpc.add_source_files(env.modules_sources, "*.cpp") diff --git a/modules/jsonrpc/config.py b/modules/jsonrpc/config.py index 53bc827027..d22f9454ed 100644 --- a/modules/jsonrpc/config.py +++ b/modules/jsonrpc/config.py @@ -1,5 +1,6 @@ def can_build(env, platform): - return True + return True + def configure(env): - pass + pass diff --git a/modules/mbedtls/SCsub b/modules/mbedtls/SCsub index 0c6c703e16..5f5d25a3ee 100755 --- a/modules/mbedtls/SCsub +++ b/modules/mbedtls/SCsub @@ -1,11 +1,11 @@ #!/usr/bin/env python -Import('env') -Import('env_modules') +Import("env") +Import("env_modules") env_mbed_tls = env_modules.Clone() -if env['builtin_mbedtls']: +if env["builtin_mbedtls"]: # Thirdparty source files thirdparty_sources = [ "aes.c", @@ -86,7 +86,7 @@ if env['builtin_mbedtls']: "x509_csr.c", "x509write_crt.c", "x509write_csr.c", - "xtea.c" + "xtea.c", ] thirdparty_dir = "#thirdparty/mbedtls/library/" diff --git a/modules/mbedtls/config.py b/modules/mbedtls/config.py index 1c8cd12a2d..d22f9454ed 100755 --- a/modules/mbedtls/config.py +++ b/modules/mbedtls/config.py @@ -1,5 +1,6 @@ def can_build(env, platform): return True + def configure(env): pass diff --git a/modules/mobile_vr/SCsub b/modules/mobile_vr/SCsub index 4bd184f025..e6c43228b4 100644 --- a/modules/mobile_vr/SCsub +++ b/modules/mobile_vr/SCsub @@ -1,8 +1,8 @@ #!/usr/bin/env python -Import('env') -Import('env_modules') +Import("env") +Import("env_modules") env_mobile_vr = env_modules.Clone() -env_mobile_vr.add_source_files(env.modules_sources, '*.cpp') +env_mobile_vr.add_source_files(env.modules_sources, "*.cpp") diff --git a/modules/mobile_vr/config.py b/modules/mobile_vr/config.py index e85fa631dd..ee401c1a2a 100644 --- a/modules/mobile_vr/config.py +++ b/modules/mobile_vr/config.py @@ -1,13 +1,16 @@ def can_build(env, platform): return True + def configure(env): pass + def get_doc_classes(): return [ "MobileVRInterface", ] + def get_doc_path(): return "doc_classes" diff --git a/modules/modules_builders.py b/modules/modules_builders.py index 0e9cba2b0b..e7be6380d1 100644 --- a/modules/modules_builders.py +++ b/modules/modules_builders.py @@ -7,10 +7,10 @@ from platform_methods import subprocess_main def generate_modules_enabled(target, source, env): - with open(target[0].path, 'w') as f: + with open(target[0].path, "w") as f: for module in env.module_list: - f.write('#define %s\n' % ("MODULE_" + module.upper() + "_ENABLED")) + f.write("#define %s\n" % ("MODULE_" + module.upper() + "_ENABLED")) -if __name__ == '__main__': +if __name__ == "__main__": subprocess_main(globals()) diff --git a/modules/mono/SCsub b/modules/mono/SCsub index 5f03fafdcf..c723b210cb 100644 --- a/modules/mono/SCsub +++ b/modules/mono/SCsub @@ -2,46 +2,56 @@ import build_scripts.mono_configure as mono_configure -Import('env') -Import('env_modules') +Import("env") +Import("env_modules") env_mono = env_modules.Clone() -if env_mono['tools']: +if env_mono["tools"]: # NOTE: It is safe to generate this file here, since this is still executed serially import build_scripts.gen_cs_glue_version as gen_cs_glue_version - gen_cs_glue_version.generate_header('glue/GodotSharp', 'glue/cs_glue_version.gen.h') + + gen_cs_glue_version.generate_header("glue/GodotSharp", "glue/cs_glue_version.gen.h") # Glue sources -if env_mono['mono_glue']: - env_mono.Append(CPPDEFINES=['MONO_GLUE_ENABLED']) +if env_mono["mono_glue"]: + env_mono.Append(CPPDEFINES=["MONO_GLUE_ENABLED"]) import os.path - if not os.path.isfile('glue/mono_glue.gen.cpp'): + + if not os.path.isfile("glue/mono_glue.gen.cpp"): raise RuntimeError("Mono glue sources not found. Did you forget to run '--generate-mono-glue'?") -if env_mono['tools'] or env_mono['target'] != 'release': - env_mono.Append(CPPDEFINES=['GD_MONO_HOT_RELOAD']) +if env_mono["tools"] or env_mono["target"] != "release": + env_mono.Append(CPPDEFINES=["GD_MONO_HOT_RELOAD"]) # Configure Mono mono_configure.configure(env, env_mono) -if env_mono['tools'] and env_mono['mono_glue']: +if env_mono["tools"] and env_mono["mono_glue"]: # Build Godot API solution import build_scripts.api_solution_build as api_solution_build + api_sln_cmd = api_solution_build.build(env_mono) # Build GodotTools import build_scripts.godot_tools_build as godot_tools_build + godot_tools_build.build(env_mono, api_sln_cmd) # Add sources -env_mono.add_source_files(env.modules_sources, '*.cpp') -env_mono.add_source_files(env.modules_sources, 'glue/*.cpp') -env_mono.add_source_files(env.modules_sources, 'mono_gd/*.cpp') -env_mono.add_source_files(env.modules_sources, 'utils/*.cpp') +env_mono.add_source_files(env.modules_sources, "*.cpp") +env_mono.add_source_files(env.modules_sources, "glue/*.cpp") +env_mono.add_source_files(env.modules_sources, "mono_gd/*.cpp") +env_mono.add_source_files(env.modules_sources, "utils/*.cpp") + +env_mono.add_source_files(env.modules_sources, "mono_gd/support/*.cpp") + +if env["platform"] in ["osx", "iphone"]: + env_mono.add_source_files(env.modules_sources, "mono_gd/support/*.mm") + env_mono.add_source_files(env.modules_sources, "mono_gd/support/*.m") -if env['tools']: - env_mono.add_source_files(env.modules_sources, 'editor/*.cpp') +if env["tools"]: + env_mono.add_source_files(env.modules_sources, "editor/*.cpp") diff --git a/modules/mono/build_scripts/api_solution_build.py b/modules/mono/build_scripts/api_solution_build.py index 639197c285..9abac22df6 100644 --- a/modules/mono/build_scripts/api_solution_build.py +++ b/modules/mono/build_scripts/api_solution_build.py @@ -8,21 +8,22 @@ from SCons.Script import Dir def build_api_solution(source, target, env): # source and target elements are of type SCons.Node.FS.File, hence why we convert them to str - module_dir = env['module_dir'] + module_dir = env["module_dir"] - solution_path = os.path.join(module_dir, 'glue/GodotSharp/GodotSharp.sln') + solution_path = os.path.join(module_dir, "glue/GodotSharp/GodotSharp.sln") - build_config = env['solution_build_config'] + build_config = env["solution_build_config"] - extra_msbuild_args = ['/p:NoWarn=1591'] # Ignore missing documentation warnings + extra_msbuild_args = ["/p:NoWarn=1591"] # Ignore missing documentation warnings from .solution_builder import build_solution + build_solution(env, solution_path, build_config, extra_msbuild_args=extra_msbuild_args) # Copy targets - core_src_dir = os.path.abspath(os.path.join(solution_path, os.pardir, 'GodotSharp', 'bin', build_config)) - editor_src_dir = os.path.abspath(os.path.join(solution_path, os.pardir, 'GodotSharpEditor', 'bin', build_config)) + core_src_dir = os.path.abspath(os.path.join(solution_path, os.pardir, "GodotSharp", "bin", build_config)) + editor_src_dir = os.path.abspath(os.path.join(solution_path, os.pardir, "GodotSharpEditor", "bin", build_config)) dst_dir = os.path.abspath(os.path.join(str(target[0]), os.pardir)) @@ -32,6 +33,7 @@ def build_api_solution(source, target, env): def copy_target(target_path): from shutil import copy + filename = os.path.basename(target_path) src_path = os.path.join(core_src_dir, filename) @@ -45,23 +47,28 @@ def build_api_solution(source, target, env): def build(env_mono): - assert env_mono['tools'] + assert env_mono["tools"] target_filenames = [ - 'GodotSharp.dll', 'GodotSharp.pdb', 'GodotSharp.xml', - 'GodotSharpEditor.dll', 'GodotSharpEditor.pdb', 'GodotSharpEditor.xml' + "GodotSharp.dll", + "GodotSharp.pdb", + "GodotSharp.xml", + "GodotSharpEditor.dll", + "GodotSharpEditor.pdb", + "GodotSharpEditor.xml", ] depend_cmd = [] - for build_config in ['Debug', 'Release']: - output_dir = Dir('#bin').abspath - editor_api_dir = os.path.join(output_dir, 'GodotSharp', 'Api', build_config) + for build_config in ["Debug", "Release"]: + output_dir = Dir("#bin").abspath + editor_api_dir = os.path.join(output_dir, "GodotSharp", "Api", build_config) targets = [os.path.join(editor_api_dir, filename) for filename in target_filenames] - cmd = env_mono.CommandNoCache(targets, depend_cmd, build_api_solution, - module_dir=os.getcwd(), solution_build_config=build_config) + cmd = env_mono.CommandNoCache( + targets, depend_cmd, build_api_solution, module_dir=os.getcwd(), solution_build_config=build_config + ) env_mono.AlwaysBuild(cmd) # Make the Release build of the API solution depend on the Debug build. diff --git a/modules/mono/build_scripts/gen_cs_glue_version.py b/modules/mono/build_scripts/gen_cs_glue_version.py index 5d1056c2fc..98bbb4d9be 100644 --- a/modules/mono/build_scripts/gen_cs_glue_version.py +++ b/modules/mono/build_scripts/gen_cs_glue_version.py @@ -1,20 +1,20 @@ - def generate_header(solution_dir, version_header_dst): import os + latest_mtime = 0 for root, dirs, files in os.walk(solution_dir, topdown=True): - dirs[:] = [d for d in dirs if d not in ['Generated']] # Ignored generated files - files = [f for f in files if f.endswith('.cs')] + dirs[:] = [d for d in dirs if d not in ["Generated"]] # Ignored generated files + files = [f for f in files if f.endswith(".cs")] for file in files: filepath = os.path.join(root, file) mtime = os.path.getmtime(filepath) latest_mtime = mtime if mtime > latest_mtime else latest_mtime - glue_version = int(latest_mtime) # The latest modified time will do for now + glue_version = int(latest_mtime) # The latest modified time will do for now - with open(version_header_dst, 'w') as version_header: - version_header.write('/* THIS FILE IS GENERATED DO NOT EDIT */\n') - version_header.write('#ifndef CS_GLUE_VERSION_H\n') - version_header.write('#define CS_GLUE_VERSION_H\n\n') - version_header.write('#define CS_GLUE_VERSION UINT32_C(' + str(glue_version) + ')\n') - version_header.write('\n#endif // CS_GLUE_VERSION_H\n') + with open(version_header_dst, "w") as version_header: + version_header.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") + version_header.write("#ifndef CS_GLUE_VERSION_H\n") + version_header.write("#define CS_GLUE_VERSION_H\n\n") + version_header.write("#define CS_GLUE_VERSION UINT32_C(" + str(glue_version) + ")\n") + version_header.write("\n#endif // CS_GLUE_VERSION_H\n") diff --git a/modules/mono/build_scripts/godot_tools_build.py b/modules/mono/build_scripts/godot_tools_build.py index 99341c631e..cffacf2577 100644 --- a/modules/mono/build_scripts/godot_tools_build.py +++ b/modules/mono/build_scripts/godot_tools_build.py @@ -8,30 +8,31 @@ from SCons.Script import Dir def build_godot_tools(source, target, env): # source and target elements are of type SCons.Node.FS.File, hence why we convert them to str - module_dir = env['module_dir'] + module_dir = env["module_dir"] - solution_path = os.path.join(module_dir, 'editor/GodotTools/GodotTools.sln') - build_config = 'Debug' if env['target'] == 'debug' else 'Release' + solution_path = os.path.join(module_dir, "editor/GodotTools/GodotTools.sln") + build_config = "Debug" if env["target"] == "debug" else "Release" # Custom build target to make sure output is always copied to the data dir. - extra_build_args = ['/Target:Build;GodotTools:BuildAlwaysCopyToDataDir'] + extra_build_args = ["/Target:Build;GodotTools:BuildAlwaysCopyToDataDir"] + + from .solution_builder import build_solution, nuget_restore - from . solution_builder import build_solution, nuget_restore nuget_restore(env, solution_path) build_solution(env, solution_path, build_config, extra_build_args) # No need to copy targets. The GodotTools csproj takes care of copying them. def build(env_mono, api_sln_cmd): - assert env_mono['tools'] + assert env_mono["tools"] - output_dir = Dir('#bin').abspath - editor_tools_dir = os.path.join(output_dir, 'GodotSharp', 'Tools') + output_dir = Dir("#bin").abspath + editor_tools_dir = os.path.join(output_dir, "GodotSharp", "Tools") - target_filenames = ['GodotTools.dll'] + target_filenames = ["GodotTools.dll"] - if env_mono['target'] == 'debug': - target_filenames += ['GodotTools.pdb'] + if env_mono["target"] == "debug": + target_filenames += ["GodotTools.pdb"] targets = [os.path.join(editor_tools_dir, filename) for filename in target_filenames] diff --git a/modules/mono/build_scripts/make_android_mono_config.py b/modules/mono/build_scripts/make_android_mono_config.py index 4f5a496891..d276d7d886 100644 --- a/modules/mono/build_scripts/make_android_mono_config.py +++ b/modules/mono/build_scripts/make_android_mono_config.py @@ -1,23 +1,24 @@ - def generate_compressed_config(config_src, output_dir): import os.path # Source file - with open(os.path.join(output_dir, 'android_mono_config.gen.cpp'), 'w') as cpp: - with open(config_src, 'rb') as f: + with open(os.path.join(output_dir, "android_mono_config.gen.cpp"), "w") as cpp: + with open(config_src, "rb") as f: buf = f.read() decompr_size = len(buf) import zlib + buf = zlib.compress(buf) compr_size = len(buf) - bytes_seq_str = '' + bytes_seq_str = "" for i, buf_idx in enumerate(range(compr_size)): if i > 0: - bytes_seq_str += ', ' + bytes_seq_str += ", " bytes_seq_str += str(buf[buf_idx]) - cpp.write('''/* THIS FILE IS GENERATED DO NOT EDIT */ + cpp.write( + """/* THIS FILE IS GENERATED DO NOT EDIT */ #include "android_mono_config.h" #ifdef ANDROID_ENABLED @@ -48,4 +49,6 @@ String get_godot_android_mono_config() { } #endif // ANDROID_ENABLED -''' % (compr_size, decompr_size, bytes_seq_str)) +""" + % (compr_size, decompr_size, bytes_seq_str) + ) diff --git a/modules/mono/build_scripts/mono_configure.py b/modules/mono/build_scripts/mono_configure.py index 4e101583ef..23f01b3cca 100644 --- a/modules/mono/build_scripts/mono_configure.py +++ b/modules/mono/build_scripts/mono_configure.py @@ -5,178 +5,230 @@ import subprocess from SCons.Script import Dir, Environment -if os.name == 'nt': +if os.name == "nt": from . import mono_reg_utils as monoreg android_arch_dirs = { - 'armv7': 'armeabi-v7a', - 'arm64v8': 'arm64-v8a', - 'x86': 'x86', - 'x86_64': 'x86_64' + "armv7": "armeabi-v7a", + "arm64v8": "arm64-v8a", + "x86": "x86", + "x86_64": "x86_64", } def get_android_out_dir(env): - return os.path.join(Dir('#platform/android/java/lib/libs').abspath, - 'release' if env['target'] == 'release' else 'debug', - android_arch_dirs[env['android_arch']]) - - -def find_file_in_dir(directory, files, prefix='', extension=''): - if not extension.startswith('.'): - extension = '.' + extension - for curfile in files: - if os.path.isfile(os.path.join(directory, prefix + curfile + extension)): - return curfile - return '' - - -def copy_file(src_dir, dst_dir, name): + return os.path.join( + Dir("#platform/android/java/lib/libs").abspath, + "release" if env["target"] == "release" else "debug", + android_arch_dirs[env["android_arch"]], + ) + + +def find_name_in_dir_files(directory, names, prefixes=[""], extensions=[""]): + for extension in extensions: + if extension and not extension.startswith("."): + extension = "." + extension + for prefix in prefixes: + for curname in names: + if os.path.isfile(os.path.join(directory, prefix + curname + extension)): + return curname + return "" + + +def find_file_in_dir(directory, names, prefixes=[""], extensions=[""]): + for extension in extensions: + if extension and not extension.startswith("."): + extension = "." + extension + for prefix in prefixes: + for curname in names: + filename = prefix + curname + extension + if os.path.isfile(os.path.join(directory, filename)): + return filename + return "" + + +def copy_file(src_dir, dst_dir, src_name, dst_name=""): from shutil import copy - src_path = os.path.join(Dir(src_dir).abspath, name) + src_path = os.path.join(Dir(src_dir).abspath, src_name) dst_dir = Dir(dst_dir).abspath if not os.path.isdir(dst_dir): os.makedirs(dst_dir) - copy(src_path, dst_dir) + if dst_name: + copy(src_path, os.path.join(dst_dir, dst_name)) + else: + copy(src_path, dst_dir) def is_desktop(platform): - return platform in ['windows', 'osx', 'linuxbsd', 'server', 'uwp', 'haiku'] + return platform in ["windows", "osx", "linuxbsd", "server", "uwp", "haiku"] def is_unix_like(platform): - return platform in ['osx', 'linuxbsd', 'server', 'android', 'haiku'] + return platform in ["osx", "linuxbsd", "server", "android", "haiku", "iphone"] def module_supports_tools_on(platform): - return platform not in ['android', 'javascript'] + return platform not in ["android", "javascript", "iphone"] def find_wasm_src_dir(mono_root): hint_dirs = [ - os.path.join(mono_root, 'src'), - os.path.join(mono_root, '../src'), + os.path.join(mono_root, "src"), + os.path.join(mono_root, "../src"), ] for hint_dir in hint_dirs: - if os.path.isfile(os.path.join(hint_dir, 'driver.c')): + if os.path.isfile(os.path.join(hint_dir, "driver.c")): return hint_dir - return '' + return "" def configure(env, env_mono): - bits = env['bits'] - is_android = env['platform'] == 'android' - is_javascript = env['platform'] == 'javascript' + bits = env["bits"] + is_android = env["platform"] == "android" + is_javascript = env["platform"] == "javascript" + is_ios = env["platform"] == "iphone" + is_ios_sim = is_ios and env["arch"] in ["x86", "x86_64"] - tools_enabled = env['tools'] - mono_static = env['mono_static'] - copy_mono_root = env['copy_mono_root'] + tools_enabled = env["tools"] + mono_static = env["mono_static"] + copy_mono_root = env["copy_mono_root"] - mono_prefix = env['mono_prefix'] + mono_prefix = env["mono_prefix"] - mono_lib_names = ['mono-2.0-sgen', 'monosgen-2.0'] + mono_lib_names = ["mono-2.0-sgen", "monosgen-2.0"] - is_travis = os.environ.get('TRAVIS') == 'true' + is_travis = os.environ.get("TRAVIS") == "true" if is_travis: # Travis CI may have a Mono version lower than 5.12 - env_mono.Append(CPPDEFINES=['NO_PENDING_EXCEPTIONS']) + env_mono.Append(CPPDEFINES=["NO_PENDING_EXCEPTIONS"]) - if is_android and not env['android_arch'] in android_arch_dirs: - raise RuntimeError('This module does not support the specified \'android_arch\': ' + env['android_arch']) + if is_android and not env["android_arch"] in android_arch_dirs: + raise RuntimeError("This module does not support the specified 'android_arch': " + env["android_arch"]) - if tools_enabled and not module_supports_tools_on(env['platform']): + if tools_enabled and not module_supports_tools_on(env["platform"]): # TODO: # Android: We have to add the data directory to the apk, concretely the Api and Tools folders. - raise RuntimeError('This module does not currently support building for this platform with tools enabled') + raise RuntimeError("This module does not currently support building for this platform with tools enabled") if is_android and mono_static: - # Android: When static linking and doing something that requires libmono-native, we get a dlopen error as libmono-native seems to depend on libmonosgen-2.0 - raise RuntimeError('Statically linking Mono is not currently supported on this platform') + # FIXME: When static linking and doing something that requires libmono-native, we get a dlopen error as 'libmono-native' + # seems to depend on 'libmonosgen-2.0'. Could be fixed by re-directing to '__Internal' with a dllmap or in the dlopen hook. + raise RuntimeError("Statically linking Mono is not currently supported for this platform") + + if not mono_static and (is_javascript or is_ios): + raise RuntimeError("Dynamically linking Mono is not currently supported for this platform") + + if not mono_prefix and (os.getenv("MONO32_PREFIX") or os.getenv("MONO64_PREFIX")): + print( + "WARNING: The environment variables 'MONO32_PREFIX' and 'MONO64_PREFIX' are deprecated; use the 'mono_prefix' SCons parameter instead" + ) + + # Although we don't support building with tools for any platform where we currently use static AOT, + # if these are supported in the future, we won't be using static AOT for them as that would be + # too restrictive for the editor. These builds would probably be made to only use the interpreter. + mono_aot_static = (is_ios and not is_ios_sim) and not env["tools"] - if is_javascript: - mono_static = True + # Static AOT is only supported on the root domain + mono_single_appdomain = mono_aot_static - if not mono_prefix and (os.getenv('MONO32_PREFIX') or os.getenv('MONO64_PREFIX')): - print("WARNING: The environment variables 'MONO32_PREFIX' and 'MONO64_PREFIX' are deprecated; use the 'mono_prefix' SCons parameter instead") + if mono_single_appdomain: + env_mono.Append(CPPDEFINES=["GD_MONO_SINGLE_APPDOMAIN"]) - if env['platform'] == 'windows': + if (env["tools"] or env["target"] != "release") and not mono_single_appdomain: + env_mono.Append(CPPDEFINES=["GD_MONO_HOT_RELOAD"]) + + if env["platform"] == "windows": mono_root = mono_prefix - if not mono_root and os.name == 'nt': + if not mono_root and os.name == "nt": mono_root = monoreg.find_mono_root_dir(bits) if not mono_root: - raise RuntimeError("Mono installation directory not found; specify one manually with the 'mono_prefix' SCons parameter") + raise RuntimeError( + "Mono installation directory not found; specify one manually with the 'mono_prefix' SCons parameter" + ) - print('Found Mono root directory: ' + mono_root) + print("Found Mono root directory: " + mono_root) - mono_lib_path = os.path.join(mono_root, 'lib') + mono_lib_path = os.path.join(mono_root, "lib") env.Append(LIBPATH=mono_lib_path) - env_mono.Prepend(CPPPATH=os.path.join(mono_root, 'include', 'mono-2.0')) + env_mono.Prepend(CPPPATH=os.path.join(mono_root, "include", "mono-2.0")) + + lib_suffixes = [".lib"] - lib_suffix = Environment()['LIBSUFFIX'] + if not env.msvc: + # MingW supports both '.a' and '.lib' + lib_suffixes.insert(0, ".a") if mono_static: if env.msvc: - mono_static_lib_name = 'libmono-static-sgen' + mono_static_lib_name = "libmono-static-sgen" else: - mono_static_lib_name = 'libmonosgen-2.0' + mono_static_lib_name = "libmonosgen-2.0" - if not os.path.isfile(os.path.join(mono_lib_path, mono_static_lib_name + lib_suffix)): - raise RuntimeError('Could not find static mono library in: ' + mono_lib_path) + mono_static_lib_file = find_file_in_dir(mono_lib_path, [mono_static_lib_name], extensions=lib_suffixes) + + if not mono_static_lib_file: + raise RuntimeError("Could not find static mono library in: " + mono_lib_path) if env.msvc: - env.Append(LINKFLAGS=mono_static_lib_name + lib_suffix) + env.Append(LINKFLAGS=mono_static_lib_file) - env.Append(LINKFLAGS='Mincore' + lib_suffix) - env.Append(LINKFLAGS='msvcrt' + lib_suffix) - env.Append(LINKFLAGS='LIBCMT' + lib_suffix) - env.Append(LINKFLAGS='Psapi' + lib_suffix) + env.Append(LINKFLAGS="Mincore.lib") + env.Append(LINKFLAGS="msvcrt.lib") + env.Append(LINKFLAGS="LIBCMT.lib") + env.Append(LINKFLAGS="Psapi.lib") else: - env.Append(LINKFLAGS=os.path.join(mono_lib_path, mono_static_lib_name + lib_suffix)) + mono_static_lib_file_path = os.path.join(mono_lib_path, mono_static_lib_file) + env.Append(LINKFLAGS=["-Wl,-whole-archive", mono_static_lib_file_path, "-Wl,-no-whole-archive"]) - env.Append(LIBS=['psapi']) - env.Append(LIBS=['version']) + env.Append(LIBS=["psapi"]) + env.Append(LIBS=["version"]) else: - mono_lib_name = find_file_in_dir(mono_lib_path, mono_lib_names, extension=lib_suffix) + mono_lib_name = find_name_in_dir_files( + mono_lib_path, mono_lib_names, prefixes=["", "lib"], extensions=lib_suffixes + ) if not mono_lib_name: - raise RuntimeError('Could not find mono library in: ' + mono_lib_path) + raise RuntimeError("Could not find mono library in: " + mono_lib_path) if env.msvc: - env.Append(LINKFLAGS=mono_lib_name + lib_suffix) + env.Append(LINKFLAGS=mono_lib_name + ".lib") else: env.Append(LIBS=[mono_lib_name]) - mono_bin_path = os.path.join(mono_root, 'bin') + mono_bin_path = os.path.join(mono_root, "bin") - mono_dll_name = find_file_in_dir(mono_bin_path, mono_lib_names, extension='.dll') + mono_dll_file = find_file_in_dir(mono_bin_path, mono_lib_names, prefixes=["", "lib"], extensions=[".dll"]) - if not mono_dll_name: - raise RuntimeError('Could not find mono shared library in: ' + mono_bin_path) + if not mono_dll_file: + raise RuntimeError("Could not find mono shared library in: " + mono_bin_path) - copy_file(mono_bin_path, '#bin', mono_dll_name + '.dll') + copy_file(mono_bin_path, "#bin", mono_dll_file) else: - is_apple = env['platform'] in ['osx', 'iphone'] + is_apple = env["platform"] in ["osx", "iphone"] + is_macos = is_apple and not is_ios - sharedlib_ext = '.dylib' if is_apple else '.so' + sharedlib_ext = ".dylib" if is_apple else ".so" mono_root = mono_prefix - mono_lib_path = '' - mono_so_name = '' + mono_lib_path = "" + mono_so_file = "" - if not mono_root and (is_android or is_javascript): - raise RuntimeError("Mono installation directory not found; specify one manually with the 'mono_prefix' SCons parameter") + if not mono_root and (is_android or is_javascript or is_ios): + raise RuntimeError( + "Mono installation directory not found; specify one manually with the 'mono_prefix' SCons parameter" + ) - if not mono_root and is_apple: + if not mono_root and is_macos: # Try with some known directories under OSX - hint_dirs = ['/Library/Frameworks/Mono.framework/Versions/Current', '/usr/local/var/homebrew/linked/mono'] + hint_dirs = ["/Library/Frameworks/Mono.framework/Versions/Current", "/usr/local/var/homebrew/linked/mono"] for hint_dir in hint_dirs: if os.path.isdir(hint_dir): mono_root = hint_dir @@ -187,126 +239,165 @@ def configure(env, env_mono): if not mono_root and mono_static: mono_root = pkgconfig_try_find_mono_root(mono_lib_names, sharedlib_ext) if not mono_root: - raise RuntimeError("Building with mono_static=yes, but failed to find the mono prefix with pkg-config; " + \ - "specify one manually with the 'mono_prefix' SCons parameter") + raise RuntimeError( + "Building with mono_static=yes, but failed to find the mono prefix with pkg-config; " + + "specify one manually with the 'mono_prefix' SCons parameter" + ) + + if is_ios and not is_ios_sim: + env_mono.Append(CPPDEFINES=["IOS_DEVICE"]) if mono_root: - print('Found Mono root directory: ' + mono_root) + print("Found Mono root directory: " + mono_root) - mono_lib_path = os.path.join(mono_root, 'lib') + mono_lib_path = os.path.join(mono_root, "lib") env.Append(LIBPATH=[mono_lib_path]) - env_mono.Prepend(CPPPATH=os.path.join(mono_root, 'include', 'mono-2.0')) + env_mono.Prepend(CPPPATH=os.path.join(mono_root, "include", "mono-2.0")) - mono_lib = find_file_in_dir(mono_lib_path, mono_lib_names, prefix='lib', extension='.a') + mono_lib = find_name_in_dir_files(mono_lib_path, mono_lib_names, prefixes=["lib"], extensions=[".a"]) if not mono_lib: - raise RuntimeError('Could not find mono library in: ' + mono_lib_path) + raise RuntimeError("Could not find mono library in: " + mono_lib_path) - env_mono.Append(CPPDEFINES=['_REENTRANT']) + env_mono.Append(CPPDEFINES=["_REENTRANT"]) if mono_static: - env.Append(LINKFLAGS=['-rdynamic']) + env.Append(LINKFLAGS=["-rdynamic"]) - mono_lib_file = os.path.join(mono_lib_path, 'lib' + mono_lib + '.a') + mono_lib_file = os.path.join(mono_lib_path, "lib" + mono_lib + ".a") if is_apple: - env.Append(LINKFLAGS=['-Wl,-force_load,' + mono_lib_file]) + if is_macos: + env.Append(LINKFLAGS=["-Wl,-force_load," + mono_lib_file]) + else: + arch = env["arch"] + + def copy_mono_lib(libname_wo_ext): + copy_file( + mono_lib_path, "#bin", libname_wo_ext + ".a", "%s.iphone.%s.a" % (libname_wo_ext, arch) + ) + + # Copy Mono libraries to the output folder. These are meant to be bundled with + # the export templates and added to the Xcode project when exporting a game. + copy_mono_lib("lib" + mono_lib) + copy_mono_lib("libmono-native") + copy_mono_lib("libmono-profiler-log") + + if not is_ios_sim: + copy_mono_lib("libmono-ee-interp") + copy_mono_lib("libmono-icall-table") + copy_mono_lib("libmono-ilgen") else: - assert is_desktop(env['platform']) or is_android or is_javascript - env.Append(LINKFLAGS=['-Wl,-whole-archive', mono_lib_file, '-Wl,-no-whole-archive']) + assert is_desktop(env["platform"]) or is_android or is_javascript + env.Append(LINKFLAGS=["-Wl,-whole-archive", mono_lib_file, "-Wl,-no-whole-archive"]) if is_javascript: - env.Append(LIBS=['mono-icall-table', 'mono-native', 'mono-ilgen', 'mono-ee-interp']) + env.Append(LIBS=["mono-icall-table", "mono-native", "mono-ilgen", "mono-ee-interp"]) - wasm_src_dir = os.path.join(mono_root, 'src') + wasm_src_dir = os.path.join(mono_root, "src") if not os.path.isdir(wasm_src_dir): - raise RuntimeError('Could not find mono wasm src directory') + raise RuntimeError("Could not find mono wasm src directory") # Ideally this should be defined only for 'driver.c', but I can't fight scons for another 2 hours - env_mono.Append(CPPDEFINES=['CORE_BINDINGS']) - - env_mono.add_source_files(env.modules_sources, [ - os.path.join(wasm_src_dir, 'driver.c'), - os.path.join(wasm_src_dir, 'zlib-helper.c'), - os.path.join(wasm_src_dir, 'corebindings.c') - ]) - - env.Append(LINKFLAGS=[ - '--js-library', os.path.join(wasm_src_dir, 'library_mono.js'), - '--js-library', os.path.join(wasm_src_dir, 'binding_support.js'), - '--js-library', os.path.join(wasm_src_dir, 'dotnet_support.js') - ]) + env_mono.Append(CPPDEFINES=["CORE_BINDINGS"]) + + env_mono.add_source_files( + env.modules_sources, + [ + os.path.join(wasm_src_dir, "driver.c"), + os.path.join(wasm_src_dir, "zlib-helper.c"), + os.path.join(wasm_src_dir, "corebindings.c"), + ], + ) + + env.Append( + LINKFLAGS=[ + "--js-library", + os.path.join(wasm_src_dir, "library_mono.js"), + "--js-library", + os.path.join(wasm_src_dir, "binding_support.js"), + "--js-library", + os.path.join(wasm_src_dir, "dotnet_support.js"), + ] + ) else: env.Append(LIBS=[mono_lib]) - if is_apple: - env.Append(LIBS=['iconv', 'pthread']) + if is_macos: + env.Append(LIBS=["iconv", "pthread"]) elif is_android: - pass # Nothing + pass # Nothing + elif is_ios: + pass # Nothing, linking is delegated to the exported Xcode project elif is_javascript: - env.Append(LIBS=['m', 'rt', 'dl', 'pthread']) + env.Append(LIBS=["m", "rt", "dl", "pthread"]) else: - env.Append(LIBS=['m', 'rt', 'dl', 'pthread']) + env.Append(LIBS=["m", "rt", "dl", "pthread"]) if not mono_static: - mono_so_name = find_file_in_dir(mono_lib_path, mono_lib_names, prefix='lib', extension=sharedlib_ext) + mono_so_file = find_file_in_dir( + mono_lib_path, mono_lib_names, prefixes=["lib"], extensions=[sharedlib_ext] + ) - if not mono_so_name: - raise RuntimeError('Could not find mono shared library in: ' + mono_lib_path) - - copy_file(mono_lib_path, '#bin', 'lib' + mono_so_name + sharedlib_ext) + if not mono_so_file: + raise RuntimeError("Could not find mono shared library in: " + mono_lib_path) else: assert not mono_static # TODO: Add option to force using pkg-config - print('Mono root directory not found. Using pkg-config instead') + print("Mono root directory not found. Using pkg-config instead") - env.ParseConfig('pkg-config monosgen-2 --libs') - env_mono.ParseConfig('pkg-config monosgen-2 --cflags') + env.ParseConfig("pkg-config monosgen-2 --libs") + env_mono.ParseConfig("pkg-config monosgen-2 --cflags") tmpenv = Environment() - tmpenv.AppendENVPath('PKG_CONFIG_PATH', os.getenv('PKG_CONFIG_PATH')) - tmpenv.ParseConfig('pkg-config monosgen-2 --libs-only-L') + tmpenv.AppendENVPath("PKG_CONFIG_PATH", os.getenv("PKG_CONFIG_PATH")) + tmpenv.ParseConfig("pkg-config monosgen-2 --libs-only-L") - for hint_dir in tmpenv['LIBPATH']: - name_found = find_file_in_dir(hint_dir, mono_lib_names, prefix='lib', extension=sharedlib_ext) - if name_found: + for hint_dir in tmpenv["LIBPATH"]: + file_found = find_file_in_dir(hint_dir, mono_lib_names, prefixes=["lib"], extensions=[sharedlib_ext]) + if file_found: mono_lib_path = hint_dir - mono_so_name = name_found + mono_so_file = file_found break - if not mono_so_name: - raise RuntimeError('Could not find mono shared library in: ' + str(tmpenv['LIBPATH'])) + if not mono_so_file: + raise RuntimeError("Could not find mono shared library in: " + str(tmpenv["LIBPATH"])) if not mono_static: - libs_output_dir = get_android_out_dir(env) if is_android else '#bin' - copy_file(mono_lib_path, libs_output_dir, 'lib' + mono_so_name + sharedlib_ext) + libs_output_dir = get_android_out_dir(env) if is_android else "#bin" + copy_file(mono_lib_path, libs_output_dir, mono_so_file) if not tools_enabled: - if is_desktop(env['platform']): + if is_desktop(env["platform"]): if not mono_root: - mono_root = subprocess.check_output(['pkg-config', 'mono-2', '--variable=prefix']).decode('utf8').strip() + mono_root = ( + subprocess.check_output(["pkg-config", "mono-2", "--variable=prefix"]).decode("utf8").strip() + ) make_template_dir(env, mono_root) elif is_android: # Compress Android Mono Config from . import make_android_mono_config + module_dir = os.getcwd() - config_file_path = os.path.join(module_dir, 'build_scripts', 'mono_android_config.xml') - make_android_mono_config.generate_compressed_config(config_file_path, 'mono_gd/') + config_file_path = os.path.join(module_dir, "build_scripts", "mono_android_config.xml") + make_android_mono_config.generate_compressed_config(config_file_path, "mono_gd/") # Copy the required shared libraries copy_mono_shared_libs(env, mono_root, None) elif is_javascript: - pass # No data directory for this platform + pass # No data directory for this platform + elif is_ios: + pass # No data directory for this platform if copy_mono_root: if not mono_root: - mono_root = subprocess.check_output(['pkg-config', 'mono-2', '--variable=prefix']).decode('utf8').strip() + mono_root = subprocess.check_output(["pkg-config", "mono-2", "--variable=prefix"]).decode("utf8").strip() if tools_enabled: - copy_mono_root_files(env, mono_root) + copy_mono_root_files(env, mono_root) else: print("Ignoring option: 'copy_mono_root'; only available for builds with 'tools' enabled.") @@ -314,26 +405,26 @@ def configure(env, env_mono): def make_template_dir(env, mono_root): from shutil import rmtree - platform = env['platform'] - target = env['target'] + platform = env["platform"] + target = env["target"] - template_dir_name = '' + template_dir_name = "" assert is_desktop(platform) - template_dir_name = 'data.mono.%s.%s.%s' % (platform, env['bits'], target) + template_dir_name = "data.mono.%s.%s.%s" % (platform, env["bits"], target) - output_dir = Dir('#bin').abspath + output_dir = Dir("#bin").abspath template_dir = os.path.join(output_dir, template_dir_name) - template_mono_root_dir = os.path.join(template_dir, 'Mono') + template_mono_root_dir = os.path.join(template_dir, "Mono") if os.path.isdir(template_mono_root_dir): - rmtree(template_mono_root_dir) # Clean first + rmtree(template_mono_root_dir) # Clean first # Copy etc/mono/ - template_mono_config_dir = os.path.join(template_mono_root_dir, 'etc', 'mono') + template_mono_config_dir = os.path.join(template_mono_root_dir, "etc", "mono") copy_mono_etc_dir(mono_root, template_mono_config_dir, platform) # Copy the required shared libraries @@ -347,18 +438,18 @@ def copy_mono_root_files(env, mono_root): from shutil import rmtree if not mono_root: - raise RuntimeError('Mono installation directory not found') + raise RuntimeError("Mono installation directory not found") - output_dir = Dir('#bin').abspath - editor_mono_root_dir = os.path.join(output_dir, 'GodotSharp', 'Mono') + output_dir = Dir("#bin").abspath + editor_mono_root_dir = os.path.join(output_dir, "GodotSharp", "Mono") if os.path.isdir(editor_mono_root_dir): - rmtree(editor_mono_root_dir) # Clean first + rmtree(editor_mono_root_dir) # Clean first # Copy etc/mono/ - editor_mono_config_dir = os.path.join(editor_mono_root_dir, 'etc', 'mono') - copy_mono_etc_dir(mono_root, editor_mono_config_dir, env['platform']) + editor_mono_config_dir = os.path.join(editor_mono_root_dir, "etc", "mono") + copy_mono_etc_dir(mono_root, editor_mono_config_dir, env["platform"]) # Copy the required shared libraries @@ -366,20 +457,20 @@ def copy_mono_root_files(env, mono_root): # Copy framework assemblies - mono_framework_dir = os.path.join(mono_root, 'lib', 'mono', '4.5') - mono_framework_facades_dir = os.path.join(mono_framework_dir, 'Facades') + mono_framework_dir = os.path.join(mono_root, "lib", "mono", "4.5") + mono_framework_facades_dir = os.path.join(mono_framework_dir, "Facades") - editor_mono_framework_dir = os.path.join(editor_mono_root_dir, 'lib', 'mono', '4.5') - editor_mono_framework_facades_dir = os.path.join(editor_mono_framework_dir, 'Facades') + editor_mono_framework_dir = os.path.join(editor_mono_root_dir, "lib", "mono", "4.5") + editor_mono_framework_facades_dir = os.path.join(editor_mono_framework_dir, "Facades") if not os.path.isdir(editor_mono_framework_dir): os.makedirs(editor_mono_framework_dir) if not os.path.isdir(editor_mono_framework_facades_dir): os.makedirs(editor_mono_framework_facades_dir) - for assembly in glob(os.path.join(mono_framework_dir, '*.dll')): + for assembly in glob(os.path.join(mono_framework_dir, "*.dll")): copy(assembly, editor_mono_framework_dir) - for assembly in glob(os.path.join(mono_framework_facades_dir, '*.dll')): + for assembly in glob(os.path.join(mono_framework_facades_dir, "*.dll")): copy(assembly, editor_mono_framework_facades_dir) @@ -391,28 +482,28 @@ def copy_mono_etc_dir(mono_root, target_mono_config_dir, platform): if not os.path.isdir(target_mono_config_dir): os.makedirs(target_mono_config_dir) - mono_etc_dir = os.path.join(mono_root, 'etc', 'mono') + mono_etc_dir = os.path.join(mono_root, "etc", "mono") if not os.path.isdir(mono_etc_dir): - mono_etc_dir = '' + mono_etc_dir = "" etc_hint_dirs = [] - if platform != 'windows': - etc_hint_dirs += ['/etc/mono', '/usr/local/etc/mono'] - if 'MONO_CFG_DIR' in os.environ: - etc_hint_dirs += [os.path.join(os.environ['MONO_CFG_DIR'], 'mono')] + if platform != "windows": + etc_hint_dirs += ["/etc/mono", "/usr/local/etc/mono"] + if "MONO_CFG_DIR" in os.environ: + etc_hint_dirs += [os.path.join(os.environ["MONO_CFG_DIR"], "mono")] for etc_hint_dir in etc_hint_dirs: if os.path.isdir(etc_hint_dir): mono_etc_dir = etc_hint_dir break if not mono_etc_dir: - raise RuntimeError('Mono installation etc directory not found') + raise RuntimeError("Mono installation etc directory not found") - copy_tree(os.path.join(mono_etc_dir, '2.0'), os.path.join(target_mono_config_dir, '2.0')) - copy_tree(os.path.join(mono_etc_dir, '4.0'), os.path.join(target_mono_config_dir, '4.0')) - copy_tree(os.path.join(mono_etc_dir, '4.5'), os.path.join(target_mono_config_dir, '4.5')) - if os.path.isdir(os.path.join(mono_etc_dir, 'mconfig')): - copy_tree(os.path.join(mono_etc_dir, 'mconfig'), os.path.join(target_mono_config_dir, 'mconfig')) + copy_tree(os.path.join(mono_etc_dir, "2.0"), os.path.join(target_mono_config_dir, "2.0")) + copy_tree(os.path.join(mono_etc_dir, "4.0"), os.path.join(target_mono_config_dir, "4.0")) + copy_tree(os.path.join(mono_etc_dir, "4.5"), os.path.join(target_mono_config_dir, "4.5")) + if os.path.isdir(os.path.join(mono_etc_dir, "mconfig")): + copy_tree(os.path.join(mono_etc_dir, "mconfig"), os.path.join(target_mono_config_dir, "mconfig")) - for file in glob(os.path.join(mono_etc_dir, '*')): + for file in glob(os.path.join(mono_etc_dir, "*")): if os.path.isfile(file): copy(file, target_mono_config_dir) @@ -424,48 +515,66 @@ def copy_mono_shared_libs(env, mono_root, target_mono_root_dir): if os.path.isfile(src): copy(src, dst) - platform = env['platform'] + platform = env["platform"] - if platform == 'windows': - src_mono_bin_dir = os.path.join(mono_root, 'bin') - target_mono_bin_dir = os.path.join(target_mono_root_dir, 'bin') + if platform == "windows": + src_mono_bin_dir = os.path.join(mono_root, "bin") + target_mono_bin_dir = os.path.join(target_mono_root_dir, "bin") if not os.path.isdir(target_mono_bin_dir): os.makedirs(target_mono_bin_dir) - mono_posix_helper_name = find_file_in_dir(src_mono_bin_dir, ['MonoPosixHelper', 'libMonoPosixHelper'], extension='.dll') - copy(os.path.join(src_mono_bin_dir, mono_posix_helper_name + '.dll'), os.path.join(target_mono_bin_dir, 'MonoPosixHelper.dll')) + mono_posix_helper_file = find_file_in_dir( + src_mono_bin_dir, ["MonoPosixHelper"], prefixes=["", "lib"], extensions=[".dll"] + ) + copy( + os.path.join(src_mono_bin_dir, mono_posix_helper_file), + os.path.join(target_mono_bin_dir, "MonoPosixHelper.dll"), + ) # For newer versions - btls_dll_path = os.path.join(src_mono_bin_dir, 'libmono-btls-shared.dll') + btls_dll_path = os.path.join(src_mono_bin_dir, "libmono-btls-shared.dll") if os.path.isfile(btls_dll_path): copy(btls_dll_path, target_mono_bin_dir) else: - target_mono_lib_dir = get_android_out_dir(env) if platform == 'android' else os.path.join(target_mono_root_dir, 'lib') + target_mono_lib_dir = ( + get_android_out_dir(env) if platform == "android" else os.path.join(target_mono_root_dir, "lib") + ) if not os.path.isdir(target_mono_lib_dir): os.makedirs(target_mono_lib_dir) lib_file_names = [] - if platform == 'osx': - lib_file_names = [lib_name + '.dylib' for lib_name in [ - 'libmono-btls-shared', 'libmono-native-compat', 'libMonoPosixHelper' - ]] + if platform == "osx": + lib_file_names = [ + lib_name + ".dylib" + for lib_name in ["libmono-btls-shared", "libmono-native-compat", "libMonoPosixHelper"] + ] elif is_unix_like(platform): - lib_file_names = [lib_name + '.so' for lib_name in [ - 'libmono-btls-shared', 'libmono-ee-interp', 'libmono-native', 'libMonoPosixHelper', - 'libmono-profiler-aot', 'libmono-profiler-coverage', 'libmono-profiler-log', 'libMonoSupportW' - ]] + lib_file_names = [ + lib_name + ".so" + for lib_name in [ + "libmono-btls-shared", + "libmono-ee-interp", + "libmono-native", + "libMonoPosixHelper", + "libmono-profiler-aot", + "libmono-profiler-coverage", + "libmono-profiler-log", + "libMonoSupportW", + ] + ] for lib_file_name in lib_file_names: - copy_if_exists(os.path.join(mono_root, 'lib', lib_file_name), target_mono_lib_dir) + copy_if_exists(os.path.join(mono_root, "lib", lib_file_name), target_mono_lib_dir) + def pkgconfig_try_find_mono_root(mono_lib_names, sharedlib_ext): tmpenv = Environment() - tmpenv.AppendENVPath('PKG_CONFIG_PATH', os.getenv('PKG_CONFIG_PATH')) - tmpenv.ParseConfig('pkg-config monosgen-2 --libs-only-L') - for hint_dir in tmpenv['LIBPATH']: - name_found = find_file_in_dir(hint_dir, mono_lib_names, prefix='lib', extension=sharedlib_ext) - if name_found and os.path.isdir(os.path.join(hint_dir, '..', 'include', 'mono-2.0')): - return os.path.join(hint_dir, '..') - return '' + tmpenv.AppendENVPath("PKG_CONFIG_PATH", os.getenv("PKG_CONFIG_PATH")) + tmpenv.ParseConfig("pkg-config monosgen-2 --libs-only-L") + for hint_dir in tmpenv["LIBPATH"]: + name_found = find_name_in_dir_files(hint_dir, mono_lib_names, prefixes=["lib"], extensions=[sharedlib_ext]) + if name_found and os.path.isdir(os.path.join(hint_dir, "..", "include", "mono-2.0")): + return os.path.join(hint_dir, "..") + return "" diff --git a/modules/mono/build_scripts/mono_reg_utils.py b/modules/mono/build_scripts/mono_reg_utils.py index 3bae11b167..3090a4759a 100644 --- a/modules/mono/build_scripts/mono_reg_utils.py +++ b/modules/mono/build_scripts/mono_reg_utils.py @@ -1,7 +1,7 @@ import os import platform -if os.name == 'nt': +if os.name == "nt": import sys import winreg @@ -10,7 +10,7 @@ def _reg_open_key(key, subkey): try: return winreg.OpenKey(key, subkey) except (WindowsError, OSError): - if platform.architecture()[0] == '32bit': + if platform.architecture()[0] == "32bit": bitness_sam = winreg.KEY_WOW64_64KEY else: bitness_sam = winreg.KEY_WOW64_32KEY @@ -20,12 +20,12 @@ def _reg_open_key(key, subkey): def _reg_open_key_bits(key, subkey, bits): sam = winreg.KEY_READ - if platform.architecture()[0] == '32bit': - if bits == '64': + if platform.architecture()[0] == "32bit": + if bits == "64": # Force 32bit process to search in 64bit registry sam |= winreg.KEY_WOW64_64KEY else: - if bits == '32': + if bits == "32": # Force 64bit process to search in 32bit registry sam |= winreg.KEY_WOW64_32KEY @@ -35,7 +35,7 @@ def _reg_open_key_bits(key, subkey, bits): def _find_mono_in_reg(subkey, bits): try: with _reg_open_key_bits(winreg.HKEY_LOCAL_MACHINE, subkey, bits) as hKey: - value = winreg.QueryValueEx(hKey, 'SdkInstallRoot')[0] + value = winreg.QueryValueEx(hKey, "SdkInstallRoot")[0] return value except (WindowsError, OSError): return None @@ -44,70 +44,70 @@ def _find_mono_in_reg(subkey, bits): def _find_mono_in_reg_old(subkey, bits): try: with _reg_open_key_bits(winreg.HKEY_LOCAL_MACHINE, subkey, bits) as hKey: - default_clr = winreg.QueryValueEx(hKey, 'DefaultCLR')[0] + default_clr = winreg.QueryValueEx(hKey, "DefaultCLR")[0] if default_clr: - return _find_mono_in_reg(subkey + '\\' + default_clr, bits) + return _find_mono_in_reg(subkey + "\\" + default_clr, bits) return None except (WindowsError, EnvironmentError): return None def find_mono_root_dir(bits): - root_dir = _find_mono_in_reg(r'SOFTWARE\Mono', bits) + root_dir = _find_mono_in_reg(r"SOFTWARE\Mono", bits) if root_dir is not None: return str(root_dir) - root_dir = _find_mono_in_reg_old(r'SOFTWARE\Novell\Mono', bits) + root_dir = _find_mono_in_reg_old(r"SOFTWARE\Novell\Mono", bits) if root_dir is not None: return str(root_dir) - return '' + return "" def find_msbuild_tools_path_reg(): import subprocess - vswhere = os.getenv('PROGRAMFILES(X86)') + vswhere = os.getenv("PROGRAMFILES(X86)") if not vswhere: - vswhere = os.getenv('PROGRAMFILES') - vswhere += r'\Microsoft Visual Studio\Installer\vswhere.exe' + vswhere = os.getenv("PROGRAMFILES") + vswhere += r"\Microsoft Visual Studio\Installer\vswhere.exe" - vswhere_args = ['-latest', '-products', '*', '-requires', 'Microsoft.Component.MSBuild'] + vswhere_args = ["-latest", "-products", "*", "-requires", "Microsoft.Component.MSBuild"] try: lines = subprocess.check_output([vswhere] + vswhere_args).splitlines() for line in lines: - parts = line.decode("utf-8").split(':', 1) + parts = line.decode("utf-8").split(":", 1) - if len(parts) < 2 or parts[0] != 'installationPath': + if len(parts) < 2 or parts[0] != "installationPath": continue val = parts[1].strip() if not val: - raise ValueError('Value of `installationPath` entry is empty') + raise ValueError("Value of `installationPath` entry is empty") # Since VS2019, the directory is simply named "Current" - msbuild_dir = os.path.join(val, 'MSBuild\\Current\\Bin') + msbuild_dir = os.path.join(val, "MSBuild\\Current\\Bin") if os.path.isdir(msbuild_dir): return msbuild_dir # Directory name "15.0" is used in VS 2017 - return os.path.join(val, 'MSBuild\\15.0\\Bin') + return os.path.join(val, "MSBuild\\15.0\\Bin") - raise ValueError('Cannot find `installationPath` entry') + raise ValueError("Cannot find `installationPath` entry") except ValueError as e: - print('Error reading output from vswhere: ' + e.message) + print("Error reading output from vswhere: " + e.message) except WindowsError: - pass # Fine, vswhere not found + pass # Fine, vswhere not found except (subprocess.CalledProcessError, OSError): pass # Try to find 14.0 in the Registry try: - subkey = r'SOFTWARE\Microsoft\MSBuild\ToolsVersions\14.0' + subkey = r"SOFTWARE\Microsoft\MSBuild\ToolsVersions\14.0" with _reg_open_key(winreg.HKEY_LOCAL_MACHINE, subkey) as hKey: - value = winreg.QueryValueEx(hKey, 'MSBuildToolsPath')[0] + value = winreg.QueryValueEx(hKey, "MSBuildToolsPath")[0] return value except (WindowsError, OSError): - return '' + return "" diff --git a/modules/mono/build_scripts/solution_builder.py b/modules/mono/build_scripts/solution_builder.py index d1529a64d2..db6b4ff7aa 100644 --- a/modules/mono/build_scripts/solution_builder.py +++ b/modules/mono/build_scripts/solution_builder.py @@ -1,4 +1,3 @@ - import os @@ -8,35 +7,38 @@ verbose = False def find_nuget_unix(): import os - if 'NUGET_PATH' in os.environ: - hint_path = os.environ['NUGET_PATH'] + if "NUGET_PATH" in os.environ: + hint_path = os.environ["NUGET_PATH"] if os.path.isfile(hint_path) and os.access(hint_path, os.X_OK): return hint_path - hint_path = os.path.join(hint_path, 'nuget') + hint_path = os.path.join(hint_path, "nuget") if os.path.isfile(hint_path) and os.access(hint_path, os.X_OK): return hint_path import os.path import sys - hint_dirs = ['/opt/novell/mono/bin'] - if sys.platform == 'darwin': - hint_dirs = ['/Library/Frameworks/Mono.framework/Versions/Current/bin', '/usr/local/var/homebrew/linked/mono/bin'] + hint_dirs + hint_dirs = ["/opt/novell/mono/bin"] + if sys.platform == "darwin": + hint_dirs = [ + "/Library/Frameworks/Mono.framework/Versions/Current/bin", + "/usr/local/var/homebrew/linked/mono/bin", + ] + hint_dirs for hint_dir in hint_dirs: - hint_path = os.path.join(hint_dir, 'nuget') + hint_path = os.path.join(hint_dir, "nuget") if os.path.isfile(hint_path): return hint_path - elif os.path.isfile(hint_path + '.exe'): - return hint_path + '.exe' + elif os.path.isfile(hint_path + ".exe"): + return hint_path + ".exe" - for hint_dir in os.environ['PATH'].split(os.pathsep): + for hint_dir in os.environ["PATH"].split(os.pathsep): hint_dir = hint_dir.strip('"') - hint_path = os.path.join(hint_dir, 'nuget') + hint_path = os.path.join(hint_dir, "nuget") if os.path.isfile(hint_path) and os.access(hint_path, os.X_OK): return hint_path - if os.path.isfile(hint_path + '.exe') and os.access(hint_path + '.exe', os.X_OK): - return hint_path + '.exe' + if os.path.isfile(hint_path + ".exe") and os.access(hint_path + ".exe", os.X_OK): + return hint_path + ".exe" return None @@ -44,30 +46,30 @@ def find_nuget_unix(): def find_nuget_windows(env): import os - if 'NUGET_PATH' in os.environ: - hint_path = os.environ['NUGET_PATH'] + if "NUGET_PATH" in os.environ: + hint_path = os.environ["NUGET_PATH"] if os.path.isfile(hint_path) and os.access(hint_path, os.X_OK): return hint_path - hint_path = os.path.join(hint_path, 'nuget.exe') + hint_path = os.path.join(hint_path, "nuget.exe") if os.path.isfile(hint_path) and os.access(hint_path, os.X_OK): return hint_path - from . mono_reg_utils import find_mono_root_dir + from .mono_reg_utils import find_mono_root_dir - mono_root = env['mono_prefix'] or find_mono_root_dir(env['bits']) + mono_root = env["mono_prefix"] or find_mono_root_dir(env["bits"]) if mono_root: - mono_bin_dir = os.path.join(mono_root, 'bin') - nuget_mono = os.path.join(mono_bin_dir, 'nuget.bat') + mono_bin_dir = os.path.join(mono_root, "bin") + nuget_mono = os.path.join(mono_bin_dir, "nuget.bat") if os.path.isfile(nuget_mono): return nuget_mono # Standalone NuGet - for hint_dir in os.environ['PATH'].split(os.pathsep): + for hint_dir in os.environ["PATH"].split(os.pathsep): hint_dir = hint_dir.strip('"') - hint_path = os.path.join(hint_dir, 'nuget.exe') + hint_path = os.path.join(hint_dir, "nuget.exe") if os.path.isfile(hint_path) and os.access(hint_path, os.X_OK): return hint_path @@ -78,52 +80,55 @@ def find_msbuild_unix(filename): import os.path import sys - hint_dirs = ['/opt/novell/mono/bin'] - if sys.platform == 'darwin': - hint_dirs = ['/Library/Frameworks/Mono.framework/Versions/Current/bin', '/usr/local/var/homebrew/linked/mono/bin'] + hint_dirs + hint_dirs = ["/opt/novell/mono/bin"] + if sys.platform == "darwin": + hint_dirs = [ + "/Library/Frameworks/Mono.framework/Versions/Current/bin", + "/usr/local/var/homebrew/linked/mono/bin", + ] + hint_dirs for hint_dir in hint_dirs: hint_path = os.path.join(hint_dir, filename) if os.path.isfile(hint_path): return hint_path - elif os.path.isfile(hint_path + '.exe'): - return hint_path + '.exe' + elif os.path.isfile(hint_path + ".exe"): + return hint_path + ".exe" - for hint_dir in os.environ['PATH'].split(os.pathsep): + for hint_dir in os.environ["PATH"].split(os.pathsep): hint_dir = hint_dir.strip('"') hint_path = os.path.join(hint_dir, filename) if os.path.isfile(hint_path) and os.access(hint_path, os.X_OK): return hint_path - if os.path.isfile(hint_path + '.exe') and os.access(hint_path + '.exe', os.X_OK): - return hint_path + '.exe' + if os.path.isfile(hint_path + ".exe") and os.access(hint_path + ".exe", os.X_OK): + return hint_path + ".exe" return None def find_msbuild_windows(env): - from . mono_reg_utils import find_mono_root_dir, find_msbuild_tools_path_reg + from .mono_reg_utils import find_mono_root_dir, find_msbuild_tools_path_reg - mono_root = env['mono_prefix'] or find_mono_root_dir(env['bits']) + mono_root = env["mono_prefix"] or find_mono_root_dir(env["bits"]) if not mono_root: - raise RuntimeError('Cannot find mono root directory') + raise RuntimeError("Cannot find mono root directory") - mono_bin_dir = os.path.join(mono_root, 'bin') - msbuild_mono = os.path.join(mono_bin_dir, 'msbuild.bat') + mono_bin_dir = os.path.join(mono_root, "bin") + msbuild_mono = os.path.join(mono_bin_dir, "msbuild.bat") msbuild_tools_path = find_msbuild_tools_path_reg() if msbuild_tools_path: - return (os.path.join(msbuild_tools_path, 'MSBuild.exe'), {}) + return (os.path.join(msbuild_tools_path, "MSBuild.exe"), {}) if os.path.isfile(msbuild_mono): # The (Csc/Vbc/Fsc)ToolExe environment variables are required when # building with Mono's MSBuild. They must point to the batch files # in Mono's bin directory to make sure they are executed with Mono. mono_msbuild_env = { - 'CscToolExe': os.path.join(mono_bin_dir, 'csc.bat'), - 'VbcToolExe': os.path.join(mono_bin_dir, 'vbc.bat'), - 'FscToolExe': os.path.join(mono_bin_dir, 'fsharpc.bat') + "CscToolExe": os.path.join(mono_bin_dir, "csc.bat"), + "VbcToolExe": os.path.join(mono_bin_dir, "vbc.bat"), + "FscToolExe": os.path.join(mono_bin_dir, "fsharpc.bat"), } return (msbuild_mono, mono_msbuild_env) @@ -132,7 +137,7 @@ def find_msbuild_windows(env): def run_command(command, args, env_override=None, name=None): def cmd_args_to_str(cmd_args): - return ' '.join([arg if not ' ' in arg else '"%s"' % arg for arg in cmd_args]) + return " ".join([arg if not " " in arg else '"%s"' % arg for arg in cmd_args]) args = [command] + args @@ -143,6 +148,7 @@ def run_command(command, args, env_override=None, name=None): print("Running '%s': %s" % (name, cmd_args_to_str(args))) import subprocess + try: if env_override is None: subprocess.check_call(args) @@ -154,61 +160,61 @@ def run_command(command, args, env_override=None, name=None): def nuget_restore(env, *args): global verbose - verbose = env['verbose'] + verbose = env["verbose"] # Find NuGet - nuget_path = find_nuget_windows(env) if os.name == 'nt' else find_nuget_unix() + nuget_path = find_nuget_windows(env) if os.name == "nt" else find_nuget_unix() if nuget_path is None: - raise RuntimeError('Cannot find NuGet executable') + raise RuntimeError("Cannot find NuGet executable") - print('NuGet path: ' + nuget_path) + print("NuGet path: " + nuget_path) # Do NuGet restore - run_command(nuget_path, ['restore'] + list(args), name='nuget restore') + run_command(nuget_path, ["restore"] + list(args), name="nuget restore") def build_solution(env, solution_path, build_config, extra_msbuild_args=[]): global verbose - verbose = env['verbose'] + verbose = env["verbose"] msbuild_env = os.environ.copy() # Needed when running from Developer Command Prompt for VS - if 'PLATFORM' in msbuild_env: - del msbuild_env['PLATFORM'] + if "PLATFORM" in msbuild_env: + del msbuild_env["PLATFORM"] # Find MSBuild - if os.name == 'nt': + if os.name == "nt": msbuild_info = find_msbuild_windows(env) if msbuild_info is None: - raise RuntimeError('Cannot find MSBuild executable') + raise RuntimeError("Cannot find MSBuild executable") msbuild_path = msbuild_info[0] msbuild_env.update(msbuild_info[1]) else: - msbuild_path = find_msbuild_unix('msbuild') + msbuild_path = find_msbuild_unix("msbuild") if msbuild_path is None: - xbuild_fallback = env['xbuild_fallback'] + xbuild_fallback = env["xbuild_fallback"] - if xbuild_fallback and os.name == 'nt': - print('Option \'xbuild_fallback\' not supported on Windows') + if xbuild_fallback and os.name == "nt": + print("Option 'xbuild_fallback' not supported on Windows") xbuild_fallback = False if xbuild_fallback: - print('Cannot find MSBuild executable, trying with xbuild') - print('Warning: xbuild is deprecated') + print("Cannot find MSBuild executable, trying with xbuild") + print("Warning: xbuild is deprecated") - msbuild_path = find_msbuild_unix('xbuild') + msbuild_path = find_msbuild_unix("xbuild") if msbuild_path is None: - raise RuntimeError('Cannot find xbuild executable') + raise RuntimeError("Cannot find xbuild executable") else: - raise RuntimeError('Cannot find MSBuild executable') + raise RuntimeError("Cannot find MSBuild executable") - print('MSBuild path: ' + msbuild_path) + print("MSBuild path: " + msbuild_path) # Build solution - msbuild_args = [solution_path, '/p:Configuration=' + build_config] + msbuild_args = [solution_path, "/p:Configuration=" + build_config] msbuild_args += extra_msbuild_args - run_command(msbuild_path, msbuild_args, env_override=msbuild_env, name='msbuild') + run_command(msbuild_path, msbuild_args, env_override=msbuild_env, name="msbuild") diff --git a/modules/mono/config.py b/modules/mono/config.py index 3ee1618366..106ca6e028 100644 --- a/modules/mono/config.py +++ b/modules/mono/config.py @@ -1,43 +1,70 @@ +supported_platforms = ["windows", "osx", "linuxbsd", "server", "android", "haiku", "javascript", "iphone"] + + def can_build(env, platform): return True def configure(env): - if env['platform'] not in ['windows', 'osx', 'linuxbsd', 'server', 'android', 'haiku', 'javascript']: - raise RuntimeError('This module does not currently support building for this platform') + platform = env["platform"] + + if platform not in supported_platforms: + raise RuntimeError("This module does not currently support building for this platform") env.use_ptrcall = True - env.add_module_version_string('mono') + env.add_module_version_string("mono") from SCons.Script import BoolVariable, PathVariable, Variables, Help + default_mono_static = platform in ["iphone", "javascript"] + default_mono_bundles_zlib = platform in ["javascript"] + envvars = Variables() - envvars.Add(PathVariable('mono_prefix', 'Path to the mono installation directory for the target platform and architecture', '', PathVariable.PathAccept)) - envvars.Add(BoolVariable('mono_static', 'Statically link mono', False)) - envvars.Add(BoolVariable('mono_glue', 'Build with the mono glue sources', True)) - envvars.Add(BoolVariable('copy_mono_root', 'Make a copy of the mono installation directory to bundle with the editor', False)) - envvars.Add(BoolVariable('xbuild_fallback', 'If MSBuild is not found, fallback to xbuild', False)) + envvars.Add( + PathVariable( + "mono_prefix", + "Path to the mono installation directory for the target platform and architecture", + "", + PathVariable.PathAccept, + ) + ) + envvars.Add(BoolVariable("mono_static", "Statically link mono", default_mono_static)) + envvars.Add(BoolVariable("mono_glue", "Build with the mono glue sources", True)) + envvars.Add( + BoolVariable( + "copy_mono_root", "Make a copy of the mono installation directory to bundle with the editor", False + ) + ) + envvars.Add(BoolVariable("xbuild_fallback", "If MSBuild is not found, fallback to xbuild", False)) + + # TODO: It would be great if this could be detected automatically instead + envvars.Add( + BoolVariable( + "mono_bundles_zlib", "Specify if the Mono runtime was built with bundled zlib", default_mono_bundles_zlib + ) + ) + envvars.Update(env) Help(envvars.GenerateHelpText(env)) - if env['platform'] == 'javascript': - # Mono wasm already has zlib builtin, so we need this workaround to avoid symbol collisions - print('Compiling with Mono wasm disables \'builtin_zlib\'') - env['builtin_zlib'] = False + if env["mono_bundles_zlib"]: + # Mono may come with zlib bundled for WASM or on newer version when built with MinGW. + print("This Mono runtime comes with zlib bundled. Disabling 'builtin_zlib'...") + env["builtin_zlib"] = False thirdparty_zlib_dir = "#thirdparty/zlib/" env.Prepend(CPPPATH=[thirdparty_zlib_dir]) def get_doc_classes(): return [ - '@C#', - 'CSharpScript', - 'GodotSharp', + "@C#", + "CSharpScript", + "GodotSharp", ] def get_doc_path(): - return 'doc_classes' + return "doc_classes" def is_enabled(): diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index 28bacbd0f0..a007491142 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -316,7 +316,8 @@ void CSharpLanguage::get_string_delimiters(List<String> *p_delimiters) const { p_delimiters->push_back("' '"); // character literal p_delimiters->push_back("\" \""); // regular string literal - p_delimiters->push_back("@\" \""); // verbatim string literal + // Verbatim string literals (`@" "`) don't render correctly, so don't highlight them. + // Generic string highlighting suffices as a workaround for now. } static String get_base_class_name(const String &p_base_class_name, const String p_class_name) { @@ -763,7 +764,7 @@ bool CSharpLanguage::is_assembly_reloading_needed() { if (proj_assembly) { String proj_asm_path = proj_assembly->get_path(); - if (!FileAccess::exists(proj_assembly->get_path())) { + if (!FileAccess::exists(proj_asm_path)) { // Maybe it wasn't loaded from the default path, so check this as well proj_asm_path = GodotSharpDirs::get_res_temp_assemblies_dir().plus_file(appname_safe); if (!FileAccess::exists(proj_asm_path)) diff --git a/modules/mono/editor/GodotTools/GodotTools/Export/AotBuilder.cs b/modules/mono/editor/GodotTools/GodotTools/Export/AotBuilder.cs new file mode 100755 index 0000000000..f1765f7e19 --- /dev/null +++ b/modules/mono/editor/GodotTools/GodotTools/Export/AotBuilder.cs @@ -0,0 +1,618 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Text; +using GodotTools.Internals; +using Directory = GodotTools.Utils.Directory; +using File = GodotTools.Utils.File; +using OS = GodotTools.Utils.OS; +using Path = System.IO.Path; + +namespace GodotTools.Export +{ + public struct AotOptions + { + public bool EnableLLVM; + public bool LLVMOnly; + public string LLVMPath; + public string LLVMOutputPath; + + public bool FullAot; + + private bool _useInterpreter; + public bool UseInterpreter { get => _useInterpreter && !LLVMOnly; set => _useInterpreter = value; } + + public string[] ExtraAotOptions; + public string[] ExtraOptimizerOptions; + + public string ToolchainPath; + } + + public static class AotBuilder + { + public static void CompileAssemblies(ExportPlugin exporter, AotOptions aotOpts, string[] features, string platform, bool isDebug, string bclDir, string outputDir, string outputDataDir, IDictionary<string, string> assemblies) + { + // TODO: WASM + + string aotTempDir = Path.Combine(Path.GetTempPath(), $"godot-aot-{Process.GetCurrentProcess().Id}"); + + if (!Directory.Exists(aotTempDir)) + Directory.CreateDirectory(aotTempDir); + + var assembliesPrepared = new Dictionary<string, string>(); + + foreach (var dependency in assemblies) + { + string assemblyName = dependency.Key; + string assemblyPath = dependency.Value; + + string assemblyPathInBcl = Path.Combine(bclDir, assemblyName + ".dll"); + + if (File.Exists(assemblyPathInBcl)) + { + // Don't create teporaries for assemblies from the BCL + assembliesPrepared.Add(assemblyName, assemblyPathInBcl); + } + else + { + string tempAssemblyPath = Path.Combine(aotTempDir, assemblyName + ".dll"); + File.Copy(assemblyPath, tempAssemblyPath); + assembliesPrepared.Add(assemblyName, tempAssemblyPath); + } + } + + if (platform == OS.Platforms.iOS) + { + var architectures = GetEnablediOSArchs(features).ToArray(); + CompileAssembliesForiOS(exporter, isDebug, architectures, aotOpts, aotTempDir, assembliesPrepared, bclDir); + } + else if (platform == OS.Platforms.Android) + { + var abis = GetEnabledAndroidAbis(features).ToArray(); + CompileAssembliesForAndroid(exporter, isDebug, abis, aotOpts, aotTempDir, assembliesPrepared, bclDir); + } + else + { + string bits = features.Contains("64") ? "64" : features.Contains("32") ? "32" : null; + CompileAssembliesForDesktop(exporter, platform, isDebug, bits, aotOpts, aotTempDir, outputDataDir, assembliesPrepared, bclDir); + } + } + + public static void CompileAssembliesForAndroid(ExportPlugin exporter, bool isDebug, string[] abis, AotOptions aotOpts, string aotTempDir, IDictionary<string, string> assemblies, string bclDir) + { + + foreach (var assembly in assemblies) + { + string assemblyName = assembly.Key; + string assemblyPath = assembly.Value; + + // Not sure if the 'lib' prefix is an Android thing or just Godot being picky, + // but we use '-aot-' as well just in case to avoid conflicts with other libs. + string outputFileName = "lib-aot-" + assemblyName + ".dll.so"; + + foreach (string abi in abis) + { + string aotAbiTempDir = Path.Combine(aotTempDir, abi); + string soFilePath = Path.Combine(aotAbiTempDir, outputFileName); + + var compilerArgs = GetAotCompilerArgs(OS.Platforms.Android, isDebug, abi, aotOpts, assemblyPath, soFilePath); + + // Make sure the output directory exists + Directory.CreateDirectory(aotAbiTempDir); + + string compilerDirPath = Path.Combine(GodotSharpDirs.DataEditorToolsDir, "aot-compilers", $"{OS.Platforms.Android}-{abi}"); + + ExecuteCompiler(FindCrossCompiler(compilerDirPath), compilerArgs, bclDir); + + // The Godot exporter expects us to pass the abi in the tags parameter + exporter.AddSharedObject(soFilePath, tags: new[] { abi }); + } + } + } + + public static void CompileAssembliesForDesktop(ExportPlugin exporter, string platform, bool isDebug, string bits, AotOptions aotOpts, string aotTempDir, string outputDataDir, IDictionary<string, string> assemblies, string bclDir) + { + foreach (var assembly in assemblies) + { + string assemblyName = assembly.Key; + string assemblyPath = assembly.Value; + + string outputFileExtension = platform == OS.Platforms.Windows ? ".dll" : + platform == OS.Platforms.OSX ? ".dylib" : + ".so"; + + string outputFileName = assemblyName + ".dll" + outputFileExtension; + string tempOutputFilePath = Path.Combine(aotTempDir, outputFileName); + + var compilerArgs = GetAotCompilerArgs(platform, isDebug, bits, aotOpts, assemblyPath, tempOutputFilePath); + + string compilerDirPath = GetMonoCrossDesktopDirName(platform, bits); + + ExecuteCompiler(FindCrossCompiler(compilerDirPath), compilerArgs, bclDir); + + if (platform == OS.Platforms.OSX) + { + exporter.AddSharedObject(tempOutputFilePath, tags: null); + } + else + { + string outputDataLibDir = Path.Combine(outputDataDir, "Mono", platform == OS.Platforms.Windows ? "bin" : "lib"); + File.Copy(tempOutputFilePath, Path.Combine(outputDataLibDir, outputFileName)); + } + } + } + + public static void CompileAssembliesForiOS(ExportPlugin exporter, bool isDebug, string[] architectures, AotOptions aotOpts, string aotTempDir, IDictionary<string, string> assemblies, string bclDir) + { + var cppCode = new StringBuilder(); + var aotModuleInfoSymbols = new List<string>(assemblies.Count); + + // {arch: paths} + var objFilePathsForiOSArch = architectures.ToDictionary(arch => arch, arch => new List<string>(assemblies.Count)); + + foreach (var assembly in assemblies) + { + string assemblyName = assembly.Key; + string assemblyPath = assembly.Value; + + string asmFileName = assemblyName + ".dll.S"; + string objFileName = assemblyName + ".dll.o"; + + foreach (string arch in architectures) + { + string aotArchTempDir = Path.Combine(aotTempDir, arch); + string asmFilePath = Path.Combine(aotArchTempDir, asmFileName); + + var compilerArgs = GetAotCompilerArgs(OS.Platforms.iOS, isDebug, arch, aotOpts, assemblyPath, asmFilePath); + + // Make sure the output directory exists + Directory.CreateDirectory(aotArchTempDir); + + string compilerDirPath = Path.Combine(GodotSharpDirs.DataEditorToolsDir, "aot-compilers", $"{OS.Platforms.iOS}-{arch}"); + + ExecuteCompiler(FindCrossCompiler(compilerDirPath), compilerArgs, bclDir); + + // Assembling + bool isSim = arch == "i386" || arch == "x86_64"; // Shouldn't really happen as we don't do AOT for the simulator + string versionMinName = isSim ? "iphonesimulator" : "iphoneos"; + string iOSPlatformName = isSim ? "iPhoneSimulator" : "iPhoneOS"; + const string versionMin = "10.0"; // TODO: Turn this hard-coded version into an exporter setting + string iOSSdkPath = Path.Combine(XcodeHelper.XcodePath, + $"Contents/Developer/Platforms/{iOSPlatformName}.platform/Developer/SDKs/{iOSPlatformName}.sdk"); + + string objFilePath = Path.Combine(aotArchTempDir, objFileName); + + var clangArgs = new List<string>() + { + "-isysroot", iOSSdkPath, + "-Qunused-arguments", + $"-m{versionMinName}-version-min={versionMin}", + "-arch", arch, + "-c", + "-o", objFilePath, + "-x", "assembler" + }; + + if (isDebug) + clangArgs.Add("-DDEBUG"); + + clangArgs.Add(asmFilePath); + + int clangExitCode = OS.ExecuteCommand(XcodeHelper.FindXcodeTool("clang"), clangArgs); + if (clangExitCode != 0) + throw new Exception($"Command 'clang' exited with code: {clangExitCode}"); + + objFilePathsForiOSArch[arch].Add(objFilePath); + } + + aotModuleInfoSymbols.Add($"mono_aot_module_{AssemblyNameToAotSymbol(assemblyName)}_info"); + } + + // Generate driver code + cppCode.AppendLine("#if defined(__arm__) || defined(__arm64__) || defined(__aarch64__)"); + cppCode.AppendLine("#define IOS_DEVICE"); + cppCode.AppendLine("#endif"); + + cppCode.AppendLine("#ifdef IOS_DEVICE"); + cppCode.AppendLine("extern \"C\" {"); + cppCode.AppendLine("// Mono API"); + cppCode.AppendLine(@" +typedef enum { +MONO_AOT_MODE_NONE, +MONO_AOT_MODE_NORMAL, +MONO_AOT_MODE_HYBRID, +MONO_AOT_MODE_FULL, +MONO_AOT_MODE_LLVMONLY, +MONO_AOT_MODE_INTERP, +MONO_AOT_MODE_INTERP_LLVMONLY, +MONO_AOT_MODE_LLVMONLY_INTERP, +MONO_AOT_MODE_LAST = 1000, +} MonoAotMode;"); + cppCode.AppendLine("void mono_jit_set_aot_mode(MonoAotMode);"); + cppCode.AppendLine("void mono_aot_register_module(void *);"); + + if (aotOpts.UseInterpreter) + { + cppCode.AppendLine("void mono_ee_interp_init(const char *);"); + cppCode.AppendLine("void mono_icall_table_init();"); + cppCode.AppendLine("void mono_marshal_ilgen_init();"); + cppCode.AppendLine("void mono_method_builder_ilgen_init();"); + cppCode.AppendLine("void mono_sgen_mono_ilgen_init();"); + } + + foreach (string symbol in aotModuleInfoSymbols) + cppCode.AppendLine($"extern void *{symbol};"); + + cppCode.AppendLine("void gd_mono_setup_aot() {"); + + foreach (string symbol in aotModuleInfoSymbols) + cppCode.AppendLine($"\tmono_aot_register_module({symbol});"); + + if (aotOpts.UseInterpreter) + { + cppCode.AppendLine("\tmono_icall_table_init();"); + cppCode.AppendLine("\tmono_marshal_ilgen_init();"); + cppCode.AppendLine("\tmono_method_builder_ilgen_init();"); + cppCode.AppendLine("\tmono_sgen_mono_ilgen_init();"); + cppCode.AppendLine("\tmono_ee_interp_init(0);"); + } + + string aotModeStr = null; + + if (aotOpts.LLVMOnly) + { + aotModeStr = "MONO_AOT_MODE_LLVMONLY"; // --aot=llvmonly + } + else + { + if (aotOpts.UseInterpreter) + aotModeStr = "MONO_AOT_MODE_INTERP"; // --aot=interp or --aot=interp,full + else if (aotOpts.FullAot) + aotModeStr = "MONO_AOT_MODE_FULL"; // --aot=full + } + + // One of the options above is always set for iOS + Debug.Assert(aotModeStr != null); + + cppCode.AppendLine($"\tmono_jit_set_aot_mode({aotModeStr});"); + + cppCode.AppendLine("} // gd_mono_setup_aot"); + cppCode.AppendLine("} // extern \"C\""); + cppCode.AppendLine("#endif // IOS_DEVICE"); + + // Add the driver code to the Xcode project + exporter.AddIosCppCode(cppCode.ToString()); + + // Archive the AOT object files into a static library + + var arFilePathsForAllArchs = new List<string>(); + string projectAssemblyName = GodotSharpEditor.ProjectAssemblyName; + + foreach (var archPathsPair in objFilePathsForiOSArch) + { + string arch = archPathsPair.Key; + var objFilePaths = archPathsPair.Value; + + string arOutputFilePath = Path.Combine(aotTempDir, $"lib-aot-{projectAssemblyName}.{arch}.a"); + + var arArgs = new List<string>() + { + "cr", + arOutputFilePath + }; + + foreach (string objFilePath in objFilePaths) + arArgs.Add(objFilePath); + + int arExitCode = OS.ExecuteCommand(XcodeHelper.FindXcodeTool("ar"), arArgs); + if (arExitCode != 0) + throw new Exception($"Command 'ar' exited with code: {arExitCode}"); + + arFilePathsForAllArchs.Add(arOutputFilePath); + } + + // It's lipo time + + string fatOutputFileName = $"lib-aot-{projectAssemblyName}.fat.a"; + string fatOutputFilePath = Path.Combine(aotTempDir, fatOutputFileName); + + var lipoArgs = new List<string>(); + lipoArgs.Add("-create"); + lipoArgs.AddRange(arFilePathsForAllArchs); + lipoArgs.Add("-output"); + lipoArgs.Add(fatOutputFilePath); + + int lipoExitCode = OS.ExecuteCommand(XcodeHelper.FindXcodeTool("lipo"), lipoArgs); + if (lipoExitCode != 0) + throw new Exception($"Command 'lipo' exited with code: {lipoExitCode}"); + + // TODO: Add the AOT lib and interpreter libs as device only to supress warnings when targeting the simulator + + // Add the fat AOT static library to the Xcode project + exporter.AddIosProjectStaticLib(fatOutputFilePath); + + // Add the required Mono libraries to the Xcode project + + string MonoLibFile(string libFileName) => libFileName + ".iphone.fat.a"; + + string MonoLibFromTemplate(string libFileName) => + Path.Combine(Internal.FullTemplatesDir, "iphone-mono-libs", MonoLibFile(libFileName)); + + exporter.AddIosProjectStaticLib(MonoLibFromTemplate("libmonosgen-2.0")); + + exporter.AddIosProjectStaticLib(MonoLibFromTemplate("libmono-native")); + + if (aotOpts.UseInterpreter) + { + exporter.AddIosProjectStaticLib(MonoLibFromTemplate("libmono-ee-interp")); + exporter.AddIosProjectStaticLib(MonoLibFromTemplate("libmono-icall-table")); + exporter.AddIosProjectStaticLib(MonoLibFromTemplate("libmono-ilgen")); + } + + // TODO: Turn into an exporter option + bool enableProfiling = false; + if (enableProfiling) + exporter.AddIosProjectStaticLib(MonoLibFromTemplate("libmono-profiler-log")); + + // Add frameworks required by Mono to the Xcode project + exporter.AddIosFramework("libiconv.tbd"); + exporter.AddIosFramework("GSS.framework"); + exporter.AddIosFramework("CFNetwork.framework"); + + // Force load and export dynamic are needed for the linker to not strip required symbols. + // In theory we shouldn't be relying on this for P/Invoked functions (as is the case with + // functions in System.Native/libmono-native). Instead, we should use cecil to search for + // DllImports in assemblies and pass them to 'ld' as '-u/--undefined {pinvoke_symbol}'. + exporter.AddIosLinkerFlags("-rdynamic"); + exporter.AddIosLinkerFlags($"-force_load \"$(SRCROOT)/{MonoLibFile("libmono-native")}\""); + } + + /// Converts an assembly name to a valid symbol name in the same way the AOT compiler does + private static string AssemblyNameToAotSymbol(string assemblyName) + { + var builder = new StringBuilder(); + + foreach (var charByte in Encoding.UTF8.GetBytes(assemblyName)) + { + char @char = (char)charByte; + builder.Append(Char.IsLetterOrDigit(@char) || @char == '_' ? @char : '_'); + } + + return builder.ToString(); + } + + private static IEnumerable<string> GetAotCompilerArgs(string platform, bool isDebug, string target, AotOptions aotOpts, string assemblyPath, string outputFilePath) + { + // TODO: LLVM + + bool aotSoftDebug = isDebug && !aotOpts.EnableLLVM; + bool aotDwarfDebug = platform == OS.Platforms.iOS; + + var aotOptions = new List<string>(); + var optimizerOptions = new List<string>(); + + if (aotOpts.LLVMOnly) + { + aotOptions.Add("llvmonly"); + } + else + { + // Can be both 'interp' and 'full' + if (aotOpts.UseInterpreter) + aotOptions.Add("interp"); + if (aotOpts.FullAot) + aotOptions.Add("full"); + } + + aotOptions.Add(aotSoftDebug ? "soft-debug" : "nodebug"); + + if (aotDwarfDebug) + aotOptions.Add("dwarfdebug"); + + if (platform == OS.Platforms.Android) + { + string abi = target; + + string androidToolchain = aotOpts.ToolchainPath; + + if (string.IsNullOrEmpty(androidToolchain)) + { + androidToolchain = Path.Combine(GodotSharpDirs.DataEditorToolsDir, "android-toolchains", $"{abi}"); // TODO: $"{abi}-{apiLevel}{(clang?"clang":"")}" + + if (!Directory.Exists(androidToolchain)) + throw new FileNotFoundException("Missing android toolchain. Specify one in the AOT export settings."); + } + else if (!Directory.Exists(androidToolchain)) + { + throw new FileNotFoundException("Android toolchain not found: " + androidToolchain); + } + + var androidToolPrefixes = new Dictionary<string, string> + { + ["armeabi-v7a"] = "arm-linux-androideabi-", + ["arm64-v8a"] = "aarch64-linux-android-", + ["x86"] = "i686-linux-android-", + ["x86_64"] = "x86_64-linux-android-" + }; + + aotOptions.Add("tool-prefix=" + Path.Combine(androidToolchain, "bin", androidToolPrefixes[abi])); + + string triple = GetAndroidTriple(abi); + aotOptions.Add($"mtriple={triple}"); + } + else if (platform == OS.Platforms.iOS) + { + if (!aotOpts.LLVMOnly && !aotOpts.UseInterpreter) + optimizerOptions.Add("gsharedvt"); + + aotOptions.Add("static"); + + // I couldn't get the Mono cross-compiler to do assembling, so we'll have to do it ourselves + aotOptions.Add("asmonly"); + + aotOptions.Add("direct-icalls"); + + if (aotSoftDebug) + aotOptions.Add("no-direct-calls"); + + if (aotOpts.LLVMOnly || !aotOpts.UseInterpreter) + aotOptions.Add("direct-pinvoke"); + + string arch = target; + aotOptions.Add($"mtriple={arch}-ios"); + } + + aotOptions.Add($"outfile={outputFilePath}"); + + if (aotOpts.EnableLLVM) + { + aotOptions.Add($"llvm-path={aotOpts.LLVMPath}"); + aotOptions.Add($"llvm-outfile={aotOpts.LLVMOutputPath}"); + } + + if (aotOpts.ExtraAotOptions.Length > 0) + aotOptions.AddRange(aotOpts.ExtraAotOptions); + + if (aotOpts.ExtraOptimizerOptions.Length > 0) + optimizerOptions.AddRange(aotOpts.ExtraOptimizerOptions); + + string EscapeOption(string option) => option.Contains(',') ? $"\"{option}\"" : option; + string OptionsToString(IEnumerable<string> options) => string.Join(",", options.Select(EscapeOption)); + + var runtimeArgs = new List<string>(); + + // The '--debug' runtime option is required when using the 'soft-debug' and 'dwarfdebug' AOT options + if (aotSoftDebug || aotDwarfDebug) + runtimeArgs.Add("--debug"); + + if (aotOpts.EnableLLVM) + runtimeArgs.Add("--llvm"); + + runtimeArgs.Add(aotOptions.Count > 0 ? $"--aot={OptionsToString(aotOptions)}" : "--aot"); + + if (optimizerOptions.Count > 0) + runtimeArgs.Add($"-O={OptionsToString(optimizerOptions)}"); + + runtimeArgs.Add(assemblyPath); + + return runtimeArgs; + } + + private static void ExecuteCompiler(string compiler, IEnumerable<string> compilerArgs, string bclDir) + { + // TODO: Once we move to .NET Standard 2.1 we can use ProcessStartInfo.ArgumentList instead + string CmdLineArgsToString(IEnumerable<string> args) + { + // Not perfect, but as long as we are careful... + return string.Join(" ", args.Select(arg => arg.Contains(" ") ? $@"""{arg}""" : arg)); + } + + using (var process = new Process()) + { + process.StartInfo = new ProcessStartInfo(compiler, CmdLineArgsToString(compilerArgs)) + { + UseShellExecute = false + }; + + process.StartInfo.EnvironmentVariables.Remove("MONO_ENV_OPTIONS"); + process.StartInfo.EnvironmentVariables.Remove("MONO_THREADS_SUSPEND"); + process.StartInfo.EnvironmentVariables.Add("MONO_PATH", bclDir); + + Console.WriteLine($"Running: \"{process.StartInfo.FileName}\" {process.StartInfo.Arguments}"); + + if (!process.Start()) + throw new Exception("Failed to start process for Mono AOT compiler"); + + process.WaitForExit(); + + if (process.ExitCode != 0) + throw new Exception($"Mono AOT compiler exited with code: {process.ExitCode}"); + } + } + + private static IEnumerable<string> GetEnablediOSArchs(string[] features) + { + var iosArchs = new[] + { + "armv7", + "arm64" + }; + + return iosArchs.Where(features.Contains); + } + + private static IEnumerable<string> GetEnabledAndroidAbis(string[] features) + { + var androidAbis = new[] + { + "armeabi-v7a", + "arm64-v8a", + "x86", + "x86_64" + }; + + return androidAbis.Where(features.Contains); + } + + private static string GetAndroidTriple(string abi) + { + var abiArchs = new Dictionary<string, string> + { + ["armeabi-v7a"] = "armv7", + ["arm64-v8a"] = "aarch64-v8a", + ["x86"] = "i686", + ["x86_64"] = "x86_64" + }; + + string arch = abiArchs[abi]; + + return $"{arch}-linux-android"; + } + + private static string GetMonoCrossDesktopDirName(string platform, string bits) + { + switch (platform) + { + case OS.Platforms.Windows: + case OS.Platforms.UWP: + { + string arch = bits == "64" ? "x86_64" : "i686"; + return $"windows-{arch}"; + } + case OS.Platforms.OSX: + { + Debug.Assert(bits == null || bits == "64"); + string arch = "x86_64"; + return $"{platform}-{arch}"; + } + case OS.Platforms.X11: + case OS.Platforms.Server: + { + string arch = bits == "64" ? "x86_64" : "i686"; + return $"linux-{arch}"; + } + case OS.Platforms.Haiku: + { + string arch = bits == "64" ? "x86_64" : "i686"; + return $"{platform}-{arch}"; + } + default: + throw new NotSupportedException($"Platform not supported: {platform}"); + } + } + + // TODO: Replace this for a specific path for each platform + private static string FindCrossCompiler(string monoCrossBin) + { + string exeExt = OS.IsWindows ? ".exe" : string.Empty; + + var files = new DirectoryInfo(monoCrossBin).GetFiles($"*mono-sgen{exeExt}", SearchOption.TopDirectoryOnly); + if (files.Length > 0) + return Path.Combine(monoCrossBin, files[0].Name); + + throw new FileNotFoundException($"Cannot find the mono runtime executable in {monoCrossBin}"); + } + } +} diff --git a/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs b/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs index 022005ad0b..d782d4e61b 100644 --- a/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs +++ b/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs @@ -29,15 +29,13 @@ namespace GodotTools.Export All = CJK | MidEast | Other | Rare | West } - private void AddI18NAssemblies(Godot.Collections.Dictionary<string, string> assemblies, string platform) + private void AddI18NAssemblies(Godot.Collections.Dictionary<string, string> assemblies, string bclDir) { - var codesets = (I18NCodesets) ProjectSettings.GetSetting("mono/export/i18n_codesets"); + var codesets = (I18NCodesets)ProjectSettings.GetSetting("mono/export/i18n_codesets"); if (codesets == I18NCodesets.None) return; - string bclDir = DeterminePlatformBclDir(platform) ?? typeof(object).Assembly.Location.GetBaseDir(); - void AddI18NAssembly(string name) => assemblies.Add(name, Path.Combine(bclDir, $"{name}.dll")); AddI18NAssembly("I18N"); @@ -73,6 +71,7 @@ namespace GodotTools.Export GlobalDef("mono/export/aot/enabled", false); GlobalDef("mono/export/aot/full_aot", false); + GlobalDef("mono/export/aot/use_interpreter", true); // --aot or --aot=opt1,opt2 (use 'mono --aot=help AuxAssembly.dll' to list AOT options) GlobalDef("mono/export/aot/extra_aot_options", new string[] { }); @@ -86,9 +85,11 @@ namespace GodotTools.Export private void AddFile(string srcPath, string dstPath, bool remap = false) { + // Add file to the PCK AddFile(dstPath.Replace("\\", "/"), File.ReadAllBytes(srcPath), remap); } + // With this method we can override how a file is exported in the PCK public override void _ExportFile(string path, string type, string[] features) { base._ExportFile(path, type, features); @@ -110,6 +111,8 @@ namespace GodotTools.Export // Sadly, Godot prints errors when adding an empty file (nothing goes wrong, it's just noise). // Because of this, we add a file which contains a line break. AddFile(path, System.Text.Encoding.UTF8.GetBytes("\n"), remap: false); + + // Tell the Godot exporter that we already took care of the file Skip(); } } @@ -167,12 +170,7 @@ namespace GodotTools.Export var dependencies = new Godot.Collections.Dictionary<string, string>(); - var projectDllName = (string)ProjectSettings.GetSetting("application/config/name"); - if (projectDllName.Empty()) - { - projectDllName = "UnnamedProject"; - } - + string projectDllName = GodotSharpEditor.ProjectAssemblyName; string projectDllSrcDir = Path.Combine(GodotSharpDirs.ResTempAssembliesBaseDir, buildConfig); string projectDllSrcPath = Path.Combine(projectDllSrcDir, $"{projectDllName}.dll"); @@ -189,10 +187,12 @@ namespace GodotTools.Export dependencies["Mono.Android"] = monoAndroidAssemblyPath; } + string bclDir = DeterminePlatformBclDir(platform); + var initialDependencies = dependencies.Duplicate(); - internal_GetExportedAssemblyDependencies(initialDependencies, buildConfig, DeterminePlatformBclDir(platform), dependencies); + internal_GetExportedAssemblyDependencies(initialDependencies, buildConfig, bclDir, dependencies); - AddI18NAssemblies(dependencies, platform); + AddI18NAssemblies(dependencies, bclDir); string outputDataDir = null; @@ -227,11 +227,34 @@ namespace GodotTools.Export } } - // AOT + // AOT compilation + bool aotEnabled = platform == OS.Platforms.iOS || (bool)ProjectSettings.GetSetting("mono/export/aot/enabled"); - if ((bool)ProjectSettings.GetSetting("mono/export/aot/enabled")) + if (aotEnabled) { - AotCompileDependencies(features, platform, isDebug, outputDir, outputDataDir, dependencies); + string aotToolchainPath = null; + + if (platform == OS.Platforms.Android) + aotToolchainPath = (string)ProjectSettings.GetSetting("mono/export/aot/android_toolchain_path"); + + if (aotToolchainPath == string.Empty) + aotToolchainPath = null; // Don't risk it being used as current working dir + + // TODO: LLVM settings are hard-coded and disabled for now + var aotOpts = new AotOptions + { + EnableLLVM = false, + LLVMOnly = false, + LLVMPath = "", + LLVMOutputPath = "", + FullAot = platform == OS.Platforms.iOS || (bool)(ProjectSettings.GetSetting("mono/export/aot/full_aot") ?? false), + UseInterpreter = (bool)ProjectSettings.GetSetting("mono/export/aot/use_interpreter"), + ExtraAotOptions = (string[])ProjectSettings.GetSetting("mono/export/aot/extra_aot_options") ?? new string[] { }, + ExtraOptimizerOptions = (string[])ProjectSettings.GetSetting("mono/export/aot/extra_optimizer_options") ?? new string[] { }, + ToolchainPath = aotToolchainPath + }; + + AotBuilder.CompileAssemblies(this, aotOpts, features, platform, isDebug, bclDir, outputDir, outputDataDir, dependencies); } } @@ -258,7 +281,8 @@ namespace GodotTools.Export { string target = isDebug ? "release_debug" : "release"; - // NOTE: Bits is ok for now as all platforms with a data directory have it, but that may change in the future. + // NOTE: Bits is ok for now as all platforms with a data directory only have one or two architectures. + // However, this may change in the future if we add arm linux or windows desktop templates. string bits = features.Contains("64") ? "64" : "32"; string TemplateDirName() => $"data.mono.{platform}.{bits}.{target}"; @@ -284,7 +308,7 @@ namespace GodotTools.Export if (!validTemplatePathFound) throw new FileNotFoundException("Data template directory not found", templateDirPath); - string outputDataDir = Path.Combine(outputDir, DataDirName); + string outputDataDir = Path.Combine(outputDir, DetermineDataDirNameForProject()); if (Directory.Exists(outputDataDir)) Directory.Delete(outputDataDir, recursive: true); // Clean first @@ -304,333 +328,10 @@ namespace GodotTools.Export return outputDataDir; } - private void AotCompileDependencies(string[] features, string platform, bool isDebug, string outputDir, string outputDataDir, IDictionary<string, string> dependencies) - { - // TODO: WASM - - string bclDir = DeterminePlatformBclDir(platform) ?? typeof(object).Assembly.Location.GetBaseDir(); - - string aotTempDir = Path.Combine(Path.GetTempPath(), $"godot-aot-{Process.GetCurrentProcess().Id}"); - - if (!Directory.Exists(aotTempDir)) - Directory.CreateDirectory(aotTempDir); - - var assemblies = new Dictionary<string, string>(); - - foreach (var dependency in dependencies) - { - string assemblyName = dependency.Key; - string assemblyPath = dependency.Value; - - string assemblyPathInBcl = Path.Combine(bclDir, assemblyName + ".dll"); - - if (File.Exists(assemblyPathInBcl)) - { - // Don't create teporaries for assemblies from the BCL - assemblies.Add(assemblyName, assemblyPathInBcl); - } - else - { - string tempAssemblyPath = Path.Combine(aotTempDir, assemblyName + ".dll"); - File.Copy(assemblyPath, tempAssemblyPath); - assemblies.Add(assemblyName, tempAssemblyPath); - } - } - - foreach (var assembly in assemblies) - { - string assemblyName = assembly.Key; - string assemblyPath = assembly.Value; - - string sharedLibExtension = platform == OS.Platforms.Windows ? ".dll" : - platform == OS.Platforms.OSX ? ".dylib" : - platform == OS.Platforms.HTML5 ? ".wasm" : - ".so"; - - string outputFileName = assemblyName + ".dll" + sharedLibExtension; - - if (platform == OS.Platforms.Android) - { - // Not sure if the 'lib' prefix is an Android thing or just Godot being picky, - // but we use '-aot-' as well just in case to avoid conflicts with other libs. - outputFileName = "lib-aot-" + outputFileName; - } - - string outputFilePath = null; - string tempOutputFilePath; - - switch (platform) - { - case OS.Platforms.OSX: - tempOutputFilePath = Path.Combine(aotTempDir, outputFileName); - break; - case OS.Platforms.Android: - tempOutputFilePath = Path.Combine(aotTempDir, "%%ANDROID_ABI%%", outputFileName); - break; - case OS.Platforms.HTML5: - tempOutputFilePath = Path.Combine(aotTempDir, outputFileName); - outputFilePath = Path.Combine(outputDir, outputFileName); - break; - default: - tempOutputFilePath = Path.Combine(aotTempDir, outputFileName); - outputFilePath = Path.Combine(outputDataDir, "Mono", platform == OS.Platforms.Windows ? "bin" : "lib", outputFileName); - break; - } - - var data = new Dictionary<string, string>(); - var enabledAndroidAbis = platform == OS.Platforms.Android ? GetEnabledAndroidAbis(features).ToArray() : null; - - if (platform == OS.Platforms.Android) - { - Debug.Assert(enabledAndroidAbis != null); - - foreach (var abi in enabledAndroidAbis) - { - data["abi"] = abi; - var outputFilePathForThisAbi = tempOutputFilePath.Replace("%%ANDROID_ABI%%", abi); - - AotCompileAssembly(platform, isDebug, data, assemblyPath, outputFilePathForThisAbi); - - AddSharedObject(outputFilePathForThisAbi, tags: new[] { abi }); - } - } - else - { - string bits = features.Contains("64") ? "64" : features.Contains("64") ? "32" : null; - - if (bits != null) - data["bits"] = bits; - - AotCompileAssembly(platform, isDebug, data, assemblyPath, tempOutputFilePath); - - if (platform == OS.Platforms.OSX) - { - AddSharedObject(tempOutputFilePath, tags: null); - } - else - { - Debug.Assert(outputFilePath != null); - File.Copy(tempOutputFilePath, outputFilePath); - } - } - } - } - - private static void AotCompileAssembly(string platform, bool isDebug, Dictionary<string, string> data, string assemblyPath, string outputFilePath) - { - // Make sure the output directory exists - Directory.CreateDirectory(outputFilePath.GetBaseDir()); - - string exeExt = OS.IsWindows ? ".exe" : string.Empty; - - string monoCrossDirName = DetermineMonoCrossDirName(platform, data); - string monoCrossRoot = Path.Combine(GodotSharpDirs.DataEditorToolsDir, "aot-compilers", monoCrossDirName); - string monoCrossBin = Path.Combine(monoCrossRoot, "bin"); - - string toolPrefix = DetermineToolPrefix(monoCrossBin); - string monoExeName = System.IO.File.Exists(Path.Combine(monoCrossBin, $"{toolPrefix}mono{exeExt}")) ? "mono" : "mono-sgen"; - - string compilerCommand = Path.Combine(monoCrossBin, $"{toolPrefix}{monoExeName}{exeExt}"); - - bool fullAot = (bool)ProjectSettings.GetSetting("mono/export/aot/full_aot"); - - string EscapeOption(string option) => option.Contains(',') ? $"\"{option}\"" : option; - string OptionsToString(IEnumerable<string> options) => string.Join(",", options.Select(EscapeOption)); - - var aotOptions = new List<string>(); - var optimizerOptions = new List<string>(); - - if (fullAot) - aotOptions.Add("full"); - - aotOptions.Add(isDebug ? "soft-debug" : "nodebug"); - - if (platform == OS.Platforms.Android) - { - string abi = data["abi"]; - - string androidToolchain = (string)ProjectSettings.GetSetting("mono/export/aot/android_toolchain_path"); - - if (string.IsNullOrEmpty(androidToolchain)) - { - androidToolchain = Path.Combine(GodotSharpDirs.DataEditorToolsDir, "android-toolchains", $"{abi}"); // TODO: $"{abi}-{apiLevel}{(clang?"clang":"")}" - - if (!Directory.Exists(androidToolchain)) - throw new FileNotFoundException("Missing android toolchain. Specify one in the AOT export settings."); - } - else if (!Directory.Exists(androidToolchain)) - { - throw new FileNotFoundException("Android toolchain not found: " + androidToolchain); - } - - var androidToolPrefixes = new Dictionary<string, string> - { - ["armeabi-v7a"] = "arm-linux-androideabi-", - ["arm64-v8a"] = "aarch64-linux-android-", - ["x86"] = "i686-linux-android-", - ["x86_64"] = "x86_64-linux-android-" - }; - - aotOptions.Add("tool-prefix=" + Path.Combine(androidToolchain, "bin", androidToolPrefixes[abi])); - - string triple = GetAndroidTriple(abi); - aotOptions.Add($"mtriple={triple}"); - } - - aotOptions.Add($"outfile={outputFilePath}"); - - var extraAotOptions = (string[])ProjectSettings.GetSetting("mono/export/aot/extra_aot_options"); - var extraOptimizerOptions = (string[])ProjectSettings.GetSetting("mono/export/aot/extra_optimizer_options"); - - if (extraAotOptions.Length > 0) - aotOptions.AddRange(extraAotOptions); - - if (extraOptimizerOptions.Length > 0) - optimizerOptions.AddRange(extraOptimizerOptions); - - var compilerArgs = new List<string>(); - - if (isDebug) - compilerArgs.Add("--debug"); // Required for --aot=soft-debug - - compilerArgs.Add(aotOptions.Count > 0 ? $"--aot={OptionsToString(aotOptions)}" : "--aot"); - - if (optimizerOptions.Count > 0) - compilerArgs.Add($"-O={OptionsToString(optimizerOptions)}"); - - compilerArgs.Add(ProjectSettings.GlobalizePath(assemblyPath)); - - // TODO: Once we move to .NET Standard 2.1 we can use ProcessStartInfo.ArgumentList instead - string CmdLineArgsToString(IEnumerable<string> args) - { - // Not perfect, but as long as we are careful... - return string.Join(" ", args.Select(arg => arg.Contains(" ") ? $@"""{arg}""" : arg)); - } - - using (var process = new Process()) - { - process.StartInfo = new ProcessStartInfo(compilerCommand, CmdLineArgsToString(compilerArgs)) - { - UseShellExecute = false - }; - - string platformBclDir = DeterminePlatformBclDir(platform); - process.StartInfo.EnvironmentVariables.Add("MONO_PATH", string.IsNullOrEmpty(platformBclDir) ? - typeof(object).Assembly.Location.GetBaseDir() : - platformBclDir); - - Console.WriteLine($"Running: \"{process.StartInfo.FileName}\" {process.StartInfo.Arguments}"); - - if (!process.Start()) - throw new Exception("Failed to start process for Mono AOT compiler"); - - process.WaitForExit(); - - if (process.ExitCode != 0) - throw new Exception($"Mono AOT compiler exited with error code: {process.ExitCode}"); - - if (!System.IO.File.Exists(outputFilePath)) - throw new Exception("Mono AOT compiler finished successfully but the output file is missing"); - } - } - - private static string DetermineMonoCrossDirName(string platform, IReadOnlyDictionary<string, string> data) - { - switch (platform) - { - case OS.Platforms.Windows: - case OS.Platforms.UWP: - { - string arch = data["bits"] == "64" ? "x86_64" : "i686"; - return $"windows-{arch}"; - } - case OS.Platforms.OSX: - { - string arch = "x86_64"; - return $"{platform}-{arch}"; - } - case OS.Platforms.X11: - case OS.Platforms.Server: - { - string arch = data["bits"] == "64" ? "x86_64" : "i686"; - return $"linux-{arch}"; - } - case OS.Platforms.Haiku: - { - string arch = data["bits"] == "64" ? "x86_64" : "i686"; - return $"{platform}-{arch}"; - } - case OS.Platforms.Android: - { - string abi = data["abi"]; - return $"{platform}-{abi}"; - } - case OS.Platforms.HTML5: - return "wasm-wasm32"; - default: - throw new NotSupportedException($"Platform not supported: {platform}"); - } - } - - private static string DetermineToolPrefix(string monoCrossBin) - { - string exeExt = OS.IsWindows ? ".exe" : string.Empty; - - if (System.IO.File.Exists(Path.Combine(monoCrossBin, $"mono{exeExt}"))) - return string.Empty; - - if (System.IO.File.Exists(Path.Combine(monoCrossBin, $"mono-sgen{exeExt}" + exeExt))) - return string.Empty; - - var files = new DirectoryInfo(monoCrossBin).GetFiles($"*mono{exeExt}" + exeExt, SearchOption.TopDirectoryOnly); - if (files.Length > 0) - { - string fileName = files[0].Name; - return fileName.Substring(0, fileName.Length - $"mono{exeExt}".Length); - } - - files = new DirectoryInfo(monoCrossBin).GetFiles($"*mono-sgen{exeExt}" + exeExt, SearchOption.TopDirectoryOnly); - if (files.Length > 0) - { - string fileName = files[0].Name; - return fileName.Substring(0, fileName.Length - $"mono-sgen{exeExt}".Length); - } - - throw new FileNotFoundException($"Cannot find the mono runtime executable in {monoCrossBin}"); - } - - private static IEnumerable<string> GetEnabledAndroidAbis(string[] features) - { - var androidAbis = new[] - { - "armeabi-v7a", - "arm64-v8a", - "x86", - "x86_64" - }; - - return androidAbis.Where(features.Contains); - } - - private static string GetAndroidTriple(string abi) - { - var abiArchs = new Dictionary<string, string> - { - ["armeabi-v7a"] = "armv7", - ["arm64-v8a"] = "aarch64-v8a", - ["x86"] = "i686", - ["x86_64"] = "x86_64" - }; - - string arch = abiArchs[abi]; - - return $"{arch}-linux-android"; - } - private static bool PlatformHasTemplateDir(string platform) { // OSX export templates are contained in a zip, so we place our custom template inside it and let Godot do the rest. - return !new[] { OS.Platforms.OSX, OS.Platforms.Android, OS.Platforms.HTML5 }.Contains(platform); + return !new[] { OS.Platforms.OSX, OS.Platforms.Android, OS.Platforms.iOS, OS.Platforms.HTML5 }.Contains(platform); } private static string DeterminePlatformFromFeatures(IEnumerable<string> features) @@ -665,7 +366,7 @@ namespace GodotTools.Export if (PlatformRequiresCustomBcl(platform)) throw new FileNotFoundException($"Missing BCL (Base Class Library) for platform: {platform}"); - platformBclDir = null; // Use the one we're running on + platformBclDir = typeof(object).Assembly.Location; // Use the one we're running on } } @@ -678,7 +379,7 @@ namespace GodotTools.Export /// </summary> private static bool PlatformRequiresCustomBcl(string platform) { - if (new[] { OS.Platforms.Android, OS.Platforms.HTML5 }.Contains(platform)) + if (new[] { OS.Platforms.Android, OS.Platforms.iOS, OS.Platforms.HTML5 }.Contains(platform)) return true; // The 'net_4_x' BCL is not compatible between Windows and the other platforms. @@ -707,6 +408,8 @@ namespace GodotTools.Export return "net_4_x"; case OS.Platforms.Android: return "monodroid"; + case OS.Platforms.iOS: + return "monotouch"; case OS.Platforms.HTML5: return "wasm"; default: @@ -714,14 +417,11 @@ namespace GodotTools.Export } } - private static string DataDirName + private static string DetermineDataDirNameForProject() { - get - { - var appName = (string)ProjectSettings.GetSetting("application/config/name"); - string appNameSafe = appName.ToSafeDirName(allowDirSeparator: false); - return $"data_{appNameSafe}"; - } + var appName = (string)ProjectSettings.GetSetting("application/config/name"); + string appNameSafe = appName.ToSafeDirName(allowDirSeparator: false); + return $"data_{appNameSafe}"; } [MethodImpl(MethodImplOptions.InternalCall)] diff --git a/modules/mono/editor/GodotTools/GodotTools/Export/XcodeHelper.cs b/modules/mono/editor/GodotTools/GodotTools/Export/XcodeHelper.cs new file mode 100755 index 0000000000..219b7a698a --- /dev/null +++ b/modules/mono/editor/GodotTools/GodotTools/Export/XcodeHelper.cs @@ -0,0 +1,93 @@ +using System; +using System.IO; + +namespace GodotTools.Export +{ + public static class XcodeHelper + { + private static string _XcodePath = null; + + public static string XcodePath + { + get + { + if (_XcodePath == null) + { + _XcodePath = FindXcode(); + + if (_XcodePath == null) + throw new Exception("Could not find Xcode"); + } + + return _XcodePath; + } + } + + private static string FindSelectedXcode() + { + var outputWrapper = new Godot.Collections.Array(); + + int exitCode = Godot.OS.Execute("xcode-select", new string[] { "--print-path" }, blocking: true, output: outputWrapper); + + if (exitCode == 0) + { + string output = (string)outputWrapper[0]; + return output.Trim(); + } + + Console.Error.WriteLine($"'xcode-select --print-path' exited with code: {exitCode}"); + + return null; + } + + public static string FindXcode() + { + string selectedXcode = FindSelectedXcode(); + if (selectedXcode != null) + { + if (Directory.Exists(Path.Combine(selectedXcode, "Contents", "Developer"))) + return selectedXcode; + + // The path already pointed to Contents/Developer + var dirInfo = new DirectoryInfo(selectedXcode); + if (dirInfo.Name != "Developer" || dirInfo.Parent.Name != "Contents") + { + Console.WriteLine(Path.GetDirectoryName(selectedXcode)); + Console.WriteLine(System.IO.Directory.GetParent(selectedXcode).Name); + Console.Error.WriteLine("Unrecognized path for selected Xcode"); + } + else + { + return System.IO.Path.GetFullPath($"{selectedXcode}/../.."); + } + } + else + { + Console.Error.WriteLine("Could not find the selected Xcode; trying with a hint path"); + } + + const string XcodeHintPath = "/Applications/Xcode.app"; + + if (Directory.Exists(XcodeHintPath)) + { + if (Directory.Exists(Path.Combine(XcodeHintPath, "Contents", "Developer"))) + return XcodeHintPath; + + Console.Error.WriteLine($"Found Xcode at '{XcodeHintPath}' but it's missing the 'Contents/Developer' sub-directory"); + } + + return null; + } + + public static string FindXcodeTool(string toolName) + { + string XcodeDefaultToolchain = Path.Combine(XcodePath, "Contents", "Developer", "Toolchains", "XcodeDefault.xctoolchain"); + + string path = Path.Combine(XcodeDefaultToolchain, "usr", "bin", toolName); + if (File.Exists(path)) + return path; + + throw new FileNotFoundException($"Cannot find Xcode tool: {toolName}"); + } + } +} diff --git a/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs b/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs index e6d5dd9895..afe7670165 100644 --- a/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs +++ b/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs @@ -36,6 +36,17 @@ namespace GodotTools public BottomPanel BottomPanel { get; private set; } + public static string ProjectAssemblyName + { + get + { + var projectAssemblyName = (string)ProjectSettings.GetSetting("application/config/name"); + if (string.IsNullOrEmpty(projectAssemblyName)) + projectAssemblyName = "UnnamedProject"; + return projectAssemblyName; + } + } + private bool CreateProjectSolution() { using (var pr = new EditorProgress("create_csharp_solution", "Generating solution...".TTR(), 3)) @@ -45,9 +56,7 @@ namespace GodotTools string resourceDir = ProjectSettings.GlobalizePath("res://"); string path = resourceDir; - string name = (string)ProjectSettings.GetSetting("application/config/name"); - if (name.Empty()) - name = "UnnamedProject"; + string name = ProjectAssemblyName; string guid = CsProjOperations.GenerateGameProject(path, name); diff --git a/modules/mono/editor/GodotTools/GodotTools/GodotTools.csproj b/modules/mono/editor/GodotTools/GodotTools/GodotTools.csproj index 379dfd9f7d..ac9379adf8 100644 --- a/modules/mono/editor/GodotTools/GodotTools/GodotTools.csproj +++ b/modules/mono/editor/GodotTools/GodotTools/GodotTools.csproj @@ -51,7 +51,9 @@ </ItemGroup> <ItemGroup> <Compile Include="Build\MsBuildFinder.cs" /> + <Compile Include="Export\AotBuilder.cs" /> <Compile Include="Export\ExportPlugin.cs" /> + <Compile Include="Export\XcodeHelper.cs" /> <Compile Include="ExternalEditorId.cs" /> <Compile Include="Ides\GodotIdeManager.cs" /> <Compile Include="Ides\GodotIdeServer.cs" /> diff --git a/modules/mono/editor/GodotTools/GodotTools/Utils/OS.cs b/modules/mono/editor/GodotTools/GodotTools/Utils/OS.cs index 11a4109d97..b057ac12c6 100644 --- a/modules/mono/editor/GodotTools/GodotTools/Utils/OS.cs +++ b/modules/mono/editor/GodotTools/GodotTools/Utils/OS.cs @@ -5,6 +5,7 @@ using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; using System.Runtime.CompilerServices; +using JetBrains.Annotations; namespace GodotTools.Utils { @@ -26,6 +27,7 @@ namespace GodotTools.Utils public const string UWP = "UWP"; public const string Haiku = "Haiku"; public const string Android = "Android"; + public const string iOS = "iOS"; public const string HTML5 = "HTML5"; } @@ -38,6 +40,7 @@ namespace GodotTools.Utils public const string UWP = "uwp"; public const string Haiku = "haiku"; public const string Android = "android"; + public const string iOS = "iphone"; public const string HTML5 = "javascript"; } @@ -50,6 +53,7 @@ namespace GodotTools.Utils [Names.UWP] = Platforms.UWP, [Names.Haiku] = Platforms.Haiku, [Names.Android] = Platforms.Android, + [Names.iOS] = Platforms.iOS, [Names.HTML5] = Platforms.HTML5 }; @@ -65,6 +69,7 @@ namespace GodotTools.Utils private static readonly Lazy<bool> _isUWP = new Lazy<bool>(() => IsOS(Names.UWP)); private static readonly Lazy<bool> _isHaiku = new Lazy<bool>(() => IsOS(Names.Haiku)); private static readonly Lazy<bool> _isAndroid = new Lazy<bool>(() => IsOS(Names.Android)); + private static readonly Lazy<bool> _isiOS = new Lazy<bool>(() => IsOS(Names.iOS)); private static readonly Lazy<bool> _isHTML5 = new Lazy<bool>(() => IsOS(Names.HTML5)); public static bool IsWindows => _isWindows.Value || IsUWP; @@ -74,10 +79,11 @@ namespace GodotTools.Utils public static bool IsUWP => _isUWP.Value; public static bool IsHaiku => _isHaiku.Value; public static bool IsAndroid => _isAndroid.Value; + public static bool IsiOS => _isiOS.Value; public static bool IsHTML5 => _isHTML5.Value; private static bool? _isUnixCache; - private static readonly string[] UnixLikePlatforms = { Names.OSX, Names.X11, Names.Server, Names.Haiku, Names.Android }; + private static readonly string[] UnixLikePlatforms = { Names.OSX, Names.X11, Names.Server, Names.Haiku, Names.Android, Names.iOS }; public static bool IsUnixLike() { @@ -91,12 +97,12 @@ namespace GodotTools.Utils public static char PathSep => IsWindows ? ';' : ':'; - public static string PathWhich(string name) + public static string PathWhich([NotNull] string name) { return IsWindows ? PathWhichWindows(name) : PathWhichUnix(name); } - private static string PathWhichWindows(string name) + private static string PathWhichWindows([NotNull] string name) { string[] windowsExts = Environment.GetEnvironmentVariable("PATHEXT")?.Split(PathSep) ?? new string[] { }; string[] pathDirs = Environment.GetEnvironmentVariable("PATH")?.Split(PathSep); @@ -121,7 +127,7 @@ namespace GodotTools.Utils select path + ext).FirstOrDefault(File.Exists); } - private static string PathWhichUnix(string name) + private static string PathWhichUnix([NotNull] string name) { string[] pathDirs = Environment.GetEnvironmentVariable("PATH")?.Split(PathSep); @@ -163,5 +169,33 @@ namespace GodotTools.Utils User32Dll.AllowSetForegroundWindow(process.Id); // allows application to focus itself } } + + public static int ExecuteCommand(string command, IEnumerable<string> arguments) + { + // TODO: Once we move to .NET Standard 2.1 we can use ProcessStartInfo.ArgumentList instead + string CmdLineArgsToString(IEnumerable<string> args) + { + // Not perfect, but as long as we are careful... + return string.Join(" ", args.Select(arg => arg.Contains(" ") ? $@"""{arg}""" : arg)); + } + + var startInfo = new ProcessStartInfo(command, CmdLineArgsToString(arguments)); + + Console.WriteLine($"Executing: \"{startInfo.FileName}\" {startInfo.Arguments}"); + + // Print the output + startInfo.RedirectStandardOutput = false; + startInfo.RedirectStandardError = false; + + startInfo.UseShellExecute = false; + + using (var process = new Process { StartInfo = startInfo }) + { + process.Start(); + process.WaitForExit(); + + return process.ExitCode; + } + } } } diff --git a/modules/mono/editor/godotsharp_export.cpp b/modules/mono/editor/godotsharp_export.cpp index ce0b6ad0e6..19b3bea5cf 100644 --- a/modules/mono/editor/godotsharp_export.cpp +++ b/modules/mono/editor/godotsharp_export.cpp @@ -92,7 +92,8 @@ Error get_assembly_dependencies(GDMonoAssembly *p_assembly, const Vector<String> ERR_FAIL_COND_V_MSG(!ref_assembly, ERR_CANT_RESOLVE, "Cannot load assembly (refonly): '" + ref_name + "'."); - r_dependencies[ref_name] = ref_assembly->get_path(); + // Use the path we got from the search. Don't try to get the path from the loaded assembly as we can't trust it will be from the selected BCL dir. + r_dependencies[ref_name] = path; Error err = get_assembly_dependencies(ref_assembly, p_search_dirs, r_dependencies); ERR_FAIL_COND_V_MSG(err != OK, err, "Cannot load one of the dependencies for the assembly: '" + ref_name + "'."); diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/DynamicObject.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/DynamicObject.cs index a0f105d55e..c4c911b863 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/DynamicObject.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/DynamicObject.cs @@ -23,7 +23,7 @@ namespace Godot /// <example> /// This sample shows how to use <see cref="Godot.DynamicGodotObject"/> to dynamically access the engine members of a <see cref="Godot.Object"/>. /// <code> - /// dynamic sprite = GetNode("Sprite").DynamicGodotObject; + /// dynamic sprite = GetNode("Sprite2D").DynamicGodotObject; /// sprite.add_child(this); /// /// if ((sprite.hframes * sprite.vframes) > 0) diff --git a/modules/mono/godotsharp_dirs.cpp b/modules/mono/godotsharp_dirs.cpp index 828ab73c82..fe8b925257 100644 --- a/modules/mono/godotsharp_dirs.cpp +++ b/modules/mono/godotsharp_dirs.cpp @@ -40,7 +40,7 @@ #endif #ifdef ANDROID_ENABLED -#include "mono_gd/gd_mono_android.h" +#include "mono_gd/support/mono-support.h" #endif #include "mono_gd/gd_mono.h" @@ -169,7 +169,7 @@ private: data_mono_etc_dir = data_mono_root_dir.plus_file("etc"); #ifdef ANDROID_ENABLED - data_mono_lib_dir = GDMonoAndroid::get_app_native_lib_dir(); + data_mono_lib_dir = gdmono::android::support::get_app_native_lib_dir(); #else data_mono_lib_dir = data_mono_root_dir.plus_file("lib"); #endif @@ -206,7 +206,7 @@ private: data_mono_etc_dir = data_mono_root_dir.plus_file("etc"); #ifdef ANDROID_ENABLED - data_mono_lib_dir = GDMonoAndroid::get_app_native_lib_dir(); + data_mono_lib_dir = gdmono::android::support::get_app_native_lib_dir(); #else data_mono_lib_dir = data_mono_root_dir.plus_file("lib"); data_game_assemblies_dir = data_dir_root.plus_file("Assemblies"); diff --git a/modules/mono/mono_gd/gd_mono.cpp b/modules/mono/mono_gd/gd_mono.cpp index eb4c263745..3390aaae88 100644 --- a/modules/mono/mono_gd/gd_mono.cpp +++ b/modules/mono/mono_gd/gd_mono.cpp @@ -58,7 +58,18 @@ #ifdef ANDROID_ENABLED #include "android_mono_config.h" -#include "gd_mono_android.h" +#include "support/android_support.h" +#elif defined(IPHONE_ENABLED) +#include "support/ios_support.h" +#endif + +#if defined(TOOL_ENABLED) && defined(GD_MONO_SINGLE_APPDOMAIN) +// This will no longer be the case if we replace appdomains with AssemblyLoadContext +#error "Editor build requires support for multiple appdomains" +#endif + +#if defined(GD_MONO_HOT_RELOAD) && defined(GD_MONO_SINGLE_APPDOMAIN) +#error "Hot reloading requires multiple appdomains" #endif // TODO: @@ -178,7 +189,14 @@ MonoDomain *gd_initialize_mono_runtime() { gd_mono_debug_init(); #endif - return mono_jit_init_version("GodotEngine.RootDomain", "v4.0.30319"); +#if defined(IPHONE_ENABLED) || defined(ANDROID_ENABLED) + // I don't know whether this actually matters or not + const char *runtime_version = "mobile"; +#else + const char *runtime_version = "v4.0.30319"; +#endif + + return mono_jit_init_version("GodotEngine.RootDomain", runtime_version); } #endif @@ -320,8 +338,16 @@ void GDMono::initialize() { add_mono_shared_libs_dir_to_path(); #endif +#ifdef ANDROID_ENABLED + mono_config_parse_memory(get_godot_android_mono_config().utf8().get_data()); +#else + mono_config_parse(NULL); +#endif + #if defined(ANDROID_ENABLED) - GDMonoAndroid::initialize(); + gdmono::android::support::initialize(); +#elif defined(IPHONE_ENABLED) + gdmono::ios::support::initialize(); #endif GDMonoAssembly::initialize(); @@ -330,12 +356,6 @@ void GDMono::initialize() { gd_mono_profiler_init(); #endif -#ifdef ANDROID_ENABLED - mono_config_parse_memory(get_godot_android_mono_config().utf8().get_data()); -#else - mono_config_parse(NULL); -#endif - mono_install_unhandled_exception_hook(&unhandled_exception_hook, NULL); #ifndef TOOLS_ENABLED @@ -371,15 +391,19 @@ void GDMono::initialize() { print_verbose("Mono: Runtime initialized"); #if defined(ANDROID_ENABLED) - GDMonoAndroid::register_internal_calls(); + gdmono::android::support::register_internal_calls(); #endif // mscorlib assembly MUST be present at initialization bool corlib_loaded = _load_corlib_assembly(); ERR_FAIL_COND_MSG(!corlib_loaded, "Mono: Failed to load mscorlib assembly."); +#ifndef GD_MONO_SINGLE_APPDOMAIN Error domain_load_err = _load_scripts_domain(); ERR_FAIL_COND_MSG(domain_load_err != OK, "Mono: Failed to load scripts domain."); +#else + scripts_domain = root_domain; +#endif _register_internal_calls(); @@ -491,11 +515,15 @@ void GDMono::add_assembly(uint32_t p_domain_id, GDMonoAssembly *p_assembly) { assemblies[p_domain_id][p_assembly->get_name()] = p_assembly; } -GDMonoAssembly **GDMono::get_loaded_assembly(const String &p_name) { +GDMonoAssembly *GDMono::get_loaded_assembly(const String &p_name) { + + if (p_name == "mscorlib") + return get_corlib_assembly(); MonoDomain *domain = mono_domain_get(); uint32_t domain_id = domain ? mono_domain_get_id(domain) : 0; - return assemblies[domain_id].getptr(p_name); + GDMonoAssembly **result = assemblies[domain_id].getptr(p_name); + return result ? *result : NULL; } bool GDMono::load_assembly(const String &p_name, GDMonoAssembly **r_assembly, bool p_refonly) { @@ -549,14 +577,6 @@ bool GDMono::load_assembly_from(const String &p_name, const String &p_path, GDMo if (!assembly) return false; -#ifdef DEBUG_ENABLED - uint32_t domain_id = mono_domain_get_id(mono_domain_get()); - GDMonoAssembly **stored_assembly = assemblies[domain_id].getptr(p_name); - - ERR_FAIL_COND_V(stored_assembly == NULL, false); - ERR_FAIL_COND_V(*stored_assembly != assembly, false); -#endif - *r_assembly = assembly; print_verbose("Mono: Assembly " + p_name + (p_refonly ? " (refonly)" : "") + " loaded from path: " + (*r_assembly)->get_path()); @@ -894,8 +914,8 @@ void GDMono::_load_api_assemblies() { bool api_assemblies_loaded = _try_load_api_assemblies_preset(); +#if defined(TOOLS_ENABLED) && !defined(GD_MONO_SINGLE_APPDOMAIN) if (!api_assemblies_loaded) { -#ifdef TOOLS_ENABLED // The API assemblies are out of sync or some other error happened. Fine, try one more time, but // this time update them from the prebuilt assemblies directory before trying to load them again. @@ -916,8 +936,8 @@ void GDMono::_load_api_assemblies() { // 4. Try loading the updated assemblies api_assemblies_loaded = _try_load_api_assemblies_preset(); -#endif } +#endif if (!api_assemblies_loaded) { // welp... too bad @@ -991,6 +1011,7 @@ void GDMono::_install_trace_listener() { #endif } +#ifndef GD_MONO_SINGLE_APPDOMAIN Error GDMono::_load_scripts_domain() { ERR_FAIL_COND_V(scripts_domain != NULL, ERR_BUG); @@ -1010,7 +1031,7 @@ Error GDMono::_unload_scripts_domain() { ERR_FAIL_NULL_V(scripts_domain, ERR_BUG); - print_verbose("Mono: Unloading scripts domain..."); + print_verbose("Mono: Finalizing scripts domain..."); if (mono_domain_get() != root_domain) mono_domain_set(root_domain, true); @@ -1043,6 +1064,8 @@ Error GDMono::_unload_scripts_domain() { MonoDomain *domain = scripts_domain; scripts_domain = NULL; + print_verbose("Mono: Unloading scripts domain..."); + MonoException *exc = NULL; mono_domain_try_unload(domain, (MonoObject **)&exc); @@ -1054,6 +1077,7 @@ Error GDMono::_unload_scripts_domain() { return OK; } +#endif #ifdef GD_MONO_HOT_RELOAD Error GDMono::reload_scripts_domain() { @@ -1092,6 +1116,7 @@ Error GDMono::reload_scripts_domain() { } #endif +#ifndef GD_MONO_SINGLE_APPDOMAIN Error GDMono::finalize_and_unload_domain(MonoDomain *p_domain) { CRASH_COND(p_domain == NULL); @@ -1123,6 +1148,7 @@ Error GDMono::finalize_and_unload_domain(MonoDomain *p_domain) { return OK; } +#endif GDMonoClass *GDMono::get_class(MonoClass *p_raw_class) { @@ -1150,13 +1176,17 @@ GDMonoClass *GDMono::get_class(MonoClass *p_raw_class) { GDMonoClass *GDMono::get_class(const StringName &p_namespace, const StringName &p_name) { + GDMonoClass *klass = corlib_assembly->get_class(p_namespace, p_name); + if (klass) + return klass; + uint32_t domain_id = mono_domain_get_id(mono_domain_get()); HashMap<String, GDMonoAssembly *> &domain_assemblies = assemblies[domain_id]; const String *k = NULL; while ((k = domain_assemblies.next(k))) { GDMonoAssembly *assembly = domain_assemblies.get(*k); - GDMonoClass *klass = assembly->get_class(p_namespace, p_name); + klass = assembly->get_class(p_namespace, p_name); if (klass) return klass; } @@ -1223,12 +1253,44 @@ GDMono::GDMono() { GDMono::~GDMono() { if (is_runtime_initialized()) { +#ifndef GD_MONO_SINGLE_APPDOMAIN if (scripts_domain) { Error err = _unload_scripts_domain(); if (err != OK) { ERR_PRINT("Mono: Failed to unload scripts domain."); } } +#else + CRASH_COND(scripts_domain != root_domain); + + print_verbose("Mono: Finalizing scripts domain..."); + + if (mono_domain_get() != root_domain) + mono_domain_set(root_domain, true); + + finalizing_scripts_domain = true; + + if (!mono_domain_finalize(root_domain, 2000)) { + ERR_PRINT("Mono: Domain finalization timeout."); + } + + finalizing_scripts_domain = false; + + mono_gc_collect(mono_gc_max_generation()); + + GDMonoCache::clear_godot_api_cache(); + + _domain_assemblies_cleanup(mono_domain_get_id(root_domain)); + + core_api_assembly.assembly = NULL; + + project_assembly = NULL; + + root_domain = NULL; + scripts_domain = NULL; + + // Leave the rest to 'mono_jit_cleanup' +#endif const uint32_t *k = NULL; while ((k = assemblies.next(k))) { @@ -1245,15 +1307,15 @@ GDMono::~GDMono() { mono_jit_cleanup(root_domain); -#if defined(ANDROID_ENABLED) - GDMonoAndroid::cleanup(); -#endif - print_verbose("Mono: Finalized"); runtime_initialized = false; } +#if defined(ANDROID_ENABLED) + gdmono::android::support::cleanup(); +#endif + if (gdmono_log) memdelete(gdmono_log); diff --git a/modules/mono/mono_gd/gd_mono.h b/modules/mono/mono_gd/gd_mono.h index 9528c64f8d..f7c2426734 100644 --- a/modules/mono/mono_gd/gd_mono.h +++ b/modules/mono/mono_gd/gd_mono.h @@ -144,8 +144,10 @@ private: void _register_internal_calls(); +#ifndef GD_MONO_SINGLE_APPDOMAIN Error _load_scripts_domain(); Error _unload_scripts_domain(); +#endif void _domain_assemblies_cleanup(uint32_t p_domain_id); @@ -209,7 +211,7 @@ public: // Do not use these, unless you know what you're doing void add_assembly(uint32_t p_domain_id, GDMonoAssembly *p_assembly); - GDMonoAssembly **get_loaded_assembly(const String &p_name); + GDMonoAssembly *get_loaded_assembly(const String &p_name); _FORCE_INLINE_ bool is_runtime_initialized() const { return runtime_initialized && !mono_runtime_is_shutting_down() /* stays true after shutdown finished */; } diff --git a/modules/mono/mono_gd/gd_mono_assembly.cpp b/modules/mono/mono_gd/gd_mono_assembly.cpp index 6da1db249c..a6a44fe8eb 100644 --- a/modules/mono/mono_gd/gd_mono_assembly.cpp +++ b/modules/mono/mono_gd/gd_mono_assembly.cpp @@ -42,9 +42,6 @@ #include "gd_mono_cache.h" #include "gd_mono_class.h" -bool GDMonoAssembly::no_search = false; -bool GDMonoAssembly::in_preload = false; - Vector<String> GDMonoAssembly::search_dirs; void GDMonoAssembly::fill_search_dirs(Vector<String> &r_search_dirs, const String &p_custom_config, const String &p_custom_bcl_dir) { @@ -94,19 +91,30 @@ void GDMonoAssembly::fill_search_dirs(Vector<String> &r_search_dirs, const Strin #endif } +// This is how these assembly loading hooks work: +// +// - The 'search' hook checks if the assembly has already been loaded, to avoid loading again. +// - The 'preload' hook does the actual loading and is only called if the +// 'search' hook didn't find the assembly in the list of loaded assemblies. +// - The 'load' hook is called after the assembly has been loaded. Its job is to add the +// assembly to the list of loaded assemblies so that the 'search' hook can look it up. + void GDMonoAssembly::assembly_load_hook(MonoAssembly *assembly, void *user_data) { - if (no_search) - return; - - // If our search and preload hooks fail to load the assembly themselves, the mono runtime still might. - // Just do Assembly.LoadFrom("/Full/Path/On/Disk.dll"); - // In this case, we wouldn't have the assembly known in GDMono, which causes crashes - // if any class inside the assembly is looked up by Godot. - // And causing a lookup like that is as easy as throwing an exception defined in it... - // No, we can't make the assembly load hooks smart enough because they get passed a MonoAssemblyName* only, - // not the disk path passed to say Assembly.LoadFrom(). - _wrap_mono_assembly(assembly); + String name = String::utf8(mono_assembly_name_get_name(mono_assembly_get_name(assembly))); + + MonoImage *image = mono_assembly_get_image(assembly); + + GDMonoAssembly *gdassembly = memnew(GDMonoAssembly(name, image, assembly)); + +#ifdef GD_MONO_HOT_RELOAD + const char *path = mono_image_get_filename(image); + if (FileAccess::exists(path)) + gdassembly->modified_time = FileAccess::get_modified_time(path); +#endif + + MonoDomain *domain = mono_domain_get(); + GDMono::get_singleton()->add_assembly(domain ? mono_domain_get_id(domain) : 0, gdassembly); } MonoAssembly *GDMonoAssembly::assembly_search_hook(MonoAssemblyName *aname, void *user_data) { @@ -132,71 +140,24 @@ MonoAssembly *GDMonoAssembly::_search_hook(MonoAssemblyName *aname, void *user_d String name = String::utf8(mono_assembly_name_get_name(aname)); bool has_extension = name.ends_with(".dll") || name.ends_with(".exe"); - if (no_search) - return NULL; - - GDMonoAssembly **loaded_asm = GDMono::get_singleton()->get_loaded_assembly(has_extension ? name.get_basename() : name); + GDMonoAssembly *loaded_asm = GDMono::get_singleton()->get_loaded_assembly(has_extension ? name.get_basename() : name); if (loaded_asm) - return (*loaded_asm)->get_assembly(); - - no_search = true; // Avoid the recursion madness - - GDMonoAssembly *res = _load_assembly_search(name, search_dirs, refonly); + return loaded_asm->get_assembly(); - no_search = false; - - return res ? res->get_assembly() : NULL; + return NULL; } -static thread_local MonoImage *image_corlib_loading = NULL; - MonoAssembly *GDMonoAssembly::_preload_hook(MonoAssemblyName *aname, char **, void *user_data, bool refonly) { (void)user_data; // UNUSED - { - // If we find the assembly here, we load it with 'mono_assembly_load_from_full', - // which in turn invokes load hooks before returning the MonoAssembly to us. - // One of the load hooks is 'load_aot_module'. This hook can end up calling preload hooks - // again for the same assembly in certain in certain circumstances (the 'do_load_image' part). - // If this is the case and we return NULL due to the no_search condition below, - // it will result in an internal crash later on. Therefore we need to return the assembly we didn't - // get yet from 'mono_assembly_load_from_full'. Luckily we have the image, which already got it. - // This must be done here. If done in search hooks, it would cause 'mono_assembly_load_from_full' - // to think another MonoAssembly for this assembly was already loaded, making it delete its own, - // when in fact both pointers were the same... This hooks thing is confusing. - if (image_corlib_loading) { - return mono_image_get_assembly(image_corlib_loading); - } - } - - if (no_search) - return NULL; - - no_search = true; - in_preload = true; - String name = String::utf8(mono_assembly_name_get_name(aname)); - bool has_extension = name.ends_with(".dll"); - - GDMonoAssembly *res = NULL; - if (has_extension ? name == "mscorlib.dll" : name == "mscorlib") { - GDMonoAssembly **stored_assembly = GDMono::get_singleton()->get_loaded_assembly(has_extension ? name.get_basename() : name); - if (stored_assembly) - return (*stored_assembly)->get_assembly(); - - res = _load_assembly_search("mscorlib.dll", search_dirs, refonly); - } - - no_search = false; - in_preload = false; - - return res ? res->get_assembly() : NULL; + return _load_assembly_search(name, search_dirs, refonly); } -GDMonoAssembly *GDMonoAssembly::_load_assembly_search(const String &p_name, const Vector<String> &p_search_dirs, bool p_refonly) { +MonoAssembly *GDMonoAssembly::_load_assembly_search(const String &p_name, const Vector<String> &p_search_dirs, bool p_refonly) { - GDMonoAssembly *res = NULL; + MonoAssembly *res = NULL; String path; bool has_extension = p_name.ends_with(".dll") || p_name.ends_with(".exe"); @@ -207,21 +168,21 @@ GDMonoAssembly *GDMonoAssembly::_load_assembly_search(const String &p_name, cons if (has_extension) { path = search_dir.plus_file(p_name); if (FileAccess::exists(path)) { - res = _load_assembly_from(p_name.get_basename(), path, p_refonly); + res = _real_load_assembly_from(path, p_refonly); if (res != NULL) return res; } } else { path = search_dir.plus_file(p_name + ".dll"); if (FileAccess::exists(path)) { - res = _load_assembly_from(p_name, path, p_refonly); + res = _real_load_assembly_from(path, p_refonly); if (res != NULL) return res; } path = search_dir.plus_file(p_name + ".exe"); if (FileAccess::exists(path)) { - res = _load_assembly_from(p_name, path, p_refonly); + res = _real_load_assembly_from(path, p_refonly); if (res != NULL) return res; } @@ -258,40 +219,6 @@ String GDMonoAssembly::find_assembly(const String &p_name) { return String(); } -GDMonoAssembly *GDMonoAssembly::_load_assembly_from(const String &p_name, const String &p_path, bool p_refonly) { - - GDMonoAssembly *assembly = memnew(GDMonoAssembly(p_name, p_path)); - - Error err = assembly->load(p_refonly); - - if (err != OK) { - memdelete(assembly); - ERR_FAIL_V(NULL); - } - - MonoDomain *domain = mono_domain_get(); - GDMono::get_singleton()->add_assembly(domain ? mono_domain_get_id(domain) : 0, assembly); - - return assembly; -} - -void GDMonoAssembly::_wrap_mono_assembly(MonoAssembly *assembly) { - String name = String::utf8(mono_assembly_name_get_name(mono_assembly_get_name(assembly))); - - MonoImage *image = mono_assembly_get_image(assembly); - - GDMonoAssembly *gdassembly = memnew(GDMonoAssembly(name, mono_image_get_filename(image))); - Error err = gdassembly->wrapper_for_image(image); - - if (err != OK) { - memdelete(gdassembly); - ERR_FAIL(); - } - - MonoDomain *domain = mono_domain_get(); - GDMono::get_singleton()->add_assembly(domain ? mono_domain_get_id(domain) : 0, gdassembly); -} - void GDMonoAssembly::initialize() { fill_search_dirs(search_dirs); @@ -303,46 +230,39 @@ void GDMonoAssembly::initialize() { mono_install_assembly_load_hook(&assembly_load_hook, NULL); } -Error GDMonoAssembly::load(bool p_refonly) { - - ERR_FAIL_COND_V(loaded, ERR_FILE_ALREADY_IN_USE); - - refonly = p_refonly; +MonoAssembly *GDMonoAssembly::_real_load_assembly_from(const String &p_path, bool p_refonly) { - uint64_t last_modified_time = FileAccess::get_modified_time(path); - - Vector<uint8_t> data = FileAccess::get_file_as_array(path); - ERR_FAIL_COND_V(data.empty(), ERR_FILE_CANT_READ); + Vector<uint8_t> data = FileAccess::get_file_as_array(p_path); + ERR_FAIL_COND_V_MSG(data.empty(), NULL, "Could read the assembly in the specified location"); String image_filename; #ifdef ANDROID_ENABLED - if (path.begins_with("res://")) { - image_filename = path.substr(6, path.length()); + if (p_path.begins_with("res://")) { + image_filename = p_path.substr(6, p_path.length()); } else { - image_filename = ProjectSettings::get_singleton()->globalize_path(path); + image_filename = ProjectSettings::get_singleton()->globalize_path(p_path); } #else // FIXME: globalize_path does not work on exported games - image_filename = ProjectSettings::get_singleton()->globalize_path(path); + image_filename = ProjectSettings::get_singleton()->globalize_path(p_path); #endif MonoImageOpenStatus status = MONO_IMAGE_OK; - image = mono_image_open_from_data_with_name( + MonoImage *image = mono_image_open_from_data_with_name( (char *)&data[0], data.size(), - true, &status, refonly, - image_filename.utf8().get_data()); + true, &status, p_refonly, + image_filename.utf8()); - ERR_FAIL_COND_V(status != MONO_IMAGE_OK, ERR_FILE_CANT_OPEN); - ERR_FAIL_NULL_V(image, ERR_FILE_CANT_OPEN); + ERR_FAIL_COND_V_MSG(status != MONO_IMAGE_OK || !image, NULL, "Failed to open assembly image from the loaded data"); #ifdef DEBUG_ENABLED Vector<uint8_t> pdb_data; - String pdb_path(path + ".pdb"); + String pdb_path(p_path + ".pdb"); if (!FileAccess::exists(pdb_path)) { - pdb_path = path.get_basename() + ".pdb"; // without .dll + pdb_path = p_path.get_basename() + ".pdb"; // without .dll if (!FileAccess::exists(pdb_path)) goto no_pdb; @@ -357,44 +277,21 @@ no_pdb: #endif - bool is_corlib_preload = in_preload && name == "mscorlib"; - - if (is_corlib_preload) - image_corlib_loading = image; + status = MONO_IMAGE_OK; - assembly = mono_assembly_load_from_full(image, image_filename.utf8().get_data(), &status, refonly); + MonoAssembly *assembly = mono_assembly_load_from_full(image, image_filename.utf8().get_data(), &status, p_refonly); - if (is_corlib_preload) - image_corlib_loading = NULL; - - ERR_FAIL_COND_V(status != MONO_IMAGE_OK || assembly == NULL, ERR_FILE_CANT_OPEN); + ERR_FAIL_COND_V_MSG(status != MONO_IMAGE_OK || !assembly, NULL, "Failed to load assembly for image"); // Decrement refcount which was previously incremented by mono_image_open_from_data_with_name mono_image_close(image); - loaded = true; - modified_time = last_modified_time; - - return OK; -} - -Error GDMonoAssembly::wrapper_for_image(MonoImage *p_image) { - - ERR_FAIL_COND_V(loaded, ERR_FILE_ALREADY_IN_USE); - - assembly = mono_image_get_assembly(p_image); - ERR_FAIL_NULL_V(assembly, FAILED); - - image = p_image; - - loaded = true; - - return OK; + return assembly; } void GDMonoAssembly::unload() { - ERR_FAIL_COND(!loaded); + ERR_FAIL_NULL(image); // Should not be called if already unloaded for (Map<MonoClass *, GDMonoClass *>::Element *E = cached_raw.front(); E; E = E->next()) { memdelete(E->value()); @@ -405,12 +302,15 @@ void GDMonoAssembly::unload() { assembly = NULL; image = NULL; - loaded = false; +} + +String GDMonoAssembly::get_path() const { + return String::utf8(mono_image_get_filename(image)); } GDMonoClass *GDMonoAssembly::get_class(const StringName &p_namespace, const StringName &p_name) { - ERR_FAIL_COND_V(!loaded, NULL); + ERR_FAIL_NULL_V(image, NULL); ClassKey key(p_namespace, p_name); @@ -434,7 +334,7 @@ GDMonoClass *GDMonoAssembly::get_class(const StringName &p_namespace, const Stri GDMonoClass *GDMonoAssembly::get_class(MonoClass *p_mono_class) { - ERR_FAIL_COND_V(!loaded, NULL); + ERR_FAIL_NULL_V(image, NULL); Map<MonoClass *, GDMonoClass *>::Element *match = cached_raw.find(p_mono_class); @@ -514,32 +414,38 @@ GDMonoClass *GDMonoAssembly::get_object_derived_class(const StringName &p_class) GDMonoAssembly *GDMonoAssembly::load_from(const String &p_name, const String &p_path, bool p_refonly) { - GDMonoAssembly **loaded_asm = GDMono::get_singleton()->get_loaded_assembly(p_name); - if (loaded_asm) - return *loaded_asm; -#ifdef DEBUG_ENABLED - CRASH_COND(!FileAccess::exists(p_path)); -#endif - no_search = true; - GDMonoAssembly *res = _load_assembly_from(p_name, p_path, p_refonly); - no_search = false; - return res; -} + if (p_name == "mscorlib" || p_name == "mscorlib.dll") + return GDMono::get_singleton()->get_corlib_assembly(); -GDMonoAssembly::GDMonoAssembly(const String &p_name, const String &p_path) { + // We need to manually call the search hook in this case, as it won't be called in the next step + MonoAssemblyName *aname = mono_assembly_name_new(p_name.utf8()); + MonoAssembly *assembly = mono_assembly_invoke_search_hook(aname); + mono_assembly_name_free(aname); + mono_free(aname); - loaded = false; - gdobject_class_cache_updated = false; - name = p_name; - path = p_path; - refonly = false; - modified_time = 0; - assembly = NULL; - image = NULL; + if (!assembly) { + assembly = _real_load_assembly_from(p_path, p_refonly); + ERR_FAIL_NULL_V(assembly, NULL); + } + + GDMonoAssembly *loaded_asm = GDMono::get_singleton()->get_loaded_assembly(p_name); + ERR_FAIL_NULL_V_MSG(loaded_asm, NULL, "Loaded assembly missing from table. Did we not receive the load hook?"); + + return loaded_asm; +} + +GDMonoAssembly::GDMonoAssembly(const String &p_name, MonoImage *p_image, MonoAssembly *p_assembly) : + name(p_name), + image(p_image), + assembly(p_assembly), +#ifdef GD_MONO_HOT_RELOAD + modified_time(0), +#endif + gdobject_class_cache_updated(false) { } GDMonoAssembly::~GDMonoAssembly() { - if (loaded) + if (image) unload(); } diff --git a/modules/mono/mono_gd/gd_mono_assembly.h b/modules/mono/mono_gd/gd_mono_assembly.h index 4740e10339..43c8225b74 100644 --- a/modules/mono/mono_gd/gd_mono_assembly.h +++ b/modules/mono/mono_gd/gd_mono_assembly.h @@ -68,24 +68,20 @@ class GDMonoAssembly { StringName class_name; }; - MonoAssembly *assembly; + String name; MonoImage *image; + MonoAssembly *assembly; - bool refonly; - bool loaded; - - String name; - String path; +#ifdef GD_MONO_HOT_RELOAD uint64_t modified_time; - - HashMap<ClassKey, GDMonoClass *, ClassKey::Hasher> cached_classes; - Map<MonoClass *, GDMonoClass *> cached_raw; +#endif bool gdobject_class_cache_updated; Map<StringName, GDMonoClass *> gdobject_class_cache; - static bool no_search; - static bool in_preload; + HashMap<ClassKey, GDMonoClass *, ClassKey::Hasher> cached_classes; + Map<MonoClass *, GDMonoClass *> cached_raw; + static Vector<String> search_dirs; static void assembly_load_hook(MonoAssembly *assembly, void *user_data); @@ -97,25 +93,24 @@ class GDMonoAssembly { static MonoAssembly *_search_hook(MonoAssemblyName *aname, void *user_data, bool refonly); static MonoAssembly *_preload_hook(MonoAssemblyName *aname, char **assemblies_path, void *user_data, bool refonly); - static GDMonoAssembly *_load_assembly_from(const String &p_name, const String &p_path, bool p_refonly); - static GDMonoAssembly *_load_assembly_search(const String &p_name, const Vector<String> &p_search_dirs, bool p_refonly); - static void _wrap_mono_assembly(MonoAssembly *assembly); + static MonoAssembly *_real_load_assembly_from(const String &p_path, bool p_refonly); + static MonoAssembly *_load_assembly_search(const String &p_name, const Vector<String> &p_search_dirs, bool p_refonly); friend class GDMono; static void initialize(); public: - Error load(bool p_refonly); - Error wrapper_for_image(MonoImage *p_image); void unload(); - _FORCE_INLINE_ bool is_refonly() const { return refonly; } - _FORCE_INLINE_ bool is_loaded() const { return loaded; } _FORCE_INLINE_ MonoImage *get_image() const { return image; } _FORCE_INLINE_ MonoAssembly *get_assembly() const { return assembly; } _FORCE_INLINE_ String get_name() const { return name; } - _FORCE_INLINE_ String get_path() const { return path; } + +#ifdef GD_MONO_HOT_RELOAD _FORCE_INLINE_ uint64_t get_modified_time() const { return modified_time; } +#endif + + String get_path() const; GDMonoClass *get_class(const StringName &p_namespace, const StringName &p_name); GDMonoClass *get_class(MonoClass *p_mono_class); @@ -128,7 +123,7 @@ public: static GDMonoAssembly *load_from(const String &p_name, const String &p_path, bool p_refonly); - GDMonoAssembly(const String &p_name, const String &p_path = String()); + GDMonoAssembly(const String &p_name, MonoImage *p_image, MonoAssembly *p_assembly); ~GDMonoAssembly(); }; diff --git a/modules/mono/mono_gd/gd_mono_log.cpp b/modules/mono/mono_gd/gd_mono_log.cpp index 76828a66e0..4189934570 100644 --- a/modules/mono/mono_gd/gd_mono_log.cpp +++ b/modules/mono/mono_gd/gd_mono_log.cpp @@ -48,7 +48,7 @@ static CharString get_default_log_level() { GDMonoLog *GDMonoLog::singleton = NULL; -#if !defined(JAVASCRIPT_ENABLED) +#ifdef GD_MONO_LOG_ENABLED static int get_log_level_id(const char *p_log_level) { diff --git a/modules/mono/mono_gd/gd_mono_log.h b/modules/mono/mono_gd/gd_mono_log.h index ecf4c78b1a..1fc21f7df5 100644 --- a/modules/mono/mono_gd/gd_mono_log.h +++ b/modules/mono/mono_gd/gd_mono_log.h @@ -35,13 +35,18 @@ #include "core/typedefs.h" -#if !defined(JAVASCRIPT_ENABLED) +#if !defined(JAVASCRIPT_ENABLED) && !defined(IPHONE_ENABLED) +// We have custom mono log callbacks for WASM and iOS +#define GD_MONO_LOG_ENABLED +#endif + +#ifdef GD_MONO_LOG_ENABLED #include "core/os/file_access.h" #endif class GDMonoLog { -#if !defined(JAVASCRIPT_ENABLED) +#ifdef GD_MONO_LOG_ENABLED int log_level_id; FileAccess *log_file; diff --git a/modules/mono/mono_gd/gd_mono_method_thunk.h b/modules/mono/mono_gd/gd_mono_method_thunk.h index d8c9a5eb02..614ae30947 100644 --- a/modules/mono/mono_gd/gd_mono_method_thunk.h +++ b/modules/mono/mono_gd/gd_mono_method_thunk.h @@ -39,7 +39,7 @@ #include "gd_mono_method.h" #include "gd_mono_utils.h" -#if !defined(JAVASCRIPT_ENABLED) +#if !defined(JAVASCRIPT_ENABLED) && !defined(IPHONE_ENABLED) #define HAVE_METHOD_THUNKS #endif diff --git a/modules/mono/mono_gd/gd_mono_utils.cpp b/modules/mono/mono_gd/gd_mono_utils.cpp index cdb26ae61b..5a2bdffe54 100644 --- a/modules/mono/mono_gd/gd_mono_utils.cpp +++ b/modules/mono/mono_gd/gd_mono_utils.cpp @@ -129,7 +129,12 @@ void set_main_thread(MonoThread *p_thread) { MonoThread *attach_current_thread() { ERR_FAIL_COND_V(!GDMono::get_singleton()->is_runtime_initialized(), NULL); MonoDomain *scripts_domain = GDMono::get_singleton()->get_scripts_domain(); +#ifndef GD_MONO_SINGLE_APPDOMAIN MonoThread *mono_thread = mono_thread_attach(scripts_domain ? scripts_domain : mono_get_root_domain()); +#else + // The scripts domain is the root domain + MonoThread *mono_thread = mono_thread_attach(scripts_domain); +#endif ERR_FAIL_NULL_V(mono_thread, NULL); return mono_thread; } diff --git a/modules/mono/mono_gd/gd_mono_android.cpp b/modules/mono/mono_gd/support/android_support.cpp index 761368878f..222b50730d 100644..100755 --- a/modules/mono/mono_gd/gd_mono_android.cpp +++ b/modules/mono/mono_gd/support/android_support.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* gd_mono_android.cpp */ +/* android_support.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,7 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "gd_mono_android.h" +#include "android_support.h" #if defined(ANDROID_ENABLED) @@ -49,14 +49,16 @@ #include "platform/android/os_android.h" #include "platform/android/thread_jandroid.h" -#include "../utils/path_utils.h" -#include "../utils/string_utils.h" -#include "gd_mono_cache.h" -#include "gd_mono_marshal.h" +#include "../../utils/path_utils.h" +#include "../../utils/string_utils.h" +#include "../gd_mono_cache.h" +#include "../gd_mono_marshal.h" // Warning: JNI boilerplate ahead... continue at your own risk -namespace GDMonoAndroid { +namespace gdmono { +namespace android { +namespace support { template <typename T> struct ScopedLocalRef { @@ -150,11 +152,11 @@ int gd_mono_convert_dl_flags(int flags) { return lflags; } -#ifndef GD_MONO_ANDROID_SO_NAME -#define GD_MONO_ANDROID_SO_NAME "libmonosgen-2.0.so" +#ifndef GD_MONO_SO_NAME +#define GD_MONO_SO_NAME "libmonosgen-2.0.so" #endif -const char *mono_so_name = GD_MONO_ANDROID_SO_NAME; +const char *mono_so_name = GD_MONO_SO_NAME; const char *godot_so_name = "libgodot_android.so"; void *mono_dl_handle = NULL; @@ -352,6 +354,11 @@ MonoArray *_gd_mono_android_cert_store_lookup(MonoString *p_alias) { return encoded_ret; } +void register_internal_calls() { + mono_add_internal_call("Android.Runtime.AndroidEnvironment::_gd_mono_init_cert_store", (void *)_gd_mono_init_cert_store); + mono_add_internal_call("Android.Runtime.AndroidEnvironment::_gd_mono_android_cert_store_lookup", (void *)_gd_mono_android_cert_store_lookup); +} + void initialize() { // We need to set this environment variable to make the monodroid BCL use btls instead of legacy as the default provider OS::get_singleton()->set_environment("XA_TLS_PROVIDER", "btls"); @@ -364,11 +371,6 @@ void initialize() { godot_dl_handle = try_dlopen(so_path, gd_mono_convert_dl_flags(MONO_DL_LAZY)); } -void register_internal_calls() { - mono_add_internal_call("Android.Runtime.AndroidEnvironment::_gd_mono_init_cert_store", (void *)_gd_mono_init_cert_store); - mono_add_internal_call("Android.Runtime.AndroidEnvironment::_gd_mono_android_cert_store_lookup", (void *)_gd_mono_android_cert_store_lookup); -} - void cleanup() { // This is called after shutting down the Mono runtime @@ -386,9 +388,11 @@ void cleanup() { } } -} // namespace GDMonoAndroid +} // namespace support +} // namespace android +} // namespace gdmono -using namespace GDMonoAndroid; +using namespace gdmono::android::support; // The following are P/Invoke functions required by the monodroid profile of the BCL. // These are P/Invoke functions and not internal calls, hence why they use diff --git a/modules/mono/mono_gd/gd_mono_android.h b/modules/mono/mono_gd/support/android_support.h index 0e04847924..dc2e6c95ed 100644..100755 --- a/modules/mono/mono_gd/gd_mono_android.h +++ b/modules/mono/mono_gd/support/android_support.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* gd_mono_android.h */ +/* android_support.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,25 +28,28 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef GD_MONO_ANDROID_H -#define GD_MONO_ANDROID_H +#ifndef ANDROID_SUPPORT_H +#define ANDROID_SUPPORT_H #if defined(ANDROID_ENABLED) #include "core/ustring.h" -namespace GDMonoAndroid { +namespace gdmono { +namespace android { +namespace support { String get_app_native_lib_dir(); void initialize(); +void cleanup(); void register_internal_calls(); -void cleanup(); - -} // namespace GDMonoAndroid +} // namespace support +} // namespace android +} // namespace gdmono #endif // ANDROID_ENABLED -#endif // GD_MONO_ANDROID_H +#endif // ANDROID_SUPPORT_H diff --git a/modules/mono/mono_gd/support/ios_support.h b/modules/mono/mono_gd/support/ios_support.h new file mode 100755 index 0000000000..e28af120e3 --- /dev/null +++ b/modules/mono/mono_gd/support/ios_support.h @@ -0,0 +1,51 @@ +/*************************************************************************/ +/* ios_support.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#ifndef IOS_SUPPORT_H +#define IOS_SUPPORT_H + +#if defined(IPHONE_ENABLED) + +#include "core/ustring.h" + +namespace gdmono { +namespace ios { +namespace support { + +void initialize(); +void cleanup(); + +} // namespace support +} // namespace ios +} // namespace gdmono + +#endif // IPHONE_ENABLED + +#endif // IOS_SUPPORT_H diff --git a/modules/mono/mono_gd/support/ios_support.mm b/modules/mono/mono_gd/support/ios_support.mm new file mode 100755 index 0000000000..e3d1a647fd --- /dev/null +++ b/modules/mono/mono_gd/support/ios_support.mm @@ -0,0 +1,151 @@ +/*************************************************************************/ +/* ios_support.mm */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#include "ios_support.h" + +#if defined(IPHONE_ENABLED) + +#import <Foundation/Foundation.h> +#include <os/log.h> + +#include "core/ustring.h" + +#include "../gd_mono_marshal.h" + +// Implemented mostly following: https://github.com/mono/mono/blob/master/sdks/ios/app/runtime.m + +// Definition generated by the Godot exporter +extern "C" void gd_mono_setup_aot(); + +namespace gdmono { +namespace ios { +namespace support { + +void ios_mono_log_callback(const char *log_domain, const char *log_level, const char *message, mono_bool fatal, void *user_data) { + os_log_info(OS_LOG_DEFAULT, "(%s %s) %s", log_domain, log_level, message); + if (fatal) { + os_log_info(OS_LOG_DEFAULT, "Exit code: %d.", 1); + exit(1); + } +} + +void initialize() { + mono_dllmap_insert(NULL, "System.Native", NULL, "__Internal", NULL); + mono_dllmap_insert(NULL, "System.IO.Compression.Native", NULL, "__Internal", NULL); + mono_dllmap_insert(NULL, "System.Security.Cryptography.Native.Apple", NULL, "__Internal", NULL); + +#ifdef IOS_DEVICE + // This function is defined in an auto-generated source file + gd_mono_setup_aot(); +#endif + + mono_set_signal_chaining(true); + mono_set_crash_chaining(true); +} + +void cleanup() { +} + +} // namespace support +} // namespace ios +} // namespace gdmono + +// The following are P/Invoke functions required by the monotouch profile of the BCL. +// These are P/Invoke functions and not internal calls, hence why they use +// 'mono_bool' and 'const char*' instead of 'MonoBoolean' and 'MonoString*'. + +#define GD_PINVOKE_EXPORT extern "C" __attribute__((visibility("default"))) + +GD_PINVOKE_EXPORT const char *xamarin_get_locale_country_code() { + NSLocale *locale = [NSLocale currentLocale]; + NSString *countryCode = [locale objectForKey:NSLocaleCountryCode]; + if (countryCode == NULL) { + return strdup("US"); + } + return strdup([countryCode UTF8String]); +} + +GD_PINVOKE_EXPORT void xamarin_log(const uint16_t *p_unicode_message) { + int length = 0; + const uint16_t *ptr = p_unicode_message; + while (*ptr++) + length += sizeof(uint16_t); + NSString *msg = [[NSString alloc] initWithBytes:p_unicode_message length:length encoding:NSUTF16LittleEndianStringEncoding]; + + os_log_info(OS_LOG_DEFAULT, "%{public}@", msg); +} + +GD_PINVOKE_EXPORT const char *xamarin_GetFolderPath(int p_folder) { + NSSearchPathDirectory dd = (NSSearchPathDirectory)p_folder; + NSURL *url = [[[NSFileManager defaultManager] URLsForDirectory:dd inDomains:NSUserDomainMask] lastObject]; + NSString *path = [url path]; + return strdup([path UTF8String]); +} + +GD_PINVOKE_EXPORT char *xamarin_timezone_get_local_name() { + NSTimeZone *tz = nil; + tz = [NSTimeZone localTimeZone]; + NSString *name = [tz name]; + return (name != nil) ? strdup([name UTF8String]) : strdup("Local"); +} + +GD_PINVOKE_EXPORT char **xamarin_timezone_get_names(uint32_t *p_count) { + NSArray *array = [NSTimeZone knownTimeZoneNames]; + *p_count = array.count; + char **result = (char **)malloc(sizeof(char *) * (*p_count)); + for (uint32_t i = 0; i < *p_count; i++) { + NSString *s = [array objectAtIndex:i]; + result[i] = strdup(s.UTF8String); + } + return result; +} + +GD_PINVOKE_EXPORT void *xamarin_timezone_get_data(const char *p_name, uint32_t *p_size) { // FIXME: uint32_t since Dec 2019, unsigned long before + NSTimeZone *tz = nil; + if (p_name) { + NSString *n = [[NSString alloc] initWithUTF8String:p_name]; + tz = [[[NSTimeZone alloc] initWithName:n] autorelease]; + [n release]; + } else { + tz = [NSTimeZone localTimeZone]; + } + NSData *data = [tz data]; + *p_size = [data length]; + void *result = malloc(*p_size); + memcpy(result, data.bytes, *p_size); + return result; +} + +GD_PINVOKE_EXPORT void xamarin_start_wwan(const char *p_uri) { + // FIXME: What's this for? No idea how to implement. + os_log_error(OS_LOG_DEFAULT, "Not implemented: 'xamarin_start_wwan'"); +} + +#endif // IPHONE_ENABLED diff --git a/modules/ogg/SCsub b/modules/ogg/SCsub index 44c7963cd3..e768fb4ae8 100644 --- a/modules/ogg/SCsub +++ b/modules/ogg/SCsub @@ -1,7 +1,7 @@ #!/usr/bin/env python -Import('env') -Import('env_modules') +Import("env") +Import("env_modules") # Only kept to build the thirdparty library used by the theora and webm # modules. @@ -9,7 +9,7 @@ Import('env_modules') env_ogg = env_modules.Clone() # Thirdparty source files -if env['builtin_libogg']: +if env["builtin_libogg"]: thirdparty_dir = "#thirdparty/libogg/" thirdparty_sources = [ "bitwise.c", diff --git a/modules/ogg/config.py b/modules/ogg/config.py index 1c8cd12a2d..d22f9454ed 100644 --- a/modules/ogg/config.py +++ b/modules/ogg/config.py @@ -1,5 +1,6 @@ def can_build(env, platform): return True + def configure(env): pass diff --git a/modules/opensimplex/SCsub b/modules/opensimplex/SCsub index 311d33b047..52d8b145ef 100644 --- a/modules/opensimplex/SCsub +++ b/modules/opensimplex/SCsub @@ -1,7 +1,7 @@ #!/usr/bin/env python -Import('env') -Import('env_modules') +Import("env") +Import("env_modules") env_opensimplex = env_modules.Clone() diff --git a/modules/opensimplex/config.py b/modules/opensimplex/config.py index c1010ad433..90b85dbd70 100644 --- a/modules/opensimplex/config.py +++ b/modules/opensimplex/config.py @@ -1,14 +1,17 @@ def can_build(env, platform): - return True + return True + def configure(env): - pass + pass + def get_doc_classes(): return [ "NoiseTexture", - "OpenSimplexNoise" + "OpenSimplexNoise", ] + def get_doc_path(): return "doc_classes" diff --git a/modules/opus/SCsub b/modules/opus/SCsub index fec2911d6d..e51590d808 100644 --- a/modules/opus/SCsub +++ b/modules/opus/SCsub @@ -1,7 +1,7 @@ #!/usr/bin/env python -Import('env') -Import('env_modules') +Import("env") +Import("env_modules") # Only kept to build the thirdparty library used by the webm module. # AudioStreamOpus was dropped in 3.0 due to incompatibility with the new audio @@ -10,11 +10,10 @@ Import('env_modules') env_opus = env_modules.Clone() # Thirdparty source files -if env['builtin_opus']: +if env["builtin_opus"]: thirdparty_dir = "#thirdparty/opus/" thirdparty_sources = [ - # Sync with opus_sources.mk "opus.c", "opus_decoder.c", @@ -23,17 +22,14 @@ if env['builtin_opus']: "opus_multistream_encoder.c", "opus_multistream_decoder.c", "repacketizer.c", - "analysis.c", "mlp.c", "mlp_data.c", - # Sync with libopusfile Makefile.am "info.c", "internal.c", "opusfile.c", "stream.c", - # Sync with celt_sources.mk "celt/bands.c", "celt/celt.c", @@ -53,12 +49,11 @@ if env['builtin_opus']: "celt/quant_bands.c", "celt/rate.c", "celt/vq.c", - #"celt/arm/arm_celt_map.c", - #"celt/arm/armcpu.c", - #"celt/arm/celt_ne10_fft.c", - #"celt/arm/celt_ne10_mdct.c", - #"celt/arm/celt_neon_intr.c", - + # "celt/arm/arm_celt_map.c", + # "celt/arm/armcpu.c", + # "celt/arm/celt_ne10_fft.c", + # "celt/arm/celt_ne10_mdct.c", + # "celt/arm/celt_neon_intr.c", # Sync with silk_sources.mk "silk/CNG.c", "silk/code_signs.c", @@ -207,7 +202,7 @@ if env['builtin_opus']: thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources + opus_sources_silk] # also requires libogg - if env['builtin_libogg']: + if env["builtin_libogg"]: env_opus.Prepend(CPPPATH=["#thirdparty/libogg"]) env_opus.Append(CPPDEFINES=["HAVE_CONFIG_H"]) @@ -223,14 +218,14 @@ if env['builtin_opus']: env_opus.Prepend(CPPPATH=[thirdparty_dir + "/" + dir for dir in thirdparty_include_paths]) if env["platform"] == "android": - if ("android_arch" in env and env["android_arch"] == "armv7"): + if "android_arch" in env and env["android_arch"] == "armv7": env_opus.Append(CPPDEFINES=["OPUS_ARM_OPT"]) - elif ("android_arch" in env and env["android_arch"] == "arm64v8"): + elif "android_arch" in env and env["android_arch"] == "arm64v8": env_opus.Append(CPPDEFINES=["OPUS_ARM64_OPT"]) elif env["platform"] == "iphone": - if ("arch" in env and env["arch"] == "arm"): + if "arch" in env and env["arch"] == "arm": env_opus.Append(CPPDEFINES=["OPUS_ARM_OPT"]) - elif ("arch" in env and env["arch"] == "arm64"): + elif "arch" in env and env["arch"] == "arm64": env_opus.Append(CPPDEFINES=["OPUS_ARM64_OPT"]) env_thirdparty = env_opus.Clone() diff --git a/modules/opus/config.py b/modules/opus/config.py index 1c8cd12a2d..d22f9454ed 100644 --- a/modules/opus/config.py +++ b/modules/opus/config.py @@ -1,5 +1,6 @@ def can_build(env, platform): return True + def configure(env): pass diff --git a/modules/pvr/SCsub b/modules/pvr/SCsub index 18da38fbbd..e0baf851f1 100644 --- a/modules/pvr/SCsub +++ b/modules/pvr/SCsub @@ -1,7 +1,7 @@ #!/usr/bin/env python -Import('env') -Import('env_modules') +Import("env") +Import("env_modules") env_pvr = env_modules.Clone() diff --git a/modules/pvr/config.py b/modules/pvr/config.py index 1c8cd12a2d..d22f9454ed 100644 --- a/modules/pvr/config.py +++ b/modules/pvr/config.py @@ -1,5 +1,6 @@ def can_build(env, platform): return True + def configure(env): pass diff --git a/modules/regex/SCsub b/modules/regex/SCsub index 6238cd3d9f..753650adcb 100644 --- a/modules/regex/SCsub +++ b/modules/regex/SCsub @@ -1,16 +1,16 @@ #!/usr/bin/env python -Import('env') -Import('env_modules') +Import("env") +Import("env_modules") env_regex = env_modules.Clone() -if env['builtin_pcre2']: - thirdparty_dir = '#thirdparty/pcre2/src/' - thirdparty_flags = ['PCRE2_STATIC', 'HAVE_CONFIG_H'] +if env["builtin_pcre2"]: + thirdparty_dir = "#thirdparty/pcre2/src/" + thirdparty_flags = ["PCRE2_STATIC", "HAVE_CONFIG_H"] - if env['builtin_pcre2_with_jit']: - thirdparty_flags.append('SUPPORT_JIT') + if env["builtin_pcre2_with_jit"]: + thirdparty_flags.append("SUPPORT_JIT") thirdparty_sources = [ "pcre2_auto_possess.c", @@ -24,7 +24,7 @@ if env['builtin_pcre2']: "pcre2_extuni.c", "pcre2_find_bracket.c", "pcre2_jit_compile.c", - #"pcre2_jit_match.c", "pcre2_jit_misc.c", # these files are included in pcre2_jit_compile.c. + # "pcre2_jit_match.c", "pcre2_jit_misc.c", # these files are included in pcre2_jit_compile.c. "pcre2_maketables.c", "pcre2_match.c", "pcre2_match_data.c", diff --git a/modules/regex/config.py b/modules/regex/config.py index 42cfe3b43c..df9f44cb95 100644 --- a/modules/regex/config.py +++ b/modules/regex/config.py @@ -1,14 +1,17 @@ def can_build(env, platform): return True + def configure(env): pass + def get_doc_classes(): return [ "RegEx", "RegExMatch", ] + def get_doc_path(): return "doc_classes" diff --git a/modules/squish/SCsub b/modules/squish/SCsub index 15320bcd0c..b31032403f 100644 --- a/modules/squish/SCsub +++ b/modules/squish/SCsub @@ -1,12 +1,12 @@ #!/usr/bin/env python -Import('env') -Import('env_modules') +Import("env") +Import("env_modules") env_squish = env_modules.Clone() # Thirdparty source files -if env['builtin_squish']: +if env["builtin_squish"]: thirdparty_dir = "#thirdparty/squish/" thirdparty_sources = [ "alpha.cpp", diff --git a/modules/squish/config.py b/modules/squish/config.py index 1c8cd12a2d..d22f9454ed 100644 --- a/modules/squish/config.py +++ b/modules/squish/config.py @@ -1,5 +1,6 @@ def can_build(env, platform): return True + def configure(env): pass diff --git a/modules/stb_vorbis/SCsub b/modules/stb_vorbis/SCsub index d14939a3b1..266c87c802 100644 --- a/modules/stb_vorbis/SCsub +++ b/modules/stb_vorbis/SCsub @@ -1,7 +1,7 @@ #!/usr/bin/env python -Import('env') -Import('env_modules') +Import("env") +Import("env_modules") env_stb_vorbis = env_modules.Clone() diff --git a/modules/stb_vorbis/config.py b/modules/stb_vorbis/config.py index 200b8dfd50..1eb0a8cf33 100644 --- a/modules/stb_vorbis/config.py +++ b/modules/stb_vorbis/config.py @@ -1,13 +1,16 @@ def can_build(env, platform): return True + def configure(env): pass + def get_doc_classes(): return [ "AudioStreamOGGVorbis", ] + def get_doc_path(): return "doc_classes" diff --git a/modules/svg/SCsub b/modules/svg/SCsub index 7961d1f33e..0bfba34fe5 100644 --- a/modules/svg/SCsub +++ b/modules/svg/SCsub @@ -1,14 +1,14 @@ #!/usr/bin/env python -Import('env') -Import('env_modules') +Import("env") +Import("env_modules") env_svg = env_modules.Clone() # Thirdparty source files thirdparty_dir = "#thirdparty/nanosvg/" thirdparty_sources = [ - "nanosvg.cc" + "nanosvg.cc", ] thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] diff --git a/modules/svg/config.py b/modules/svg/config.py index 1c8cd12a2d..d22f9454ed 100644 --- a/modules/svg/config.py +++ b/modules/svg/config.py @@ -1,5 +1,6 @@ def can_build(env, platform): return True + def configure(env): pass diff --git a/modules/tga/SCsub b/modules/tga/SCsub index 7e405f405c..067caa6ea0 100644 --- a/modules/tga/SCsub +++ b/modules/tga/SCsub @@ -1,7 +1,7 @@ #!/usr/bin/env python -Import('env') -Import('env_modules') +Import("env") +Import("env_modules") env_tga = env_modules.Clone() diff --git a/modules/tga/config.py b/modules/tga/config.py index 1c8cd12a2d..d22f9454ed 100644 --- a/modules/tga/config.py +++ b/modules/tga/config.py @@ -1,5 +1,6 @@ def can_build(env, platform): return True + def configure(env): pass diff --git a/modules/theora/SCsub b/modules/theora/SCsub index ff65d2f8ec..a01e65b4b0 100644 --- a/modules/theora/SCsub +++ b/modules/theora/SCsub @@ -1,71 +1,71 @@ #!/usr/bin/env python -Import('env') -Import('env_modules') +Import("env") +Import("env_modules") env_theora = env_modules.Clone() # Thirdparty source files -if env['builtin_libtheora']: +if env["builtin_libtheora"]: thirdparty_dir = "#thirdparty/libtheora/" thirdparty_sources = [ - #"analyze.c", - #"apiwrapper.c", + # "analyze.c", + # "apiwrapper.c", "bitpack.c", "cpu.c", - #"decapiwrapper.c", + # "decapiwrapper.c", "decinfo.c", "decode.c", "dequant.c", - #"encapiwrapper.c", - #"encfrag.c", - #"encinfo.c", - #"encode.c", - #"encoder_disabled.c", - #"enquant.c", - #"fdct.c", + # "encapiwrapper.c", + # "encfrag.c", + # "encinfo.c", + # "encode.c", + # "encoder_disabled.c", + # "enquant.c", + # "fdct.c", "fragment.c", "huffdec.c", - #"huffenc.c", + # "huffenc.c", "idct.c", "info.c", "internal.c", - #"mathops.c", - #"mcenc.c", + # "mathops.c", + # "mcenc.c", "quant.c", - #"rate.c", + # "rate.c", "state.c", - #"tokenize.c", + # "tokenize.c", ] thirdparty_sources_x86 = [ - #"x86/mmxencfrag.c", - #"x86/mmxfdct.c", + # "x86/mmxencfrag.c", + # "x86/mmxfdct.c", "x86/mmxfrag.c", "x86/mmxidct.c", "x86/mmxstate.c", - #"x86/sse2fdct.c", - #"x86/x86enc.c", + # "x86/sse2fdct.c", + # "x86/x86enc.c", "x86/x86state.c", ] thirdparty_sources_x86_vc = [ - #"x86_vc/mmxencfrag.c", - #"x86_vc/mmxfdct.c", + # "x86_vc/mmxencfrag.c", + # "x86_vc/mmxfdct.c", "x86_vc/mmxfrag.c", "x86_vc/mmxidct.c", "x86_vc/mmxstate.c", - #"x86_vc/x86enc.c", + # "x86_vc/x86enc.c", "x86_vc/x86state.c", ] - if (env["x86_libtheora_opt_gcc"]): + if env["x86_libtheora_opt_gcc"]: thirdparty_sources += thirdparty_sources_x86 - if (env["x86_libtheora_opt_vc"]): + if env["x86_libtheora_opt_vc"]: thirdparty_sources += thirdparty_sources_x86_vc - if (env["x86_libtheora_opt_gcc"] or env["x86_libtheora_opt_vc"]): + if env["x86_libtheora_opt_gcc"] or env["x86_libtheora_opt_vc"]: env_theora.Append(CPPDEFINES=["OC_X86_ASM"]) thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] @@ -73,9 +73,9 @@ if env['builtin_libtheora']: env_theora.Prepend(CPPPATH=[thirdparty_dir]) # also requires libogg and libvorbis - if env['builtin_libogg']: + if env["builtin_libogg"]: env_theora.Prepend(CPPPATH=["#thirdparty/libogg"]) - if env['builtin_libvorbis']: + if env["builtin_libvorbis"]: env_theora.Prepend(CPPPATH=["#thirdparty/libvorbis"]) env_thirdparty = env_theora.Clone() diff --git a/modules/theora/config.py b/modules/theora/config.py index c7713d7607..413acce2df 100644 --- a/modules/theora/config.py +++ b/modules/theora/config.py @@ -1,13 +1,16 @@ def can_build(env, platform): return True + def configure(env): pass + def get_doc_classes(): return [ "VideoStreamTheora", ] + def get_doc_path(): return "doc_classes" diff --git a/modules/tinyexr/SCsub b/modules/tinyexr/SCsub index 97f9797b58..e7fd44fabd 100644 --- a/modules/tinyexr/SCsub +++ b/modules/tinyexr/SCsub @@ -1,7 +1,7 @@ #!/usr/bin/env python -Import('env') -Import('env_modules') +Import("env") +Import("env_modules") env_tinyexr = env_modules.Clone() diff --git a/modules/tinyexr/config.py b/modules/tinyexr/config.py index 098f1eafa9..53b8f2f2e3 100644 --- a/modules/tinyexr/config.py +++ b/modules/tinyexr/config.py @@ -1,5 +1,6 @@ def can_build(env, platform): - return env['tools'] + return env["tools"] + def configure(env): pass diff --git a/modules/upnp/SCsub b/modules/upnp/SCsub index 3f56a69594..2e129e15ca 100644 --- a/modules/upnp/SCsub +++ b/modules/upnp/SCsub @@ -1,13 +1,13 @@ #!/usr/bin/env python -Import('env') -Import('env_modules') +Import("env") +Import("env_modules") env_upnp = env_modules.Clone() # Thirdparty source files -if env['builtin_miniupnpc']: +if env["builtin_miniupnpc"]: thirdparty_dir = "#thirdparty/miniupnpc/" thirdparty_sources = [ "miniupnpc.c", diff --git a/modules/upnp/config.py b/modules/upnp/config.py index 8724ff1a51..3e15b940a1 100644 --- a/modules/upnp/config.py +++ b/modules/upnp/config.py @@ -1,14 +1,17 @@ def can_build(env, platform): return True + def configure(env): pass + def get_doc_classes(): return [ "UPNP", - "UPNPDevice" + "UPNPDevice", ] + def get_doc_path(): return "doc_classes" diff --git a/modules/vhacd/SCsub b/modules/vhacd/SCsub index 685976dc33..ecd432b275 100644 --- a/modules/vhacd/SCsub +++ b/modules/vhacd/SCsub @@ -1,7 +1,7 @@ #!/usr/bin/env python -Import('env') -Import('env_modules') +Import("env") +Import("env_modules") env_vhacd = env_modules.Clone() @@ -19,7 +19,7 @@ thirdparty_sources = [ "src/btAlignedAllocator.cpp", "src/vhacdRaycastMesh.cpp", "src/VHACD.cpp", - "src/btConvexHullComputer.cpp" + "src/btConvexHullComputer.cpp", ] thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] diff --git a/modules/vhacd/config.py b/modules/vhacd/config.py index 9ced70d2fb..d22f9454ed 100644 --- a/modules/vhacd/config.py +++ b/modules/vhacd/config.py @@ -1,6 +1,6 @@ def can_build(env, platform): return True + def configure(env): pass - diff --git a/modules/visual_script/SCsub b/modules/visual_script/SCsub index 3c3d2caa57..16faea08d7 100644 --- a/modules/visual_script/SCsub +++ b/modules/visual_script/SCsub @@ -1,7 +1,7 @@ #!/usr/bin/env python -Import('env') -Import('env_modules') +Import("env") +Import("env_modules") env_vs = env_modules.Clone() diff --git a/modules/visual_script/config.py b/modules/visual_script/config.py index 087a13a200..bd459ca344 100644 --- a/modules/visual_script/config.py +++ b/modules/visual_script/config.py @@ -1,9 +1,11 @@ def can_build(env, platform): return True + def configure(env): pass + def get_doc_classes(): return [ "@VisualScript", @@ -56,5 +58,6 @@ def get_doc_classes(): "VisualScriptYield", ] + def get_doc_path(): return "doc_classes" diff --git a/modules/vorbis/SCsub b/modules/vorbis/SCsub index bde4359595..05d46757d3 100644 --- a/modules/vorbis/SCsub +++ b/modules/vorbis/SCsub @@ -1,7 +1,7 @@ #!/usr/bin/env python -Import('env') -Import('env_modules') +Import("env") +Import("env_modules") # Only kept to build the thirdparty library used by the theora and webm # modules. We now use stb_vorbis for AudioStreamOGGVorbis. @@ -11,11 +11,11 @@ env_vorbis = env_modules.Clone() stub = True # Thirdparty source files -if env['builtin_libvorbis']: +if env["builtin_libvorbis"]: thirdparty_dir = "#thirdparty/libvorbis/" thirdparty_sources = [ - #"analysis.c", - #"barkmel.c", + # "analysis.c", + # "barkmel.c", "bitrate.c", "block.c", "codebook.c", @@ -29,14 +29,14 @@ if env['builtin_libvorbis']: "mapping0.c", "mdct.c", "psy.c", - #"psytune.c", + # "psytune.c", "registry.c", "res0.c", "sharedbook.c", "smallft.c", "synthesis.c", - #"tone.c", - #"vorbisenc.c", + # "tone.c", + # "vorbisenc.c", "vorbisfile.c", "window.c", ] @@ -46,7 +46,7 @@ if env['builtin_libvorbis']: env_vorbis.Prepend(CPPPATH=[thirdparty_dir]) # also requires libogg - if env['builtin_libogg']: + if env["builtin_libogg"]: env_vorbis.Prepend(CPPPATH=["#thirdparty/libogg"]) env_thirdparty = env_vorbis.Clone() diff --git a/modules/vorbis/config.py b/modules/vorbis/config.py index 1c8cd12a2d..d22f9454ed 100644 --- a/modules/vorbis/config.py +++ b/modules/vorbis/config.py @@ -1,5 +1,6 @@ def can_build(env, platform): return True + def configure(env): pass diff --git a/modules/webm/SCsub b/modules/webm/SCsub index 32e6727656..247b4ead37 100644 --- a/modules/webm/SCsub +++ b/modules/webm/SCsub @@ -1,7 +1,7 @@ #!/usr/bin/env python -Import('env') -Import('env_modules') +Import("env") +Import("env_modules") env_webm = env_modules.Clone() @@ -18,14 +18,14 @@ thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] env_webm.Prepend(CPPPATH=[thirdparty_dir, thirdparty_dir + "libwebm/"]) # also requires libogg, libvorbis and libopus -if env['builtin_libogg']: +if env["builtin_libogg"]: env_webm.Prepend(CPPPATH=["#thirdparty/libogg"]) -if env['builtin_libvorbis']: +if env["builtin_libvorbis"]: env_webm.Prepend(CPPPATH=["#thirdparty/libvorbis"]) -if env['builtin_opus']: +if env["builtin_opus"]: env_webm.Prepend(CPPPATH=["#thirdparty/opus"]) -if env['builtin_libvpx']: +if env["builtin_libvpx"]: env_webm.Prepend(CPPPATH=["#thirdparty/libvpx"]) SConscript("libvpx/SCsub") diff --git a/modules/webm/config.py b/modules/webm/config.py index ba4dcce2f5..93b49d177a 100644 --- a/modules/webm/config.py +++ b/modules/webm/config.py @@ -1,13 +1,16 @@ def can_build(env, platform): - return platform not in ['iphone'] + return platform not in ["iphone"] + def configure(env): pass + def get_doc_classes(): return [ "VideoStreamWebm", ] + def get_doc_path(): return "doc_classes" diff --git a/modules/webm/libvpx/SCsub b/modules/webm/libvpx/SCsub index 6aed8a16f5..dd6866ad0e 100644 --- a/modules/webm/libvpx/SCsub +++ b/modules/webm/libvpx/SCsub @@ -1,7 +1,7 @@ #!/usr/bin/env python -Import('env') -Import('env_modules') +Import("env") +Import("env_modules") # Thirdparty sources @@ -9,9 +9,7 @@ libvpx_dir = "#thirdparty/libvpx/" libvpx_sources = [ "vp8/vp8_dx_iface.c", - "vp8/common/generic/systemdependent.c", - "vp8/common/alloccommon.c", "vp8/common/blockd.c", "vp8/common/copy_c.c", @@ -37,16 +35,12 @@ libvpx_sources = [ "vp8/common/swapyv12buffer.c", "vp8/common/treecoder.c", "vp8/common/vp8_loopfilter.c", - "vp8/decoder/dboolhuff.c", "vp8/decoder/decodeframe.c", "vp8/decoder/decodemv.c", "vp8/decoder/detokenize.c", "vp8/decoder/onyxd_if.c", - - "vp9/vp9_dx_iface.c", - "vp9/common/vp9_alloccommon.c", "vp9/common/vp9_blockd.c", "vp9/common/vp9_common_data.c", @@ -69,21 +63,16 @@ libvpx_sources = [ "vp9/common/vp9_seg_common.c", "vp9/common/vp9_thread_common.c", "vp9/common/vp9_tile_common.c", - "vp9/decoder/vp9_decodeframe.c", "vp9/decoder/vp9_decodemv.c", "vp9/decoder/vp9_decoder.c", "vp9/decoder/vp9_detokenize.c", "vp9/decoder/vp9_dsubexp.c", "vp9/decoder/vp9_dthread.c", - - "vpx/src/vpx_codec.c", "vpx/src/vpx_decoder.c", "vpx/src/vpx_image.c", "vpx/src/vpx_psnr.c", - - "vpx_dsp/bitreader.c", "vpx_dsp/bitreader_buffer.c", "vpx_dsp/intrapred.c", @@ -92,18 +81,11 @@ libvpx_sources = [ "vpx_dsp/prob.c", "vpx_dsp/vpx_convolve.c", "vpx_dsp/vpx_dsp_rtcd.c", - - "vpx_mem/vpx_mem.c", - - "vpx_scale/vpx_scale_rtcd.c", - "vpx_scale/generic/yv12config.c", "vpx_scale/generic/yv12extend.c", - - - "vpx_util/vpx_thread.c" + "vpx_util/vpx_thread.c", ] libvpx_sources_mt = [ @@ -114,29 +96,23 @@ libvpx_sources_intrin_x86 = [ "vp8/common/x86/filter_x86.c", "vp8/common/x86/loopfilter_x86.c", "vp8/common/x86/vp8_asm_stubs.c", - - - "vpx_dsp/x86/vpx_asm_stubs.c" + "vpx_dsp/x86/vpx_asm_stubs.c", ] libvpx_sources_intrin_x86_mmx = [ "vp8/common/x86/idct_blk_mmx.c", ] libvpx_sources_intrin_x86_sse2 = [ "vp8/common/x86/idct_blk_sse2.c", - - "vp9/common/x86/vp9_idct_intrin_sse2.c", - - "vpx_dsp/x86/inv_txfm_sse2.c", "vpx_dsp/x86/loopfilter_sse2.c", ] libvpx_sources_intrin_x86_ssse3 = [ - "vpx_dsp/x86/vpx_subpixel_8t_intrin_ssse3.c" + "vpx_dsp/x86/vpx_subpixel_8t_intrin_ssse3.c", ] libvpx_sources_intrin_x86_avx2 = [ "vpx_dsp/x86/loopfilter_avx2.c", - "vpx_dsp/x86/vpx_subpixel_8t_intrin_avx2.c" + "vpx_dsp/x86/vpx_subpixel_8t_intrin_avx2.c", ] libvpx_sources_x86asm = [ "vp8/common/x86/copy_sse2.asm", @@ -153,8 +129,6 @@ libvpx_sources_x86asm = [ "vp8/common/x86/subpixel_sse2.asm", "vp8/common/x86/subpixel_ssse3.asm", "vp8/common/x86/vp8_loopfilter_mmx.asm", - - "vpx_dsp/x86/intrapred_sse2.asm", "vpx_dsp/x86/intrapred_ssse3.asm", "vpx_dsp/x86/inv_wht_sse2.asm", @@ -163,21 +137,15 @@ libvpx_sources_x86asm = [ "vpx_dsp/x86/vpx_subpixel_8t_ssse3.asm", "vpx_dsp/x86/vpx_subpixel_bilinear_sse2.asm", "vpx_dsp/x86/vpx_subpixel_bilinear_ssse3.asm", - - - "vpx_ports/emms.asm" + "vpx_ports/emms.asm", ] libvpx_sources_x86_64asm = [ "vp8/common/x86/loopfilter_block_sse2_x86_64.asm", - - - "vpx_dsp/x86/inv_txfm_ssse3_x86_64.asm" + "vpx_dsp/x86/inv_txfm_ssse3_x86_64.asm", ] libvpx_sources_arm = [ "vpx_ports/arm_cpudetect.c", - - "vp8/common/arm/loopfilter_arm.c", ] libvpx_sources_arm_neon = [ @@ -196,12 +164,8 @@ libvpx_sources_arm_neon = [ "vp8/common/arm/neon/shortidct4x4llm_neon.c", "vp8/common/arm/neon/sixtappredict_neon.c", "vp8/common/arm/neon/vp8_loopfilter_neon.c", - - "vp9/common/arm/neon/vp9_iht4x4_add_neon.c", "vp9/common/arm/neon/vp9_iht8x8_add_neon.c", - - "vpx_dsp/arm/idct16x16_1_add_neon.c", "vpx_dsp/arm/idct16x16_add_neon.c", "vpx_dsp/arm/idct16x16_neon.c", @@ -220,22 +184,22 @@ libvpx_sources_arm_neon = [ "vpx_dsp/arm/vpx_convolve8_neon.c", "vpx_dsp/arm/vpx_convolve_avg_neon.c", "vpx_dsp/arm/vpx_convolve_copy_neon.c", - "vpx_dsp/arm/vpx_convolve_neon.c" + "vpx_dsp/arm/vpx_convolve_neon.c", ] libvpx_sources_arm_neon_gas = [ "vpx_dsp/arm/gas/intrapred_neon_asm.s", "vpx_dsp/arm/gas/loopfilter_mb_neon.s", - "vpx_dsp/arm/gas/save_reg_neon.s" + "vpx_dsp/arm/gas/save_reg_neon.s", ] libvpx_sources_arm_neon_armasm_ms = [ "vpx_dsp/arm/armasm_ms/intrapred_neon_asm.asm", "vpx_dsp/arm/armasm_ms/loopfilter_mb_neon.asm", - "vpx_dsp/arm/armasm_ms/save_reg_neon.asm" + "vpx_dsp/arm/armasm_ms/save_reg_neon.asm", ] libvpx_sources_arm_neon_gas_apple = [ "vpx_dsp/arm/gas_apple/intrapred_neon_asm.s", "vpx_dsp/arm/gas_apple/loopfilter_mb_neon.s", - "vpx_dsp/arm/gas_apple/save_reg_neon.s" + "vpx_dsp/arm/gas_apple/save_reg_neon.s", ] libvpx_sources = [libvpx_dir + file for file in libvpx_sources] @@ -258,25 +222,43 @@ env_libvpx = env_modules.Clone() env_libvpx.disable_warnings() env_libvpx.Prepend(CPPPATH=[libvpx_dir]) -webm_multithread = env["platform"] != 'javascript' +webm_multithread = env["platform"] != "javascript" cpu_bits = env["bits"] webm_cpu_x86 = False webm_cpu_arm = False -if env["platform"] == 'uwp': - if 'arm' in env["PROGSUFFIX"]: +if env["platform"] == "uwp": + if "arm" in env["PROGSUFFIX"]: webm_cpu_arm = True else: webm_cpu_x86 = True else: import platform - is_x11_or_server_arm = ((env["platform"] == 'linuxbsd' or env["platform"] == 'server') and (platform.machine().startswith('arm') or platform.machine().startswith('aarch'))) - is_ios_x86 = (env["platform"] == 'iphone' and ("arch" in env and env["arch"].startswith('x86'))) - is_android_x86 = (env["platform"] == 'android' and env["android_arch"].startswith('x86')) + + is_x11_or_server_arm = (env["platform"] == "linuxbsd" or env["platform"] == "server") and ( + platform.machine().startswith("arm") or platform.machine().startswith("aarch") + ) + is_ios_x86 = env["platform"] == "iphone" and ("arch" in env and env["arch"].startswith("x86")) + is_android_x86 = env["platform"] == "android" and env["android_arch"].startswith("x86") if is_android_x86: - cpu_bits = '32' if env["android_arch"] == 'x86' else '64' - webm_cpu_x86 = not is_x11_or_server_arm and (cpu_bits == '32' or cpu_bits == '64') and (env["platform"] == 'windows' or env["platform"] == 'linuxbsd' or env["platform"] == 'osx' or env["platform"] == 'haiku' or is_android_x86 or is_ios_x86) - webm_cpu_arm = is_x11_or_server_arm or (not is_ios_x86 and env["platform"] == 'iphone') or (not is_android_x86 and env["platform"] == 'android') + cpu_bits = "32" if env["android_arch"] == "x86" else "64" + webm_cpu_x86 = ( + not is_x11_or_server_arm + and (cpu_bits == "32" or cpu_bits == "64") + and ( + env["platform"] == "windows" + or env["platform"] == "linuxbsd" + or env["platform"] == "osx" + or env["platform"] == "haiku" + or is_android_x86 + or is_ios_x86 + ) + ) + webm_cpu_arm = ( + is_x11_or_server_arm + or (not is_ios_x86 and env["platform"] == "iphone") + or (not is_android_x86 and env["platform"] == "android") + ) if webm_cpu_x86: import subprocess @@ -306,38 +288,43 @@ if webm_cpu_x86: webm_simd_optimizations = False if webm_cpu_x86: - if env["platform"] == 'windows' or env["platform"] == 'uwp': - env_libvpx["ASFORMAT"] = 'win' - elif env["platform"] == 'osx' or env["platform"] == "iphone": - env_libvpx["ASFORMAT"] = 'macho' + if env["platform"] == "windows" or env["platform"] == "uwp": + env_libvpx["ASFORMAT"] = "win" + elif env["platform"] == "osx" or env["platform"] == "iphone": + env_libvpx["ASFORMAT"] = "macho" else: - env_libvpx["ASFORMAT"] = 'elf' + env_libvpx["ASFORMAT"] = "elf" env_libvpx["ASFORMAT"] += cpu_bits - env_libvpx["AS"] = 'yasm' - env_libvpx["ASFLAGS"] = '-I' + libvpx_dir[1:] + ' -f $ASFORMAT -D $ASCPU' - env_libvpx["ASCOM"] = '$AS $ASFLAGS -o $TARGET $SOURCES' + env_libvpx["AS"] = "yasm" + env_libvpx["ASFLAGS"] = "-I" + libvpx_dir[1:] + " -f $ASFORMAT -D $ASCPU" + env_libvpx["ASCOM"] = "$AS $ASFLAGS -o $TARGET $SOURCES" - if cpu_bits == '32': - env_libvpx["ASCPU"] = 'X86_32' - elif cpu_bits == '64': - env_libvpx["ASCPU"] = 'X86_64' + if cpu_bits == "32": + env_libvpx["ASCPU"] = "X86_32" + elif cpu_bits == "64": + env_libvpx["ASCPU"] = "X86_64" - env_libvpx.Append(CPPDEFINES=['WEBM_X86ASM']) + env_libvpx.Append(CPPDEFINES=["WEBM_X86ASM"]) webm_simd_optimizations = True if webm_cpu_arm: - if env["platform"] == 'iphone': - env_libvpx["ASFLAGS"] = '-arch armv7' - elif env["platform"] == 'android' and env["android_arch"] == 'armv7' or env["platform"] == 'linuxbsd' or env["platform"] == 'server': - env_libvpx["ASFLAGS"] = '-mfpu=neon' - elif env["platform"] == 'uwp': - env_libvpx["AS"] = 'armasm' - env_libvpx["ASFLAGS"] = '' - env_libvpx["ASCOM"] = '$AS $ASFLAGS -o $TARGET $SOURCES' - - env_libvpx.Append(CPPDEFINES=['WEBM_ARMASM']) + if env["platform"] == "iphone": + env_libvpx["ASFLAGS"] = "-arch armv7" + elif ( + env["platform"] == "android" + and env["android_arch"] == "armv7" + or env["platform"] == "linuxbsd" + or env["platform"] == "server" + ): + env_libvpx["ASFLAGS"] = "-mfpu=neon" + elif env["platform"] == "uwp": + env_libvpx["AS"] = "armasm" + env_libvpx["ASFLAGS"] = "" + env_libvpx["ASCOM"] = "$AS $ASFLAGS -o $TARGET $SOURCES" + + env_libvpx.Append(CPPDEFINES=["WEBM_ARMASM"]) webm_simd_optimizations = True @@ -350,45 +337,49 @@ if webm_multithread: env_libvpx.add_source_files(env.modules_sources, libvpx_sources_mt) if webm_cpu_x86: - is_clang_or_gcc = ('gcc' in os.path.basename(env["CC"])) or ('clang' in os.path.basename(env["CC"])) or ("osxcross" in env) + is_clang_or_gcc = ( + ("gcc" in os.path.basename(env["CC"])) or ("clang" in os.path.basename(env["CC"])) or ("osxcross" in env) + ) env_libvpx_mmx = env_libvpx.Clone() - if cpu_bits == '32' and is_clang_or_gcc: - env_libvpx_mmx.Append(CCFLAGS=['-mmmx']) + if cpu_bits == "32" and is_clang_or_gcc: + env_libvpx_mmx.Append(CCFLAGS=["-mmmx"]) env_libvpx_mmx.add_source_files(env.modules_sources, libvpx_sources_intrin_x86_mmx) env_libvpx_sse2 = env_libvpx.Clone() - if cpu_bits == '32' and is_clang_or_gcc: - env_libvpx_sse2.Append(CCFLAGS=['-msse2']) + if cpu_bits == "32" and is_clang_or_gcc: + env_libvpx_sse2.Append(CCFLAGS=["-msse2"]) env_libvpx_sse2.add_source_files(env.modules_sources, libvpx_sources_intrin_x86_sse2) env_libvpx_ssse3 = env_libvpx.Clone() if is_clang_or_gcc: - env_libvpx_ssse3.Append(CCFLAGS=['-mssse3']) + env_libvpx_ssse3.Append(CCFLAGS=["-mssse3"]) env_libvpx_ssse3.add_source_files(env.modules_sources, libvpx_sources_intrin_x86_ssse3) env_libvpx_avx2 = env_libvpx.Clone() if is_clang_or_gcc: - env_libvpx_avx2.Append(CCFLAGS=['-mavx2']) + env_libvpx_avx2.Append(CCFLAGS=["-mavx2"]) env_libvpx_avx2.add_source_files(env.modules_sources, libvpx_sources_intrin_x86_avx2) env_libvpx.add_source_files(env.modules_sources, libvpx_sources_intrin_x86) env_libvpx.add_source_files(env.modules_sources, libvpx_sources_x86asm) - if cpu_bits == '64': + if cpu_bits == "64": env_libvpx.add_source_files(env.modules_sources, libvpx_sources_x86_64asm) elif webm_cpu_arm: env_libvpx.add_source_files(env.modules_sources, libvpx_sources_arm) - if env["platform"] == 'android': + if env["platform"] == "android": env_libvpx.Prepend(CPPPATH=[libvpx_dir + "third_party/android"]) env_libvpx.add_source_files(env.modules_sources, [libvpx_dir + "third_party/android/cpu-features.c"]) env_libvpx_neon = env_libvpx.Clone() env_libvpx_neon.add_source_files(env.modules_sources, libvpx_sources_arm_neon) - if env["platform"] == 'uwp': + if env["platform"] == "uwp": env_libvpx.add_source_files(env.modules_sources, libvpx_sources_arm_neon_armasm_ms) - elif env["platform"] == 'iphone': + elif env["platform"] == "iphone": env_libvpx.add_source_files(env.modules_sources, libvpx_sources_arm_neon_gas_apple) - elif (is_x11_or_server_arm and cpu_bits == '32') or (env["platform"] == 'android' and not env["android_arch"] == 'arm64v8'): + elif (is_x11_or_server_arm and cpu_bits == "32") or ( + env["platform"] == "android" and not env["android_arch"] == "arm64v8" + ): env_libvpx.add_source_files(env.modules_sources, libvpx_sources_arm_neon_gas) diff --git a/modules/webp/SCsub b/modules/webp/SCsub index 666628bb44..58f2bb35e6 100644 --- a/modules/webp/SCsub +++ b/modules/webp/SCsub @@ -1,12 +1,12 @@ #!/usr/bin/env python -Import('env') -Import('env_modules') +Import("env") +Import("env_modules") env_webp = env_modules.Clone() # Thirdparty source files -if env['builtin_libwebp']: +if env["builtin_libwebp"]: thirdparty_dir = "#thirdparty/libwebp/" thirdparty_sources = [ "dec/alpha_dec.c", diff --git a/modules/webp/config.py b/modules/webp/config.py index 1c8cd12a2d..d22f9454ed 100644 --- a/modules/webp/config.py +++ b/modules/webp/config.py @@ -1,5 +1,6 @@ def can_build(env, platform): return True + def configure(env): pass diff --git a/modules/webrtc/SCsub b/modules/webrtc/SCsub index 868553b879..20b4c8f8d2 100644 --- a/modules/webrtc/SCsub +++ b/modules/webrtc/SCsub @@ -1,15 +1,15 @@ #!/usr/bin/env python -Import('env') -Import('env_modules') +Import("env") +Import("env_modules") # Thirdparty source files env_webrtc = env_modules.Clone() use_gdnative = env_webrtc["module_gdnative_enabled"] -if use_gdnative: # GDNative is retained in Javascript for export compatibility - env_webrtc.Append(CPPDEFINES=['WEBRTC_GDNATIVE_ENABLED']) +if use_gdnative: # GDNative is retained in Javascript for export compatibility + env_webrtc.Append(CPPDEFINES=["WEBRTC_GDNATIVE_ENABLED"]) env_webrtc.Prepend(CPPPATH=["#modules/gdnative/include/"]) env_webrtc.add_source_files(env.modules_sources, "*.cpp") diff --git a/modules/webrtc/config.py b/modules/webrtc/config.py index 48b4c33c5d..0a075ccef1 100644 --- a/modules/webrtc/config.py +++ b/modules/webrtc/config.py @@ -1,15 +1,18 @@ def can_build(env, platform): return True + def configure(env): pass + def get_doc_classes(): return [ "WebRTCPeerConnection", "WebRTCDataChannel", - "WebRTCMultiplayer" + "WebRTCMultiplayer", ] + def get_doc_path(): return "doc_classes" diff --git a/modules/websocket/SCsub b/modules/websocket/SCsub index 033169411f..af60055855 100644 --- a/modules/websocket/SCsub +++ b/modules/websocket/SCsub @@ -1,13 +1,13 @@ #!/usr/bin/env python -Import('env') -Import('env_modules') +Import("env") +Import("env_modules") # Thirdparty source files env_ws = env_modules.Clone() -if env['builtin_wslay'] and not env["platform"] == "javascript": # already builtin for javascript +if env["builtin_wslay"] and not env["platform"] == "javascript": # already builtin for javascript wslay_dir = "#thirdparty/wslay/" wslay_sources = [ "wslay_net.c", diff --git a/modules/websocket/config.py b/modules/websocket/config.py index f59ef432b4..9e27a1a0fe 100644 --- a/modules/websocket/config.py +++ b/modules/websocket/config.py @@ -1,16 +1,19 @@ def can_build(env, platform): return True + def configure(env): pass + def get_doc_classes(): return [ "WebSocketClient", "WebSocketMultiplayerPeer", "WebSocketPeer", - "WebSocketServer" + "WebSocketServer", ] + def get_doc_path(): return "doc_classes" diff --git a/modules/xatlas_unwrap/SCsub b/modules/xatlas_unwrap/SCsub index b242fd4673..c659349d05 100644 --- a/modules/xatlas_unwrap/SCsub +++ b/modules/xatlas_unwrap/SCsub @@ -1,12 +1,12 @@ #!/usr/bin/env python -Import('env') -Import('env_modules') +Import("env") +Import("env_modules") env_xatlas_unwrap = env_modules.Clone() # Thirdparty source files -if env['builtin_xatlas']: +if env["builtin_xatlas"]: thirdparty_dir = "#thirdparty/xatlas/" thirdparty_sources = [ "xatlas.cpp", diff --git a/modules/xatlas_unwrap/config.py b/modules/xatlas_unwrap/config.py index bd092bdc16..2e73c51626 100644 --- a/modules/xatlas_unwrap/config.py +++ b/modules/xatlas_unwrap/config.py @@ -1,5 +1,6 @@ def can_build(env, platform): - return (env['tools'] and platform not in ["android", "ios"]) + return env["tools"] and platform not in ["android", "ios"] + def configure(env): pass diff --git a/platform/SCsub b/platform/SCsub index 40cacce674..5194a19518 100644 --- a/platform/SCsub +++ b/platform/SCsub @@ -1,30 +1,30 @@ #!/usr/bin/env python -Import('env') +Import("env") env.platform_sources = [] # Register platform-exclusive APIs reg_apis_inc = '#include "register_platform_apis.h"\n' -reg_apis = 'void register_platform_apis() {\n' -unreg_apis = 'void unregister_platform_apis() {\n' +reg_apis = "void register_platform_apis() {\n" +unreg_apis = "void unregister_platform_apis() {\n" for platform in env.platform_apis: platform_dir = env.Dir(platform) - env.add_source_files(env.platform_sources, platform + '/api/api.cpp') - reg_apis += '\tregister_' + platform + '_api();\n' - unreg_apis += '\tunregister_' + platform + '_api();\n' + env.add_source_files(env.platform_sources, platform + "/api/api.cpp") + reg_apis += "\tregister_" + platform + "_api();\n" + unreg_apis += "\tunregister_" + platform + "_api();\n" reg_apis_inc += '#include "' + platform + '/api/api.h"\n' -reg_apis_inc += '\n' -reg_apis += '}\n\n' -unreg_apis += '}\n' +reg_apis_inc += "\n" +reg_apis += "}\n\n" +unreg_apis += "}\n" # NOTE: It is safe to generate this file here, since this is still execute serially -with open('register_platform_apis.gen.cpp', 'w', encoding="utf-8") as f: +with open("register_platform_apis.gen.cpp", "w", encoding="utf-8") as f: f.write(reg_apis_inc) f.write(reg_apis) f.write(unreg_apis) -env.add_source_files(env.platform_sources, 'register_platform_apis.gen.cpp') +env.add_source_files(env.platform_sources, "register_platform_apis.gen.cpp") -lib = env.add_library('platform', env.platform_sources) +lib = env.add_library("platform", env.platform_sources) env.Prepend(LIBS=[lib]) diff --git a/platform/android/SCsub b/platform/android/SCsub index 5ca5ce548c..f39eb8b889 100644 --- a/platform/android/SCsub +++ b/platform/android/SCsub @@ -1,24 +1,24 @@ #!/usr/bin/env python -Import('env') +Import("env") android_files = [ - 'os_android.cpp', - 'file_access_android.cpp', - 'audio_driver_opensl.cpp', - 'file_access_jandroid.cpp', - 'dir_access_jandroid.cpp', - 'thread_jandroid.cpp', - 'net_socket_android.cpp', - 'audio_driver_jandroid.cpp', - 'java_godot_lib_jni.cpp', - 'java_class_wrapper.cpp', - 'java_godot_wrapper.cpp', - 'java_godot_io_wrapper.cpp', - 'jni_utils.cpp', - 'android_keys_utils.cpp', - 'vulkan/vk_renderer_jni.cpp', - 'plugin/godot_plugin_jni.cpp' + "os_android.cpp", + "file_access_android.cpp", + "audio_driver_opensl.cpp", + "file_access_jandroid.cpp", + "dir_access_jandroid.cpp", + "thread_jandroid.cpp", + "net_socket_android.cpp", + "audio_driver_jandroid.cpp", + "java_godot_lib_jni.cpp", + "java_class_wrapper.cpp", + "java_godot_wrapper.cpp", + "java_godot_io_wrapper.cpp", + "jni_utils.cpp", + "android_keys_utils.cpp", + "vulkan/vk_renderer_jni.cpp", + "plugin/godot_plugin_jni.cpp", ] env_android = env.Clone() @@ -29,30 +29,34 @@ for x in android_files: env_thirdparty = env_android.Clone() env_thirdparty.disable_warnings() -android_objects.append(env_thirdparty.SharedObject('#thirdparty/misc/ifaddrs-android.cc')) +android_objects.append(env_thirdparty.SharedObject("#thirdparty/misc/ifaddrs-android.cc")) lib = env_android.add_shared_library("#bin/libgodot", [android_objects], SHLIBSUFFIX=env["SHLIBSUFFIX"]) -lib_arch_dir = '' -if env['android_arch'] == 'armv7': - lib_arch_dir = 'armeabi-v7a' -elif env['android_arch'] == 'arm64v8': - lib_arch_dir = 'arm64-v8a' -elif env['android_arch'] == 'x86': - lib_arch_dir = 'x86' -elif env['android_arch'] == 'x86_64': - lib_arch_dir = 'x86_64' +lib_arch_dir = "" +if env["android_arch"] == "armv7": + lib_arch_dir = "armeabi-v7a" +elif env["android_arch"] == "arm64v8": + lib_arch_dir = "arm64-v8a" +elif env["android_arch"] == "x86": + lib_arch_dir = "x86" +elif env["android_arch"] == "x86_64": + lib_arch_dir = "x86_64" else: - print('WARN: Architecture not suitable for embedding into APK; keeping .so at \\bin') + print("WARN: Architecture not suitable for embedding into APK; keeping .so at \\bin") -if lib_arch_dir != '': - if env['target'] == 'release': - lib_type_dir = 'release' +if lib_arch_dir != "": + if env["target"] == "release": + lib_type_dir = "release" else: # release_debug, debug - lib_type_dir = 'debug' + lib_type_dir = "debug" - out_dir = '#platform/android/java/lib/libs/' + lib_type_dir + '/' + lib_arch_dir - env_android.Command(out_dir + '/libgodot_android.so', '#bin/libgodot' + env['SHLIBSUFFIX'], Move("$TARGET", "$SOURCE")) + out_dir = "#platform/android/java/lib/libs/" + lib_type_dir + "/" + lib_arch_dir + env_android.Command( + out_dir + "/libgodot_android.so", "#bin/libgodot" + env["SHLIBSUFFIX"], Move("$TARGET", "$SOURCE") + ) - stl_lib_path = str(env['ANDROID_NDK_ROOT']) + '/sources/cxx-stl/llvm-libc++/libs/' + lib_arch_dir + '/libc++_shared.so' - env_android.Command(out_dir + '/libc++_shared.so', stl_lib_path, Copy("$TARGET", "$SOURCE")) + stl_lib_path = ( + str(env["ANDROID_NDK_ROOT"]) + "/sources/cxx-stl/llvm-libc++/libs/" + lib_arch_dir + "/libc++_shared.so" + ) + env_android.Command(out_dir + "/libc++_shared.so", stl_lib_path, Copy("$TARGET", "$SOURCE")) diff --git a/platform/android/detect.py b/platform/android/detect.py index ff3ca0706c..ed0643e3b3 100644 --- a/platform/android/detect.py +++ b/platform/android/detect.py @@ -13,7 +13,7 @@ def get_name(): def can_build(): - return ("ANDROID_NDK_ROOT" in os.environ) + return "ANDROID_NDK_ROOT" in os.environ def get_platform(platform): @@ -24,33 +24,33 @@ def get_opts(): from SCons.Variables import BoolVariable, EnumVariable return [ - ('ANDROID_NDK_ROOT', 'Path to the Android NDK', os.environ.get("ANDROID_NDK_ROOT", 0)), - ('ndk_platform', 'Target platform (android-<api>, e.g. "android-18")', "android-18"), - EnumVariable('android_arch', 'Target architecture', "armv7", ('armv7', 'arm64v8', 'x86', 'x86_64')), - BoolVariable('android_neon', 'Enable NEON support (armv7 only)', True), + ("ANDROID_NDK_ROOT", "Path to the Android NDK", os.environ.get("ANDROID_NDK_ROOT", 0)), + ("ndk_platform", 'Target platform (android-<api>, e.g. "android-18")', "android-18"), + EnumVariable("android_arch", "Target architecture", "armv7", ("armv7", "arm64v8", "x86", "x86_64")), + BoolVariable("android_neon", "Enable NEON support (armv7 only)", True), ] def get_flags(): return [ - ('tools', False), + ("tools", False), ] def create(env): - tools = env['TOOLS'] + tools = env["TOOLS"] if "mingw" in tools: - tools.remove('mingw') + tools.remove("mingw") if "applelink" in tools: tools.remove("applelink") - env.Tool('gcc') + env.Tool("gcc") return env.Clone(tools=tools) def configure(env): # Workaround for MinGW. See: # http://www.scons.org/wiki/LongCmdLinesOnWin32 - if (os.name == "nt"): + if os.name == "nt": import subprocess @@ -58,8 +58,15 @@ def configure(env): # print("SPAWNED : " + cmdline) startupinfo = subprocess.STARTUPINFO() startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW - proc = subprocess.Popen(cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE, - stderr=subprocess.PIPE, startupinfo=startupinfo, shell=False, env=env) + proc = subprocess.Popen( + cmdline, + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + startupinfo=startupinfo, + shell=False, + env=env, + ) data, err = proc.communicate() rv = proc.wait() if rv: @@ -70,7 +77,7 @@ def configure(env): def mySpawn(sh, escape, cmd, args, env): - newargs = ' '.join(args[1:]) + newargs = " ".join(args[1:]) cmdline = cmd + " " + newargs rv = 0 @@ -85,50 +92,54 @@ def configure(env): return rv - env['SPAWN'] = mySpawn + env["SPAWN"] = mySpawn # Architecture - if env['android_arch'] not in ['armv7', 'arm64v8', 'x86', 'x86_64']: - env['android_arch'] = 'armv7' + if env["android_arch"] not in ["armv7", "arm64v8", "x86", "x86_64"]: + env["android_arch"] = "armv7" neon_text = "" - if env["android_arch"] == "armv7" and env['android_neon']: + if env["android_arch"] == "armv7" and env["android_neon"]: neon_text = " (with NEON)" - print("Building for Android (" + env['android_arch'] + ")" + neon_text) + print("Building for Android (" + env["android_arch"] + ")" + neon_text) can_vectorize = True - if env['android_arch'] == 'x86': - env['ARCH'] = 'arch-x86' + if env["android_arch"] == "x86": + env["ARCH"] = "arch-x86" env.extra_suffix = ".x86" + env.extra_suffix target_subpath = "x86-4.9" abi_subpath = "i686-linux-android" arch_subpath = "x86" env["x86_libtheora_opt_gcc"] = True - if env['android_arch'] == 'x86_64': + if env["android_arch"] == "x86_64": if get_platform(env["ndk_platform"]) < 21: - print("WARNING: android_arch=x86_64 is not supported by ndk_platform lower than android-21; setting ndk_platform=android-21") + print( + "WARNING: android_arch=x86_64 is not supported by ndk_platform lower than android-21; setting ndk_platform=android-21" + ) env["ndk_platform"] = "android-21" - env['ARCH'] = 'arch-x86_64' + env["ARCH"] = "arch-x86_64" env.extra_suffix = ".x86_64" + env.extra_suffix target_subpath = "x86_64-4.9" abi_subpath = "x86_64-linux-android" arch_subpath = "x86_64" env["x86_libtheora_opt_gcc"] = True elif env["android_arch"] == "armv7": - env['ARCH'] = 'arch-arm' + env["ARCH"] = "arch-arm" target_subpath = "arm-linux-androideabi-4.9" abi_subpath = "arm-linux-androideabi" arch_subpath = "armeabi-v7a" - if env['android_neon']: + if env["android_neon"]: env.extra_suffix = ".armv7.neon" + env.extra_suffix else: env.extra_suffix = ".armv7" + env.extra_suffix elif env["android_arch"] == "arm64v8": if get_platform(env["ndk_platform"]) < 21: - print("WARNING: android_arch=arm64v8 is not supported by ndk_platform lower than android-21; setting ndk_platform=android-21") + print( + "WARNING: android_arch=arm64v8 is not supported by ndk_platform lower than android-21; setting ndk_platform=android-21" + ) env["ndk_platform"] = "android-21" - env['ARCH'] = 'arch-arm64' + env["ARCH"] = "arch-arm64" target_subpath = "aarch64-linux-android-4.9" abi_subpath = "aarch64-linux-android" arch_subpath = "arm64-v8a" @@ -136,40 +147,40 @@ def configure(env): # Build type - if (env["target"].startswith("release")): - if (env["optimize"] == "speed"): # optimize for speed (default) - env.Append(LINKFLAGS=['-O2']) - env.Append(CCFLAGS=['-O2', '-fomit-frame-pointer']) - env.Append(CPPDEFINES=['NDEBUG']) + if env["target"].startswith("release"): + if env["optimize"] == "speed": # optimize for speed (default) + env.Append(LINKFLAGS=["-O2"]) + env.Append(CCFLAGS=["-O2", "-fomit-frame-pointer"]) + env.Append(CPPDEFINES=["NDEBUG"]) else: # optimize for size - env.Append(CCFLAGS=['-Os']) - env.Append(CPPDEFINES=['NDEBUG']) - env.Append(LINKFLAGS=['-Os']) - - if (can_vectorize): - env.Append(CCFLAGS=['-ftree-vectorize']) - if (env["target"] == "release_debug"): - env.Append(CPPDEFINES=['DEBUG_ENABLED']) - elif (env["target"] == "debug"): - env.Append(LINKFLAGS=['-O0']) - env.Append(CCFLAGS=['-O0', '-g', '-fno-limit-debug-info']) - env.Append(CPPDEFINES=['_DEBUG', 'DEBUG_ENABLED', 'DEBUG_MEMORY_ENABLED']) - env.Append(CPPFLAGS=['-UNDEBUG']) + env.Append(CCFLAGS=["-Os"]) + env.Append(CPPDEFINES=["NDEBUG"]) + env.Append(LINKFLAGS=["-Os"]) + + if can_vectorize: + env.Append(CCFLAGS=["-ftree-vectorize"]) + if env["target"] == "release_debug": + env.Append(CPPDEFINES=["DEBUG_ENABLED"]) + elif env["target"] == "debug": + env.Append(LINKFLAGS=["-O0"]) + env.Append(CCFLAGS=["-O0", "-g", "-fno-limit-debug-info"]) + env.Append(CPPDEFINES=["_DEBUG", "DEBUG_ENABLED", "DEBUG_MEMORY_ENABLED"]) + env.Append(CPPFLAGS=["-UNDEBUG"]) # Compiler configuration - env['SHLIBSUFFIX'] = '.so' + env["SHLIBSUFFIX"] = ".so" - if env['PLATFORM'] == 'win32': - env.Tool('gcc') + if env["PLATFORM"] == "win32": + env.Tool("gcc") env.use_windows_spawn_fix() - if (sys.platform.startswith("linux")): + if sys.platform.startswith("linux"): host_subpath = "linux-x86_64" - elif (sys.platform.startswith("darwin")): + elif sys.platform.startswith("darwin"): host_subpath = "darwin-x86_64" - elif (sys.platform.startswith('win')): - if (platform.machine().endswith('64')): + elif sys.platform.startswith("win"): + if platform.machine().endswith("64"): host_subpath = "windows-x86_64" else: host_subpath = "windows" @@ -179,22 +190,22 @@ def configure(env): tools_path = gcc_toolchain_path + "/" + abi_subpath + "/bin" # For Clang to find NDK tools in preference of those system-wide - env.PrependENVPath('PATH', tools_path) + env.PrependENVPath("PATH", tools_path) ccache_path = os.environ.get("CCACHE") if ccache_path is None: - env['CC'] = compiler_path + '/clang' - env['CXX'] = compiler_path + '/clang++' + env["CC"] = compiler_path + "/clang" + env["CXX"] = compiler_path + "/clang++" else: # there aren't any ccache wrappers available for Android, # to enable caching we need to prepend the path to the ccache binary - env['CC'] = ccache_path + ' ' + compiler_path + '/clang' - env['CXX'] = ccache_path + ' ' + compiler_path + '/clang++' - env['AR'] = tools_path + "/ar" - env['RANLIB'] = tools_path + "/ranlib" - env['AS'] = tools_path + "/as" + env["CC"] = ccache_path + " " + compiler_path + "/clang" + env["CXX"] = ccache_path + " " + compiler_path + "/clang++" + env["AR"] = tools_path + "/ar" + env["RANLIB"] = tools_path + "/ranlib" + env["AS"] = tools_path + "/as" - common_opts = ['-fno-integrated-as', '-gcc-toolchain', gcc_toolchain_path] + common_opts = ["-fno-integrated-as", "-gcc-toolchain", gcc_toolchain_path] # Compile flags @@ -202,14 +213,14 @@ def configure(env): env.Append(CPPFLAGS=["-isystem", env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/llvm-libc++abi/include"]) # Disable exceptions and rtti on non-tools (template) builds - if env['tools']: - env.Append(CXXFLAGS=['-frtti']) + if env["tools"]: + env.Append(CXXFLAGS=["-frtti"]) else: - env.Append(CXXFLAGS=['-fno-rtti', '-fno-exceptions']) + env.Append(CXXFLAGS=["-fno-rtti", "-fno-exceptions"]) # Don't use dynamic_cast, necessary with no-rtti. - env.Append(CPPDEFINES=['NO_SAFE_CAST']) + env.Append(CPPDEFINES=["NO_SAFE_CAST"]) - lib_sysroot = env["ANDROID_NDK_ROOT"] + "/platforms/" + env['ndk_platform'] + "/" + env['ARCH'] + lib_sysroot = env["ANDROID_NDK_ROOT"] + "/platforms/" + env["ndk_platform"] + "/" + env["ARCH"] # Using NDK unified headers (NDK r15+) sysroot = env["ANDROID_NDK_ROOT"] + "/sysroot" @@ -217,35 +228,37 @@ def configure(env): env.Append(CPPFLAGS=["-isystem", sysroot + "/usr/include/" + abi_subpath]) env.Append(CPPFLAGS=["-isystem", env["ANDROID_NDK_ROOT"] + "/sources/android/support/include"]) # For unified headers this define has to be set manually - env.Append(CPPDEFINES=[('__ANDROID_API__', str(get_platform(env['ndk_platform'])))]) + env.Append(CPPDEFINES=[("__ANDROID_API__", str(get_platform(env["ndk_platform"])))]) - env.Append(CCFLAGS='-fpic -ffunction-sections -funwind-tables -fstack-protector-strong -fvisibility=hidden -fno-strict-aliasing'.split()) - env.Append(CPPDEFINES=['NO_STATVFS', 'GLES_ENABLED']) + env.Append( + CCFLAGS="-fpic -ffunction-sections -funwind-tables -fstack-protector-strong -fvisibility=hidden -fno-strict-aliasing".split() + ) + env.Append(CPPDEFINES=["NO_STATVFS", "GLES_ENABLED"]) - env['neon_enabled'] = False - if env['android_arch'] == 'x86': - target_opts = ['-target', 'i686-none-linux-android'] + env["neon_enabled"] = False + if env["android_arch"] == "x86": + target_opts = ["-target", "i686-none-linux-android"] # The NDK adds this if targeting API < 21, so we can drop it when Godot targets it at least - env.Append(CCFLAGS=['-mstackrealign']) + env.Append(CCFLAGS=["-mstackrealign"]) - elif env['android_arch'] == 'x86_64': - target_opts = ['-target', 'x86_64-none-linux-android'] + elif env["android_arch"] == "x86_64": + target_opts = ["-target", "x86_64-none-linux-android"] elif env["android_arch"] == "armv7": - target_opts = ['-target', 'armv7-none-linux-androideabi'] - env.Append(CCFLAGS='-march=armv7-a -mfloat-abi=softfp'.split()) - env.Append(CPPDEFINES=['__ARM_ARCH_7__', '__ARM_ARCH_7A__']) - if env['android_neon']: - env['neon_enabled'] = True - env.Append(CCFLAGS=['-mfpu=neon']) - env.Append(CPPDEFINES=['__ARM_NEON__']) + target_opts = ["-target", "armv7-none-linux-androideabi"] + env.Append(CCFLAGS="-march=armv7-a -mfloat-abi=softfp".split()) + env.Append(CPPDEFINES=["__ARM_ARCH_7__", "__ARM_ARCH_7A__"]) + if env["android_neon"]: + env["neon_enabled"] = True + env.Append(CCFLAGS=["-mfpu=neon"]) + env.Append(CPPDEFINES=["__ARM_NEON__"]) else: - env.Append(CCFLAGS=['-mfpu=vfpv3-d16']) + env.Append(CCFLAGS=["-mfpu=vfpv3-d16"]) elif env["android_arch"] == "arm64v8": - target_opts = ['-target', 'aarch64-none-linux-android'] - env.Append(CCFLAGS=['-mfix-cortex-a53-835769']) - env.Append(CPPDEFINES=['__ARM_ARCH_8A__']) + target_opts = ["-target", "aarch64-none-linux-android"] + env.Append(CCFLAGS=["-mfix-cortex-a53-835769"]) + env.Append(CPPDEFINES=["__ARM_ARCH_8A__"]) env.Append(CCFLAGS=target_opts) env.Append(CCFLAGS=common_opts) @@ -254,29 +267,55 @@ def configure(env): ndk_version = get_ndk_version(env["ANDROID_NDK_ROOT"]) if ndk_version != None and LooseVersion(ndk_version) >= LooseVersion("17.1.4828580"): - env.Append(LINKFLAGS=['-Wl,--exclude-libs,libgcc.a', '-Wl,--exclude-libs,libatomic.a', '-nostdlib++']) + env.Append(LINKFLAGS=["-Wl,--exclude-libs,libgcc.a", "-Wl,--exclude-libs,libatomic.a", "-nostdlib++"]) else: - env.Append(LINKFLAGS=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/llvm-libc++/libs/" + arch_subpath + "/libandroid_support.a"]) - env.Append(LINKFLAGS=['-shared', '--sysroot=' + lib_sysroot, '-Wl,--warn-shared-textrel']) + env.Append( + LINKFLAGS=[ + env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/llvm-libc++/libs/" + arch_subpath + "/libandroid_support.a" + ] + ) + env.Append(LINKFLAGS=["-shared", "--sysroot=" + lib_sysroot, "-Wl,--warn-shared-textrel"]) env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/llvm-libc++/libs/" + arch_subpath + "/"]) - env.Append(LINKFLAGS=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/llvm-libc++/libs/" + arch_subpath + "/libc++_shared.so"]) + env.Append( + LINKFLAGS=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/llvm-libc++/libs/" + arch_subpath + "/libc++_shared.so"] + ) if env["android_arch"] == "armv7": - env.Append(LINKFLAGS='-Wl,--fix-cortex-a8'.split()) - env.Append(LINKFLAGS='-Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now'.split()) - env.Append(LINKFLAGS='-Wl,-soname,libgodot_android.so -Wl,--gc-sections'.split()) + env.Append(LINKFLAGS="-Wl,--fix-cortex-a8".split()) + env.Append(LINKFLAGS="-Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now".split()) + env.Append(LINKFLAGS="-Wl,-soname,libgodot_android.so -Wl,--gc-sections".split()) env.Append(LINKFLAGS=target_opts) env.Append(LINKFLAGS=common_opts) - env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"] + '/toolchains/' + target_subpath + '/prebuilt/' + - host_subpath + '/lib/gcc/' + abi_subpath + '/4.9.x']) - env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"] + - '/toolchains/' + target_subpath + '/prebuilt/' + host_subpath + '/' + abi_subpath + '/lib']) - - env.Prepend(CPPPATH=['#platform/android']) - env.Append(CPPDEFINES=['ANDROID_ENABLED', 'UNIX_ENABLED', 'NO_FCNTL']) - env.Append(LIBS=['OpenSLES', 'EGL', 'GLESv3', 'GLESv2', 'android', 'log', 'z', 'dl']) + env.Append( + LIBPATH=[ + env["ANDROID_NDK_ROOT"] + + "/toolchains/" + + target_subpath + + "/prebuilt/" + + host_subpath + + "/lib/gcc/" + + abi_subpath + + "/4.9.x" + ] + ) + env.Append( + LIBPATH=[ + env["ANDROID_NDK_ROOT"] + + "/toolchains/" + + target_subpath + + "/prebuilt/" + + host_subpath + + "/" + + abi_subpath + + "/lib" + ] + ) + + env.Prepend(CPPPATH=["#platform/android"]) + env.Append(CPPDEFINES=["ANDROID_ENABLED", "UNIX_ENABLED", "NO_FCNTL"]) + env.Append(LIBS=["OpenSLES", "EGL", "GLESv3", "GLESv2", "android", "log", "z", "dl"]) # Return NDK version string in source.properties (adapted from the Chromium project). diff --git a/platform/haiku/SCsub b/platform/haiku/SCsub index 592f56bbbf..dbff6c5ae9 100644 --- a/platform/haiku/SCsub +++ b/platform/haiku/SCsub @@ -1,28 +1,25 @@ #!/usr/bin/env python -Import('env') +Import("env") common_haiku = [ - 'os_haiku.cpp', - 'context_gl_haiku.cpp', - 'haiku_application.cpp', - 'haiku_direct_window.cpp', - 'haiku_gl_view.cpp', - 'key_mapping_haiku.cpp', - 'audio_driver_media_kit.cpp' + "os_haiku.cpp", + "context_gl_haiku.cpp", + "haiku_application.cpp", + "haiku_direct_window.cpp", + "haiku_gl_view.cpp", + "key_mapping_haiku.cpp", + "audio_driver_media_kit.cpp", ] -target = env.add_program( - '#bin/godot', - ['godot_haiku.cpp'] + common_haiku -) +target = env.add_program("#bin/godot", ["godot_haiku.cpp"] + common_haiku) -command = env.Command('#bin/godot.rsrc', '#platform/haiku/godot.rdef', - ['rc -o $TARGET $SOURCE']) +command = env.Command("#bin/godot.rsrc", "#platform/haiku/godot.rdef", ["rc -o $TARGET $SOURCE"]) def addResourcesAction(target=None, source=None, env=None): - return env.Execute('xres -o ' + File(target)[0].path + ' bin/godot.rsrc') + return env.Execute("xres -o " + File(target)[0].path + " bin/godot.rsrc") + env.AddPostAction(target, addResourcesAction) env.Depends(target, command) diff --git a/platform/haiku/detect.py b/platform/haiku/detect.py index dd72294816..0b84df8f9b 100644 --- a/platform/haiku/detect.py +++ b/platform/haiku/detect.py @@ -12,7 +12,7 @@ def get_name(): def can_build(): - if (os.name != "posix" or sys.platform == "darwin"): + if os.name != "posix" or sys.platform == "darwin": return False return True @@ -22,41 +22,40 @@ def get_opts(): from SCons.Variables import EnumVariable return [ - EnumVariable('debug_symbols', 'Add debugging symbols to release builds', 'yes', ('yes', 'no', 'full')), + EnumVariable("debug_symbols", "Add debugging symbols to release builds", "yes", ("yes", "no", "full")), ] def get_flags(): - return [ - ] + return [] def configure(env): ## Build type - if (env["target"] == "release"): - env.Prepend(CCFLAGS=['-O3']) - if (env["debug_symbols"] == "yes"): - env.Prepend(CCFLAGS=['-g1']) - if (env["debug_symbols"] == "full"): - env.Prepend(CCFLAGS=['-g2']) + if env["target"] == "release": + env.Prepend(CCFLAGS=["-O3"]) + if env["debug_symbols"] == "yes": + env.Prepend(CCFLAGS=["-g1"]) + if env["debug_symbols"] == "full": + env.Prepend(CCFLAGS=["-g2"]) - elif (env["target"] == "release_debug"): - env.Prepend(CCFLAGS=['-O2', '-DDEBUG_ENABLED']) - if (env["debug_symbols"] == "yes"): - env.Prepend(CCFLAGS=['-g1']) - if (env["debug_symbols"] == "full"): - env.Prepend(CCFLAGS=['-g2']) + elif env["target"] == "release_debug": + env.Prepend(CCFLAGS=["-O2", "-DDEBUG_ENABLED"]) + if env["debug_symbols"] == "yes": + env.Prepend(CCFLAGS=["-g1"]) + if env["debug_symbols"] == "full": + env.Prepend(CCFLAGS=["-g2"]) - elif (env["target"] == "debug"): - env.Prepend(CCFLAGS=['-g3', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED']) + elif env["target"] == "debug": + env.Prepend(CCFLAGS=["-g3", "-DDEBUG_ENABLED", "-DDEBUG_MEMORY_ENABLED"]) ## Architecture - is64 = sys.maxsize > 2**32 - if (env["bits"] == "default"): + is64 = sys.maxsize > 2 ** 32 + if env["bits"] == "default": env["bits"] = "64" if is64 else "32" ## Compiler configuration @@ -66,89 +65,94 @@ def configure(env): ## Dependencies - if not env['builtin_libwebp']: - env.ParseConfig('pkg-config libwebp --cflags --libs') + if not env["builtin_libwebp"]: + env.ParseConfig("pkg-config libwebp --cflags --libs") # freetype depends on libpng and zlib, so bundling one of them while keeping others # as shared libraries leads to weird issues - if env['builtin_freetype'] or env['builtin_libpng'] or env['builtin_zlib']: - env['builtin_freetype'] = True - env['builtin_libpng'] = True - env['builtin_zlib'] = True + if env["builtin_freetype"] or env["builtin_libpng"] or env["builtin_zlib"]: + env["builtin_freetype"] = True + env["builtin_libpng"] = True + env["builtin_zlib"] = True - if not env['builtin_freetype']: - env.ParseConfig('pkg-config freetype2 --cflags --libs') + if not env["builtin_freetype"]: + env.ParseConfig("pkg-config freetype2 --cflags --libs") - if not env['builtin_libpng']: - env.ParseConfig('pkg-config libpng16 --cflags --libs') + if not env["builtin_libpng"]: + env.ParseConfig("pkg-config libpng16 --cflags --libs") - if not env['builtin_bullet']: + if not env["builtin_bullet"]: # We need at least version 2.88 import subprocess - bullet_version = subprocess.check_output(['pkg-config', 'bullet', '--modversion']).strip() + + bullet_version = subprocess.check_output(["pkg-config", "bullet", "--modversion"]).strip() if bullet_version < "2.88": # Abort as system bullet was requested but too old - print("Bullet: System version {0} does not match minimal requirements ({1}). Aborting.".format(bullet_version, "2.88")) + print( + "Bullet: System version {0} does not match minimal requirements ({1}). Aborting.".format( + bullet_version, "2.88" + ) + ) sys.exit(255) - env.ParseConfig('pkg-config bullet --cflags --libs') + env.ParseConfig("pkg-config bullet --cflags --libs") - if not env['builtin_enet']: - env.ParseConfig('pkg-config libenet --cflags --libs') + if not env["builtin_enet"]: + env.ParseConfig("pkg-config libenet --cflags --libs") - if not env['builtin_squish']: - env.ParseConfig('pkg-config libsquish --cflags --libs') + if not env["builtin_squish"]: + env.ParseConfig("pkg-config libsquish --cflags --libs") - if not env['builtin_zstd']: - env.ParseConfig('pkg-config libzstd --cflags --libs') + if not env["builtin_zstd"]: + env.ParseConfig("pkg-config libzstd --cflags --libs") # Sound and video libraries # Keep the order as it triggers chained dependencies (ogg needed by others, etc.) - if not env['builtin_libtheora']: - env['builtin_libogg'] = False # Needed to link against system libtheora - env['builtin_libvorbis'] = False # Needed to link against system libtheora - env.ParseConfig('pkg-config theora theoradec --cflags --libs') + if not env["builtin_libtheora"]: + env["builtin_libogg"] = False # Needed to link against system libtheora + env["builtin_libvorbis"] = False # Needed to link against system libtheora + env.ParseConfig("pkg-config theora theoradec --cflags --libs") - if not env['builtin_libvpx']: - env.ParseConfig('pkg-config vpx --cflags --libs') + if not env["builtin_libvpx"]: + env.ParseConfig("pkg-config vpx --cflags --libs") - if not env['builtin_libvorbis']: - env['builtin_libogg'] = False # Needed to link against system libvorbis - env.ParseConfig('pkg-config vorbis vorbisfile --cflags --libs') + if not env["builtin_libvorbis"]: + env["builtin_libogg"] = False # Needed to link against system libvorbis + env.ParseConfig("pkg-config vorbis vorbisfile --cflags --libs") - if not env['builtin_opus']: - env['builtin_libogg'] = False # Needed to link against system opus - env.ParseConfig('pkg-config opus opusfile --cflags --libs') + if not env["builtin_opus"]: + env["builtin_libogg"] = False # Needed to link against system opus + env.ParseConfig("pkg-config opus opusfile --cflags --libs") - if not env['builtin_libogg']: - env.ParseConfig('pkg-config ogg --cflags --libs') + if not env["builtin_libogg"]: + env.ParseConfig("pkg-config ogg --cflags --libs") - if env['builtin_libtheora']: - list_of_x86 = ['x86_64', 'x86', 'i386', 'i586'] + if env["builtin_libtheora"]: + list_of_x86 = ["x86_64", "x86", "i386", "i586"] if any(platform.machine() in s for s in list_of_x86): env["x86_libtheora_opt_gcc"] = True - if not env['builtin_wslay']: - env.ParseConfig('pkg-config libwslay --cflags --libs') + if not env["builtin_wslay"]: + env.ParseConfig("pkg-config libwslay --cflags --libs") - if not env['builtin_mbedtls']: + if not env["builtin_mbedtls"]: # mbedTLS does not provide a pkgconfig config yet. See https://github.com/ARMmbed/mbedtls/issues/228 - env.Append(LIBS=['mbedtls', 'mbedcrypto', 'mbedx509']) + env.Append(LIBS=["mbedtls", "mbedcrypto", "mbedx509"]) - if not env['builtin_miniupnpc']: + if not env["builtin_miniupnpc"]: # No pkgconfig file so far, hardcode default paths. env.Prepend(CPPPATH=["/system/develop/headers/x86/miniupnpc"]) env.Append(LIBS=["miniupnpc"]) # On Linux wchar_t should be 32-bits # 16-bit library shouldn't be required due to compiler optimisations - if not env['builtin_pcre2']: - env.ParseConfig('pkg-config libpcre2-32 --cflags --libs') + if not env["builtin_pcre2"]: + env.ParseConfig("pkg-config libpcre2-32 --cflags --libs") ## Flags - env.Prepend(CPPPATH=['#platform/haiku']) - env.Append(CPPDEFINES=['UNIX_ENABLED', 'OPENGL_ENABLED', 'GLES_ENABLED']) - env.Append(CPPDEFINES=['MEDIA_KIT_ENABLED']) - env.Append(CPPDEFINES=['PTHREAD_NO_RENAME']) # TODO: enable when we have pthread_setname_np - env.Append(LIBS=['be', 'game', 'media', 'network', 'bnetapi', 'z', 'GL']) + env.Prepend(CPPPATH=["#platform/haiku"]) + env.Append(CPPDEFINES=["UNIX_ENABLED", "OPENGL_ENABLED", "GLES_ENABLED"]) + env.Append(CPPDEFINES=["MEDIA_KIT_ENABLED"]) + env.Append(CPPDEFINES=["PTHREAD_NO_RENAME"]) # TODO: enable when we have pthread_setname_np + env.Append(LIBS=["be", "game", "media", "network", "bnetapi", "z", "GL"]) diff --git a/platform/iphone/SCsub b/platform/iphone/SCsub index 1f82f51888..a48629f720 100644 --- a/platform/iphone/SCsub +++ b/platform/iphone/SCsub @@ -1,31 +1,35 @@ #!/usr/bin/env python -Import('env') +Import("env") iphone_lib = [ - 'godot_iphone.cpp', - 'os_iphone.cpp', - 'semaphore_iphone.cpp', - 'gl_view.mm', - 'main.m', - 'app_delegate.mm', - 'view_controller.mm', - 'game_center.mm', - 'in_app_store.mm', - 'icloud.mm', - 'ios.mm', - 'vulkan_context_iphone.mm', + "godot_iphone.cpp", + "os_iphone.cpp", + "semaphore_iphone.cpp", + "gl_view.mm", + "main.m", + "app_delegate.mm", + "view_controller.mm", + "game_center.mm", + "in_app_store.mm", + "icloud.mm", + "ios.mm", + "vulkan_context_iphone.mm", ] env_ios = env.Clone() -ios_lib = env_ios.add_library('iphone', iphone_lib) +ios_lib = env_ios.add_library("iphone", iphone_lib) + def combine_libs(target=None, source=None, env=None): lib_path = target[0].srcnode().abspath if "osxcross" in env: - libtool = '$IPHONEPATH/usr/bin/${ios_triple}libtool' + libtool = "$IPHONEPATH/usr/bin/${ios_triple}libtool" else: libtool = "$IPHONEPATH/usr/bin/libtool" - env.Execute(libtool + ' -static -o "' + lib_path + '" ' + ' '.join([('"' + lib.srcnode().abspath + '"') for lib in source])) + env.Execute( + libtool + ' -static -o "' + lib_path + '" ' + " ".join([('"' + lib.srcnode().abspath + '"') for lib in source]) + ) + -combine_command = env_ios.Command('#bin/libgodot' + env_ios['LIBSUFFIX'], [ios_lib] + env_ios['LIBS'], combine_libs) +combine_command = env_ios.Command("#bin/libgodot" + env_ios["LIBSUFFIX"], [ios_lib] + env_ios["LIBS"], combine_libs) diff --git a/platform/iphone/detect.py b/platform/iphone/detect.py index e01950c1db..3e6c2f0ecf 100644 --- a/platform/iphone/detect.py +++ b/platform/iphone/detect.py @@ -2,6 +2,7 @@ import os import sys from methods import detect_darwin_sdk_path + def is_active(): return True @@ -12,7 +13,7 @@ def get_name(): def can_build(): - if sys.platform == 'darwin' or ("OSXCROSS_IOS" in os.environ): + if sys.platform == "darwin" or ("OSXCROSS_IOS" in os.environ): return True return False @@ -20,22 +21,31 @@ def can_build(): def get_opts(): from SCons.Variables import BoolVariable + return [ - ('IPHONEPATH', 'Path to iPhone toolchain', '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain'), - ('IPHONESDK', 'Path to the iPhone SDK', ''), - BoolVariable('use_static_mvk', 'Link MoltenVK statically as Level-0 driver (better portability) or use Vulkan ICD loader (enables validation layers)', False), - BoolVariable('game_center', 'Support for game center', True), - BoolVariable('store_kit', 'Support for in-app store', True), - BoolVariable('icloud', 'Support for iCloud', True), - BoolVariable('ios_exceptions', 'Enable exceptions', False), - ('ios_triple', 'Triple for ios toolchain', ''), + ( + "IPHONEPATH", + "Path to iPhone toolchain", + "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain", + ), + ("IPHONESDK", "Path to the iPhone SDK", ""), + BoolVariable( + "use_static_mvk", + "Link MoltenVK statically as Level-0 driver (better portability) or use Vulkan ICD loader (enables validation layers)", + False, + ), + BoolVariable("game_center", "Support for game center", True), + BoolVariable("store_kit", "Support for in-app store", True), + BoolVariable("icloud", "Support for iCloud", True), + BoolVariable("ios_exceptions", "Enable exceptions", False), + ("ios_triple", "Triple for ios toolchain", ""), ] def get_flags(): return [ - ('tools', False), + ("tools", False), ] @@ -43,32 +53,32 @@ def configure(env): ## Build type - if (env["target"].startswith("release")): - env.Append(CPPDEFINES=['NDEBUG', ('NS_BLOCK_ASSERTIONS', 1)]) - if (env["optimize"] == "speed"): #optimize for speed (default) - env.Append(CCFLAGS=['-O2', '-ftree-vectorize', '-fomit-frame-pointer']) - env.Append(LINKFLAGS=['-O2']) - else: #optimize for size - env.Append(CCFLAGS=['-Os', '-ftree-vectorize']) - env.Append(LINKFLAGS=['-Os']) + if env["target"].startswith("release"): + env.Append(CPPDEFINES=["NDEBUG", ("NS_BLOCK_ASSERTIONS", 1)]) + if env["optimize"] == "speed": # optimize for speed (default) + env.Append(CCFLAGS=["-O2", "-ftree-vectorize", "-fomit-frame-pointer"]) + env.Append(LINKFLAGS=["-O2"]) + else: # optimize for size + env.Append(CCFLAGS=["-Os", "-ftree-vectorize"]) + env.Append(LINKFLAGS=["-Os"]) if env["target"] == "release_debug": - env.Append(CPPDEFINES=['DEBUG_ENABLED']) + env.Append(CPPDEFINES=["DEBUG_ENABLED"]) - elif (env["target"] == "debug"): - env.Append(CCFLAGS=['-gdwarf-2', '-O0']) - env.Append(CPPDEFINES=['_DEBUG', ('DEBUG', 1), 'DEBUG_ENABLED', 'DEBUG_MEMORY_ENABLED']) + elif env["target"] == "debug": + env.Append(CCFLAGS=["-gdwarf-2", "-O0"]) + env.Append(CPPDEFINES=["_DEBUG", ("DEBUG", 1), "DEBUG_ENABLED", "DEBUG_MEMORY_ENABLED"]) - if (env["use_lto"]): - env.Append(CCFLAGS=['-flto']) - env.Append(LINKFLAGS=['-flto']) + if env["use_lto"]: + env.Append(CCFLAGS=["-flto"]) + env.Append(LINKFLAGS=["-flto"]) ## Architecture if env["arch"] == "x86": # i386 env["bits"] = "32" elif env["arch"] == "x86_64": env["bits"] = "64" - elif (env["arch"] == "arm" or env["arch"] == "arm32" or env["arch"] == "armv7" or env["bits"] == "32"): # arm + elif env["arch"] == "arm" or env["arch"] == "arm32" or env["arch"] == "armv7" or env["bits"] == "32": # arm env["arch"] = "arm" env["bits"] = "32" else: # armv64 @@ -81,108 +91,145 @@ def configure(env): if "OSXCROSS_IOS" in os.environ: env["osxcross"] = True - env['ENV']['PATH'] = env['IPHONEPATH'] + "/Developer/usr/bin/:" + env['ENV']['PATH'] + env["ENV"]["PATH"] = env["IPHONEPATH"] + "/Developer/usr/bin/:" + env["ENV"]["PATH"] - compiler_path = '$IPHONEPATH/usr/bin/${ios_triple}' - s_compiler_path = '$IPHONEPATH/Developer/usr/bin/' + compiler_path = "$IPHONEPATH/usr/bin/${ios_triple}" + s_compiler_path = "$IPHONEPATH/Developer/usr/bin/" ccache_path = os.environ.get("CCACHE") if ccache_path is None: - env['CC'] = compiler_path + 'clang' - env['CXX'] = compiler_path + 'clang++' - env['S_compiler'] = s_compiler_path + 'gcc' + env["CC"] = compiler_path + "clang" + env["CXX"] = compiler_path + "clang++" + env["S_compiler"] = s_compiler_path + "gcc" else: # there aren't any ccache wrappers available for iOS, # to enable caching we need to prepend the path to the ccache binary - env['CC'] = ccache_path + ' ' + compiler_path + 'clang' - env['CXX'] = ccache_path + ' ' + compiler_path + 'clang++' - env['S_compiler'] = ccache_path + ' ' + s_compiler_path + 'gcc' - env['AR'] = compiler_path + 'ar' - env['RANLIB'] = compiler_path + 'ranlib' + env["CC"] = ccache_path + " " + compiler_path + "clang" + env["CXX"] = ccache_path + " " + compiler_path + "clang++" + env["S_compiler"] = ccache_path + " " + s_compiler_path + "gcc" + env["AR"] = compiler_path + "ar" + env["RANLIB"] = compiler_path + "ranlib" ## Compile flags - if (env["arch"] == "x86" or env["arch"] == "x86_64"): - detect_darwin_sdk_path('iphonesimulator', env) - env['ENV']['MACOSX_DEPLOYMENT_TARGET'] = '10.9' + if env["arch"] == "x86" or env["arch"] == "x86_64": + detect_darwin_sdk_path("iphonesimulator", env) + env["ENV"]["MACOSX_DEPLOYMENT_TARGET"] = "10.9" arch_flag = "i386" if env["arch"] == "x86" else env["arch"] - env.Append(CCFLAGS=('-arch ' + arch_flag + ' -fobjc-abi-version=2 -fobjc-legacy-dispatch -fmessage-length=0 -fpascal-strings -fblocks -fasm-blocks -isysroot $IPHONESDK -mios-simulator-version-min=10.0').split()) - elif (env["arch"] == "arm"): - detect_darwin_sdk_path('iphone', env) - env.Append(CCFLAGS='-fno-objc-arc -arch armv7 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -fpascal-strings -fblocks -isysroot $IPHONESDK -fvisibility=hidden -mthumb "-DIBOutlet=__attribute__((iboutlet))" "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))" "-DIBAction=void)__attribute__((ibaction)" -miphoneos-version-min=10.0 -MMD -MT dependencies'.split()) - elif (env["arch"] == "arm64"): - detect_darwin_sdk_path('iphone', env) - env.Append(CCFLAGS='-fno-objc-arc -arch arm64 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -fpascal-strings -fblocks -fvisibility=hidden -MMD -MT dependencies -miphoneos-version-min=10.0 -isysroot $IPHONESDK'.split()) - env.Append(CPPDEFINES=['NEED_LONG_INT']) - env.Append(CPPDEFINES=['LIBYUV_DISABLE_NEON']) + env.Append( + CCFLAGS=( + "-arch " + + arch_flag + + " -fobjc-abi-version=2 -fobjc-legacy-dispatch -fmessage-length=0 -fpascal-strings -fblocks -fasm-blocks -isysroot $IPHONESDK -mios-simulator-version-min=10.0" + ).split() + ) + elif env["arch"] == "arm": + detect_darwin_sdk_path("iphone", env) + env.Append( + CCFLAGS='-fno-objc-arc -arch armv7 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -fpascal-strings -fblocks -isysroot $IPHONESDK -fvisibility=hidden -mthumb "-DIBOutlet=__attribute__((iboutlet))" "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))" "-DIBAction=void)__attribute__((ibaction)" -miphoneos-version-min=10.0 -MMD -MT dependencies'.split() + ) + elif env["arch"] == "arm64": + detect_darwin_sdk_path("iphone", env) + env.Append( + CCFLAGS="-fno-objc-arc -arch arm64 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -fpascal-strings -fblocks -fvisibility=hidden -MMD -MT dependencies -miphoneos-version-min=10.0 -isysroot $IPHONESDK".split() + ) + env.Append(CPPDEFINES=["NEED_LONG_INT"]) + env.Append(CPPDEFINES=["LIBYUV_DISABLE_NEON"]) # Disable exceptions on non-tools (template) builds - if not env['tools']: - if env['ios_exceptions']: - env.Append(CCFLAGS=['-fexceptions']) + if not env["tools"]: + if env["ios_exceptions"]: + env.Append(CCFLAGS=["-fexceptions"]) else: - env.Append(CCFLAGS=['-fno-exceptions']) + env.Append(CCFLAGS=["-fno-exceptions"]) ## Link flags - if (env["arch"] == "x86" or env["arch"] == "x86_64"): + if env["arch"] == "x86" or env["arch"] == "x86_64": arch_flag = "i386" if env["arch"] == "x86" else env["arch"] - env.Append(LINKFLAGS=['-arch', arch_flag, '-mios-simulator-version-min=10.0', - '-isysroot', '$IPHONESDK', - '-Xlinker', - '-objc_abi_version', - '-Xlinker', '2', - '-F$IPHONESDK', - ]) - elif (env["arch"] == "arm"): - env.Append(LINKFLAGS=['-arch', 'armv7', '-Wl,-dead_strip', '-miphoneos-version-min=10.0']) - if (env["arch"] == "arm64"): - env.Append(LINKFLAGS=['-arch', 'arm64', '-Wl,-dead_strip', '-miphoneos-version-min=10.0']) - - env.Append(LINKFLAGS=['-isysroot', '$IPHONESDK', - '-framework', 'AudioToolbox', - '-framework', 'AVFoundation', - '-framework', 'CoreAudio', - '-framework', 'CoreGraphics', - '-framework', 'CoreMedia', - '-framework', 'CoreVideo', - '-framework', 'CoreMotion', - '-framework', 'Foundation', - '-framework', 'GameController', - '-framework', 'MediaPlayer', - '-framework', 'Metal', - '-framework', 'QuartzCore', - '-framework', 'Security', - '-framework', 'SystemConfiguration', - '-framework', 'UIKit', - '-framework', 'ARKit', - ]) + env.Append( + LINKFLAGS=[ + "-arch", + arch_flag, + "-mios-simulator-version-min=10.0", + "-isysroot", + "$IPHONESDK", + "-Xlinker", + "-objc_abi_version", + "-Xlinker", + "2", + "-F$IPHONESDK", + ] + ) + elif env["arch"] == "arm": + env.Append(LINKFLAGS=["-arch", "armv7", "-Wl,-dead_strip", "-miphoneos-version-min=10.0"]) + if env["arch"] == "arm64": + env.Append(LINKFLAGS=["-arch", "arm64", "-Wl,-dead_strip", "-miphoneos-version-min=10.0"]) + + env.Append( + LINKFLAGS=[ + "-isysroot", + "$IPHONESDK", + "-framework", + "AudioToolbox", + "-framework", + "AVFoundation", + "-framework", + "CoreAudio", + "-framework", + "CoreGraphics", + "-framework", + "CoreMedia", + "-framework", + "CoreVideo", + "-framework", + "CoreMotion", + "-framework", + "Foundation", + "-framework", + "GameController", + "-framework", + "MediaPlayer", + "-framework", + "Metal", + "-framework", + "QuartzCore", + "-framework", + "Security", + "-framework", + "SystemConfiguration", + "-framework", + "UIKit", + "-framework", + "ARKit", + ] + ) # Feature options - if env['game_center']: - env.Append(CPPDEFINES=['GAME_CENTER_ENABLED']) - env.Append(LINKFLAGS=['-framework', 'GameKit']) + if env["game_center"]: + env.Append(CPPDEFINES=["GAME_CENTER_ENABLED"]) + env.Append(LINKFLAGS=["-framework", "GameKit"]) - if env['store_kit']: - env.Append(CPPDEFINES=['STOREKIT_ENABLED']) - env.Append(LINKFLAGS=['-framework', 'StoreKit']) + if env["store_kit"]: + env.Append(CPPDEFINES=["STOREKIT_ENABLED"]) + env.Append(LINKFLAGS=["-framework", "StoreKit"]) - if env['icloud']: - env.Append(CPPDEFINES=['ICLOUD_ENABLED']) + if env["icloud"]: + env.Append(CPPDEFINES=["ICLOUD_ENABLED"]) - env.Prepend(CPPPATH=['$IPHONESDK/usr/include', - '$IPHONESDK/System/Library/Frameworks/AudioUnit.framework/Headers', - ]) + env.Prepend( + CPPPATH=["$IPHONESDK/usr/include", "$IPHONESDK/System/Library/Frameworks/AudioUnit.framework/Headers",] + ) - env['ENV']['CODESIGN_ALLOCATE'] = '/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate' + env["ENV"]["CODESIGN_ALLOCATE"] = "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate" - env.Prepend(CPPPATH=['#platform/iphone']) - env.Append(CPPDEFINES=['IPHONE_ENABLED', 'UNIX_ENABLED', 'COREAUDIO_ENABLED']) + env.Prepend(CPPPATH=["#platform/iphone"]) + env.Append(CPPDEFINES=["IPHONE_ENABLED", "UNIX_ENABLED", "COREAUDIO_ENABLED"]) - env.Append(CPPDEFINES=['VULKAN_ENABLED']) - env.Append(LINKFLAGS=['-framework', 'IOSurface']) - if (env['use_static_mvk']): - env.Append(LINKFLAGS=['-framework', 'MoltenVK']) - env['builtin_vulkan'] = False - elif not env['builtin_vulkan']: - env.Append(LIBS=['vulkan']) + env.Append(CPPDEFINES=["VULKAN_ENABLED"]) + env.Append(LINKFLAGS=["-framework", "IOSurface"]) + if env["use_static_mvk"]: + env.Append(LINKFLAGS=["-framework", "MoltenVK"]) + env["builtin_vulkan"] = False + elif not env["builtin_vulkan"]: + env.Append(LIBS=["vulkan"]) diff --git a/platform/iphone/export/export.cpp b/platform/iphone/export/export.cpp index 08f3c3f91f..2d190cfdc5 100644 --- a/platform/iphone/export/export.cpp +++ b/platform/iphone/export/export.cpp @@ -71,8 +71,8 @@ class EditorExportPlatformIOS : public EditorExportPlatform { String modules_buildphase; String modules_buildgrp; }; - struct ExportArchitecture { + String name; bool is_default; @@ -795,7 +795,7 @@ void EditorExportPlatformIOS::_add_assets_to_project(const Ref<EditorExportPrese String pbx_resources_refs; const String file_info_format = String("$build_id = {isa = PBXBuildFile; fileRef = $ref_id; };\n") + - "$ref_id = {isa = PBXFileReference; lastKnownFileType = $file_type; name = $name; path = \"$file_path\"; sourceTree = \"<group>\"; };\n"; + "$ref_id = {isa = PBXFileReference; lastKnownFileType = $file_type; name = \"$name\"; path = \"$file_path\"; sourceTree = \"<group>\"; };\n"; for (int i = 0; i < p_additional_assets.size(); ++i) { String build_id = (++current_id).str(); String ref_id = (++current_id).str(); @@ -925,6 +925,13 @@ Error EditorExportPlatformIOS::_export_additional_assets(const String &p_out_dir Vector<String> frameworks = export_plugins[i]->get_ios_frameworks(); Error err = _export_additional_assets(p_out_dir, frameworks, true, r_exported_assets); ERR_FAIL_COND_V(err, err); + + Vector<String> project_static_libs = export_plugins[i]->get_ios_project_static_libs(); + for (int j = 0; j < project_static_libs.size(); j++) + project_static_libs.write[j] = project_static_libs[j].get_file(); // Only the file name as it's copied to the project + err = _export_additional_assets(p_out_dir, project_static_libs, true, r_exported_assets); + ERR_FAIL_COND_V(err, err); + Vector<String> ios_bundle_files = export_plugins[i]->get_ios_bundle_files(); err = _export_additional_assets(p_out_dir, ios_bundle_files, false, r_exported_assets); ERR_FAIL_COND_V(err, err); @@ -1202,6 +1209,22 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p return ERR_FILE_NOT_FOUND; } + // Copy project static libs to the project + Vector<Ref<EditorExportPlugin>> export_plugins = EditorExport::get_singleton()->get_export_plugins(); + for (int i = 0; i < export_plugins.size(); i++) { + Vector<String> project_static_libs = export_plugins[i]->get_ios_project_static_libs(); + for (int j = 0; j < project_static_libs.size(); j++) { + const String &static_lib_path = project_static_libs[j]; + String dest_lib_file_path = dest_dir + static_lib_path.get_file(); + Error lib_copy_err = tmp_app_path->copy(static_lib_path, dest_lib_file_path); + if (lib_copy_err != OK) { + ERR_PRINT("Can't copy '" + static_lib_path + "'."); + memdelete(tmp_app_path); + return lib_copy_err; + } + } + } + String iconset_dir = dest_dir + binary_name + "/Images.xcassets/AppIcon.appiconset/"; err = OK; if (!tmp_app_path->dir_exists(iconset_dir)) { diff --git a/platform/javascript/SCsub b/platform/javascript/SCsub index d3cd8f76b7..7239648937 100644 --- a/platform/javascript/SCsub +++ b/platform/javascript/SCsub @@ -1,67 +1,63 @@ #!/usr/bin/env python -Import('env') +Import("env") javascript_files = [ - 'audio_driver_javascript.cpp', - 'http_client_javascript.cpp', - 'javascript_eval.cpp', - 'javascript_main.cpp', - 'os_javascript.cpp', + "audio_driver_javascript.cpp", + "http_client_javascript.cpp", + "javascript_eval.cpp", + "javascript_main.cpp", + "os_javascript.cpp", ] -build_targets = ['#bin/godot${PROGSUFFIX}.js', '#bin/godot${PROGSUFFIX}.wasm'] -if env['threads_enabled']: - build_targets.append('#bin/godot${PROGSUFFIX}.worker.js') +build_targets = ["#bin/godot${PROGSUFFIX}.js", "#bin/godot${PROGSUFFIX}.wasm"] +if env["threads_enabled"]: + build_targets.append("#bin/godot${PROGSUFFIX}.worker.js") build = env.add_program(build_targets, javascript_files) js_libraries = [ - 'http_request.js', + "http_request.js", ] for lib in js_libraries: - env.Append(LINKFLAGS=['--js-library', env.File(lib).path]) + env.Append(LINKFLAGS=["--js-library", env.File(lib).path]) env.Depends(build, js_libraries) js_modules = [ - 'id_handler.js', + "id_handler.js", ] for module in js_modules: - env.Append(LINKFLAGS=['--pre-js', env.File(module).path]) + env.Append(LINKFLAGS=["--pre-js", env.File(module).path]) env.Depends(build, js_modules) engine = [ - 'engine/preloader.js', - 'engine/loader.js', - 'engine/utils.js', - 'engine/engine.js', + "engine/preloader.js", + "engine/loader.js", + "engine/utils.js", + "engine/engine.js", ] -externs = [ - env.File('#platform/javascript/engine/externs.js') -] -js_engine = env.CreateEngineFile('#bin/godot${PROGSUFFIX}.engine.js', engine, externs) +externs = [env.File("#platform/javascript/engine/externs.js")] +js_engine = env.CreateEngineFile("#bin/godot${PROGSUFFIX}.engine.js", engine, externs) env.Depends(js_engine, externs) wrap_list = [ build[0], js_engine, ] -js_wrapped = env.Textfile('#bin/godot', [env.File(f) for f in wrap_list], TEXTFILESUFFIX='${PROGSUFFIX}.wrapped.js') +js_wrapped = env.Textfile("#bin/godot", [env.File(f) for f in wrap_list], TEXTFILESUFFIX="${PROGSUFFIX}.wrapped.js") -zip_dir = env.Dir('#bin/.javascript_zip') -out_files = [ - zip_dir.File('godot.js'), - zip_dir.File('godot.wasm'), - zip_dir.File('godot.html') -] -in_files = [ - js_wrapped, - build[1], - '#misc/dist/html/full-size.html' -] -if env['threads_enabled']: +zip_dir = env.Dir("#bin/.javascript_zip") +out_files = [zip_dir.File("godot.js"), zip_dir.File("godot.wasm"), zip_dir.File("godot.html")] +in_files = [js_wrapped, build[1], "#misc/dist/html/full-size.html"] +if env["threads_enabled"]: in_files.append(build[2]) - out_files.append(zip_dir.File('godot.worker.js')) + out_files.append(zip_dir.File("godot.worker.js")) zip_files = env.InstallAs(out_files, in_files) -env.Zip('#bin/godot', zip_files, ZIPROOT=zip_dir, ZIPSUFFIX='${PROGSUFFIX}${ZIPSUFFIX}', ZIPCOMSTR='Archving $SOURCES as $TARGET') +env.Zip( + "#bin/godot", + zip_files, + ZIPROOT=zip_dir, + ZIPSUFFIX="${PROGSUFFIX}${ZIPSUFFIX}", + ZIPCOMSTR="Archving $SOURCES as $TARGET", +) diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py index fb02752aa7..9486e10717 100644 --- a/platform/javascript/detect.py +++ b/platform/javascript/detect.py @@ -2,37 +2,39 @@ import os from emscripten_helpers import parse_config, run_closure_compiler, create_engine_file + def is_active(): return True def get_name(): - return 'JavaScript' + return "JavaScript" def can_build(): - return 'EM_CONFIG' in os.environ or os.path.exists(os.path.expanduser('~/.emscripten')) + return "EM_CONFIG" in os.environ or os.path.exists(os.path.expanduser("~/.emscripten")) def get_opts(): from SCons.Variables import BoolVariable + return [ # eval() can be a security concern, so it can be disabled. - BoolVariable('javascript_eval', 'Enable JavaScript eval interface', True), - BoolVariable('threads_enabled', 'Enable WebAssembly Threads support (limited browser support)', False), - BoolVariable('use_closure_compiler', 'Use closure compiler to minimize Javascript code', False), + BoolVariable("javascript_eval", "Enable JavaScript eval interface", True), + BoolVariable("threads_enabled", "Enable WebAssembly Threads support (limited browser support)", False), + BoolVariable("use_closure_compiler", "Use closure compiler to minimize Javascript code", False), ] def get_flags(): return [ - ('tools', False), - ('builtin_pcre2_with_jit', False), + ("tools", False), + ("builtin_pcre2_with_jit", False), # Disabling the mbedtls module reduces file size. # The module has little use due to the limited networking functionality # in this platform. For the available networking methods, the browser # manages TLS. - ('module_mbedtls_enabled', False), + ("module_mbedtls_enabled", False), ] @@ -40,125 +42,125 @@ def configure(env): ## Build type - if env['target'] == 'release': + if env["target"] == "release": # Use -Os to prioritize optimizing for reduced file size. This is # particularly valuable for the web platform because it directly # decreases download time. # -Os reduces file size by around 5 MiB over -O3. -Oz only saves about # 100 KiB over -Os, which does not justify the negative impact on # run-time performance. - env.Append(CCFLAGS=['-Os']) - env.Append(LINKFLAGS=['-Os']) - elif env['target'] == 'release_debug': - env.Append(CCFLAGS=['-Os']) - env.Append(LINKFLAGS=['-Os']) - env.Append(CPPDEFINES=['DEBUG_ENABLED']) + env.Append(CCFLAGS=["-Os"]) + env.Append(LINKFLAGS=["-Os"]) + elif env["target"] == "release_debug": + env.Append(CCFLAGS=["-Os"]) + env.Append(LINKFLAGS=["-Os"]) + env.Append(CPPDEFINES=["DEBUG_ENABLED"]) # Retain function names for backtraces at the cost of file size. - env.Append(LINKFLAGS=['--profiling-funcs']) - else: # 'debug' - env.Append(CPPDEFINES=['DEBUG_ENABLED']) - env.Append(CCFLAGS=['-O1', '-g']) - env.Append(LINKFLAGS=['-O1', '-g']) - env.Append(LINKFLAGS=['-s', 'ASSERTIONS=1']) - - if env['tools']: - if not env['threads_enabled']: - raise RuntimeError("Threads must be enabled to build the editor. Please add the 'threads_enabled=yes' option") + env.Append(LINKFLAGS=["--profiling-funcs"]) + else: # 'debug' + env.Append(CPPDEFINES=["DEBUG_ENABLED"]) + env.Append(CCFLAGS=["-O1", "-g"]) + env.Append(LINKFLAGS=["-O1", "-g"]) + env.Append(LINKFLAGS=["-s", "ASSERTIONS=1"]) + + if env["tools"]: + if not env["threads_enabled"]: + raise RuntimeError( + "Threads must be enabled to build the editor. Please add the 'threads_enabled=yes' option" + ) # Tools need more memory. Initial stack memory in bytes. See `src/settings.js` in emscripten repository (will be renamed to INITIAL_MEMORY). - env.Append(LINKFLAGS=['-s', 'TOTAL_MEMORY=33554432']) + env.Append(LINKFLAGS=["-s", "TOTAL_MEMORY=33554432"]) else: # Disable exceptions and rtti on non-tools (template) builds # These flags help keep the file size down. - env.Append(CCFLAGS=['-fno-exceptions', '-fno-rtti']) + env.Append(CCFLAGS=["-fno-exceptions", "-fno-rtti"]) # Don't use dynamic_cast, necessary with no-rtti. - env.Append(CPPDEFINES=['NO_SAFE_CAST']) + env.Append(CPPDEFINES=["NO_SAFE_CAST"]) ## Copy env variables. - env['ENV'] = os.environ + env["ENV"] = os.environ # LTO - if env['use_lto']: - env.Append(CCFLAGS=['-s', 'WASM_OBJECT_FILES=0']) - env.Append(LINKFLAGS=['-s', 'WASM_OBJECT_FILES=0']) - env.Append(LINKFLAGS=['--llvm-lto', '1']) + if env["use_lto"]: + env.Append(CCFLAGS=["-s", "WASM_OBJECT_FILES=0"]) + env.Append(LINKFLAGS=["-s", "WASM_OBJECT_FILES=0"]) + env.Append(LINKFLAGS=["--llvm-lto", "1"]) # Closure compiler - if env['use_closure_compiler']: + if env["use_closure_compiler"]: # For emscripten support code. - env.Append(LINKFLAGS=['--closure', '1']) + env.Append(LINKFLAGS=["--closure", "1"]) # Register builder for our Engine files - jscc = env.Builder(generator=run_closure_compiler, suffix='.cc.js', src_suffix='.js') - env.Append(BUILDERS = {'BuildJS' : jscc}) + jscc = env.Builder(generator=run_closure_compiler, suffix=".cc.js", src_suffix=".js") + env.Append(BUILDERS={"BuildJS": jscc}) # Add method that joins/compiles our Engine files. env.AddMethod(create_engine_file, "CreateEngineFile") # Closure compiler extern and support for ecmascript specs (const, let, etc). - env['ENV']['EMCC_CLOSURE_ARGS'] = '--language_in ECMASCRIPT6' + env["ENV"]["EMCC_CLOSURE_ARGS"] = "--language_in ECMASCRIPT6" em_config = parse_config() - env.PrependENVPath('PATH', em_config['EMCC_ROOT']) + env.PrependENVPath("PATH", em_config["EMCC_ROOT"]) - env['CC'] = 'emcc' - env['CXX'] = 'em++' - env['LINK'] = 'emcc' + env["CC"] = "emcc" + env["CXX"] = "em++" + env["LINK"] = "emcc" - env['AR'] = 'emar' - env['RANLIB'] = 'emranlib' + env["AR"] = "emar" + env["RANLIB"] = "emranlib" # Use TempFileMunge since some AR invocations are too long for cmd.exe. # Use POSIX-style paths, required with TempFileMunge. - env['ARCOM_POSIX'] = env['ARCOM'].replace( - '$TARGET', '$TARGET.posix').replace( - '$SOURCES', '$SOURCES.posix') - env['ARCOM'] = '${TEMPFILE(ARCOM_POSIX)}' + env["ARCOM_POSIX"] = env["ARCOM"].replace("$TARGET", "$TARGET.posix").replace("$SOURCES", "$SOURCES.posix") + env["ARCOM"] = "${TEMPFILE(ARCOM_POSIX)}" # All intermediate files are just LLVM bitcode. - env['OBJPREFIX'] = '' - env['OBJSUFFIX'] = '.bc' - env['PROGPREFIX'] = '' + env["OBJPREFIX"] = "" + env["OBJSUFFIX"] = ".bc" + env["PROGPREFIX"] = "" # Program() output consists of multiple files, so specify suffixes manually at builder. - env['PROGSUFFIX'] = '' - env['LIBPREFIX'] = 'lib' - env['LIBSUFFIX'] = '.bc' - env['LIBPREFIXES'] = ['$LIBPREFIX'] - env['LIBSUFFIXES'] = ['$LIBSUFFIX'] + env["PROGSUFFIX"] = "" + env["LIBPREFIX"] = "lib" + env["LIBSUFFIX"] = ".bc" + env["LIBPREFIXES"] = ["$LIBPREFIX"] + env["LIBSUFFIXES"] = ["$LIBSUFFIX"] - env.Prepend(CPPPATH=['#platform/javascript']) - env.Append(CPPDEFINES=['JAVASCRIPT_ENABLED', 'UNIX_ENABLED']) + env.Prepend(CPPPATH=["#platform/javascript"]) + env.Append(CPPDEFINES=["JAVASCRIPT_ENABLED", "UNIX_ENABLED"]) - if env['javascript_eval']: - env.Append(CPPDEFINES=['JAVASCRIPT_EVAL_ENABLED']) + if env["javascript_eval"]: + env.Append(CPPDEFINES=["JAVASCRIPT_EVAL_ENABLED"]) # Thread support (via SharedArrayBuffer). - if env['threads_enabled']: - env.Append(CPPDEFINES=['PTHREAD_NO_RENAME']) - env.Append(CCFLAGS=['-s', 'USE_PTHREADS=1']) - env.Append(LINKFLAGS=['-s', 'USE_PTHREADS=1']) - env.Append(LINKFLAGS=['-s', 'PTHREAD_POOL_SIZE=4']) - env.Append(LINKFLAGS=['-s', 'WASM_MEM_MAX=2048MB']) + if env["threads_enabled"]: + env.Append(CPPDEFINES=["PTHREAD_NO_RENAME"]) + env.Append(CCFLAGS=["-s", "USE_PTHREADS=1"]) + env.Append(LINKFLAGS=["-s", "USE_PTHREADS=1"]) + env.Append(LINKFLAGS=["-s", "PTHREAD_POOL_SIZE=4"]) + env.Append(LINKFLAGS=["-s", "WASM_MEM_MAX=2048MB"]) else: - env.Append(CPPDEFINES=['NO_THREADS']) + env.Append(CPPDEFINES=["NO_THREADS"]) # Reduce code size by generating less support code (e.g. skip NodeJS support). - env.Append(LINKFLAGS=['-s', 'ENVIRONMENT=web,worker']) + env.Append(LINKFLAGS=["-s", "ENVIRONMENT=web,worker"]) # We use IDBFS in javascript_main.cpp. Since Emscripten 1.39.1 it needs to # be linked explicitly. - env.Append(LIBS=['idbfs.js']) + env.Append(LIBS=["idbfs.js"]) - env.Append(LINKFLAGS=['-s', 'BINARYEN=1']) - env.Append(LINKFLAGS=['-s', 'MODULARIZE=1', '-s', 'EXPORT_NAME="Godot"']) + env.Append(LINKFLAGS=["-s", "BINARYEN=1"]) + env.Append(LINKFLAGS=["-s", "MODULARIZE=1", "-s", 'EXPORT_NAME="Godot"']) # Allow increasing memory buffer size during runtime. This is efficient # when using WebAssembly (in comparison to asm.js) and works well for # us since we don't know requirements at compile-time. - env.Append(LINKFLAGS=['-s', 'ALLOW_MEMORY_GROWTH=1']) + env.Append(LINKFLAGS=["-s", "ALLOW_MEMORY_GROWTH=1"]) # This setting just makes WebGL 2 APIs available, it does NOT disable WebGL 1. - env.Append(LINKFLAGS=['-s', 'USE_WEBGL2=1']) + env.Append(LINKFLAGS=["-s", "USE_WEBGL2=1"]) - env.Append(LINKFLAGS=['-s', 'INVOKE_RUN=0']) + env.Append(LINKFLAGS=["-s", "INVOKE_RUN=0"]) # callMain for manual start, FS for preloading. - env.Append(LINKFLAGS=['-s', 'EXTRA_EXPORTED_RUNTIME_METHODS=["callMain", "FS"]']) + env.Append(LINKFLAGS=["-s", 'EXTRA_EXPORTED_RUNTIME_METHODS=["callMain", "FS"]']) diff --git a/platform/javascript/emscripten_helpers.py b/platform/javascript/emscripten_helpers.py index bda5b40a74..a55c9d3f48 100644 --- a/platform/javascript/emscripten_helpers.py +++ b/platform/javascript/emscripten_helpers.py @@ -1,7 +1,8 @@ import os + def parse_config(): - em_config_file = os.getenv('EM_CONFIG') or os.path.expanduser('~/.emscripten') + em_config_file = os.getenv("EM_CONFIG") or os.path.expanduser("~/.emscripten") if not os.path.exists(em_config_file): raise RuntimeError("Emscripten configuration file '%s' does not exist" % em_config_file) @@ -13,25 +14,25 @@ def parse_config(): exec(f.read(), em_config) except StandardError as e: raise RuntimeError("Emscripten configuration file '%s' is invalid:\n%s" % (em_config_file, e)) - normalized['EMCC_ROOT'] = em_config.get('EMSCRIPTEN_ROOT') - normalized['NODE_JS'] = em_config.get('NODE_JS') - normalized['CLOSURE_BIN'] = os.path.join(normalized['EMCC_ROOT'], 'node_modules', '.bin', 'google-closure-compiler') + normalized["EMCC_ROOT"] = em_config.get("EMSCRIPTEN_ROOT") + normalized["NODE_JS"] = em_config.get("NODE_JS") + normalized["CLOSURE_BIN"] = os.path.join(normalized["EMCC_ROOT"], "node_modules", ".bin", "google-closure-compiler") return normalized def run_closure_compiler(target, source, env, for_signature): cfg = parse_config() - cmd = [cfg['NODE_JS'], cfg['CLOSURE_BIN']] - cmd.extend(['--compilation_level', 'ADVANCED_OPTIMIZATIONS']) - for f in env['JSEXTERNS']: - cmd.extend(['--externs', f.get_abspath()]) + cmd = [cfg["NODE_JS"], cfg["CLOSURE_BIN"]] + cmd.extend(["--compilation_level", "ADVANCED_OPTIMIZATIONS"]) + for f in env["JSEXTERNS"]: + cmd.extend(["--externs", f.get_abspath()]) for f in source: - cmd.extend(['--js', f.get_abspath()]) - cmd.extend(['--js_output_file', target[0].get_abspath()]) - return ' '.join(cmd) + cmd.extend(["--js", f.get_abspath()]) + cmd.extend(["--js_output_file", target[0].get_abspath()]) + return " ".join(cmd) def create_engine_file(env, target, source, externs): - if env['use_closure_compiler']: + if env["use_closure_compiler"]: return env.BuildJS(target, source, JSEXTERNS=externs) return env.Textfile(target, [env.File(s) for s in source]) diff --git a/platform/linuxbsd/SCsub b/platform/linuxbsd/SCsub index f3f65e216e..ae75a75830 100644 --- a/platform/linuxbsd/SCsub +++ b/platform/linuxbsd/SCsub @@ -1,6 +1,6 @@ #!/usr/bin/env python -Import('env') +Import("env") from platform_methods import run_in_subprocess import platform_linuxbsd_builders @@ -14,10 +14,9 @@ common_x11 = [ "display_server_x11.cpp", "vulkan_context_x11.cpp", "key_mapping_x11.cpp", - ] -prog = env.add_program('#bin/godot', ['godot_linuxbsd.cpp'] + common_x11) +prog = env.add_program("#bin/godot", ["godot_linuxbsd.cpp"] + common_x11) if (env["debug_symbols"] == "full" or env["debug_symbols"] == "yes") and env["separate_debug_symbols"]: env.AddPostAction(prog, run_in_subprocess(platform_linuxbsd_builders.make_debug_linuxbsd)) diff --git a/platform/linuxbsd/detect.py b/platform/linuxbsd/detect.py index 1a395efffe..5d8b4fba48 100644 --- a/platform/linuxbsd/detect.py +++ b/platform/linuxbsd/detect.py @@ -13,64 +13,65 @@ def get_name(): def can_build(): - if (os.name != "posix" or sys.platform == "darwin"): + if os.name != "posix" or sys.platform == "darwin": return False # Check the minimal dependencies x11_error = os.system("pkg-config --version > /dev/null") - if (x11_error): + if x11_error: return False x11_error = os.system("pkg-config x11 --modversion > /dev/null ") - if (x11_error): + if x11_error: return False x11_error = os.system("pkg-config xcursor --modversion > /dev/null ") - if (x11_error): + if x11_error: print("xcursor not found.. x11 disabled.") return False x11_error = os.system("pkg-config xinerama --modversion > /dev/null ") - if (x11_error): + if x11_error: print("xinerama not found.. x11 disabled.") return False x11_error = os.system("pkg-config xrandr --modversion > /dev/null ") - if (x11_error): + if x11_error: print("xrandr not found.. x11 disabled.") return False x11_error = os.system("pkg-config xrender --modversion > /dev/null ") - if (x11_error): + if x11_error: print("xrender not found.. x11 disabled.") return False x11_error = os.system("pkg-config xi --modversion > /dev/null ") - if (x11_error): + if x11_error: print("xi not found.. Aborting.") return False return True + def get_opts(): from SCons.Variables import BoolVariable, EnumVariable return [ - BoolVariable('use_llvm', 'Use the LLVM compiler', False), - BoolVariable('use_lld', 'Use the LLD linker', False), - BoolVariable('use_thinlto', 'Use ThinLTO', False), - BoolVariable('use_static_cpp', 'Link libgcc and libstdc++ statically for better portability', False), - BoolVariable('use_coverage', 'Test Godot coverage', False), - BoolVariable('use_ubsan', 'Use LLVM/GCC compiler undefined behavior sanitizer (UBSAN)', False), - BoolVariable('use_asan', 'Use LLVM/GCC compiler address sanitizer (ASAN))', False), - BoolVariable('use_lsan', 'Use LLVM/GCC compiler leak sanitizer (LSAN))', False), - BoolVariable('use_tsan', 'Use LLVM/GCC compiler thread sanitizer (TSAN))', False), - BoolVariable('pulseaudio', 'Detect and use PulseAudio', True), - BoolVariable('udev', 'Use udev for gamepad connection callbacks', False), - EnumVariable('debug_symbols', 'Add debugging symbols to release builds', 'yes', ('yes', 'no', 'full')), - BoolVariable('separate_debug_symbols', 'Create a separate file containing debugging symbols', False), - BoolVariable('touch', 'Enable touch events', True), - BoolVariable('execinfo', 'Use libexecinfo on systems where glibc is not available', False), + BoolVariable("use_llvm", "Use the LLVM compiler", False), + BoolVariable("use_lld", "Use the LLD linker", False), + BoolVariable("use_thinlto", "Use ThinLTO", False), + BoolVariable("use_static_cpp", "Link libgcc and libstdc++ statically for better portability", False), + BoolVariable("use_coverage", "Test Godot coverage", False), + BoolVariable("use_ubsan", "Use LLVM/GCC compiler undefined behavior sanitizer (UBSAN)", False), + BoolVariable("use_asan", "Use LLVM/GCC compiler address sanitizer (ASAN))", False), + BoolVariable("use_lsan", "Use LLVM/GCC compiler leak sanitizer (LSAN))", False), + BoolVariable("use_tsan", "Use LLVM/GCC compiler thread sanitizer (TSAN))", False), + BoolVariable("pulseaudio", "Detect and use PulseAudio", True), + BoolVariable("udev", "Use udev for gamepad connection callbacks", False), + EnumVariable("debug_symbols", "Add debugging symbols to release builds", "yes", ("yes", "no", "full")), + BoolVariable("separate_debug_symbols", "Create a separate file containing debugging symbols", False), + BoolVariable("touch", "Enable touch events", True), + BoolVariable("execinfo", "Use libexecinfo on systems where glibc is not available", False), ] @@ -83,286 +84,294 @@ def configure(env): ## Build type - if (env["target"] == "release"): - if (env["optimize"] == "speed"): #optimize for speed (default) - env.Prepend(CCFLAGS=['-O3']) - else: #optimize for size - env.Prepend(CCFLAGS=['-Os']) - - if (env["debug_symbols"] == "yes"): - env.Prepend(CCFLAGS=['-g1']) - if (env["debug_symbols"] == "full"): - env.Prepend(CCFLAGS=['-g2']) - - elif (env["target"] == "release_debug"): - if (env["optimize"] == "speed"): #optimize for speed (default) - env.Prepend(CCFLAGS=['-O2']) - else: #optimize for size - env.Prepend(CCFLAGS=['-Os']) - env.Prepend(CPPDEFINES=['DEBUG_ENABLED']) - - if (env["debug_symbols"] == "yes"): - env.Prepend(CCFLAGS=['-g1']) - if (env["debug_symbols"] == "full"): - env.Prepend(CCFLAGS=['-g2']) - - elif (env["target"] == "debug"): - env.Prepend(CCFLAGS=['-g3']) - env.Prepend(CPPDEFINES=['DEBUG_ENABLED', 'DEBUG_MEMORY_ENABLED']) - env.Append(LINKFLAGS=['-rdynamic']) + if env["target"] == "release": + if env["optimize"] == "speed": # optimize for speed (default) + env.Prepend(CCFLAGS=["-O3"]) + else: # optimize for size + env.Prepend(CCFLAGS=["-Os"]) + + if env["debug_symbols"] == "yes": + env.Prepend(CCFLAGS=["-g1"]) + if env["debug_symbols"] == "full": + env.Prepend(CCFLAGS=["-g2"]) + + elif env["target"] == "release_debug": + if env["optimize"] == "speed": # optimize for speed (default) + env.Prepend(CCFLAGS=["-O2"]) + else: # optimize for size + env.Prepend(CCFLAGS=["-Os"]) + env.Prepend(CPPDEFINES=["DEBUG_ENABLED"]) + + if env["debug_symbols"] == "yes": + env.Prepend(CCFLAGS=["-g1"]) + if env["debug_symbols"] == "full": + env.Prepend(CCFLAGS=["-g2"]) + + elif env["target"] == "debug": + env.Prepend(CCFLAGS=["-g3"]) + env.Prepend(CPPDEFINES=["DEBUG_ENABLED", "DEBUG_MEMORY_ENABLED"]) + env.Append(LINKFLAGS=["-rdynamic"]) ## Architecture - is64 = sys.maxsize > 2**32 - if (env["bits"] == "default"): + is64 = sys.maxsize > 2 ** 32 + if env["bits"] == "default": env["bits"] = "64" if is64 else "32" ## Compiler configuration - if 'CXX' in env and 'clang' in os.path.basename(env['CXX']): + if "CXX" in env and "clang" in os.path.basename(env["CXX"]): # Convenience check to enforce the use_llvm overrides when CXX is clang(++) - env['use_llvm'] = True + env["use_llvm"] = True - if env['use_llvm']: - if ('clang++' not in os.path.basename(env['CXX'])): + if env["use_llvm"]: + if "clang++" not in os.path.basename(env["CXX"]): env["CC"] = "clang" env["CXX"] = "clang++" env["LINK"] = "clang++" - env.Append(CPPDEFINES=['TYPED_METHOD_BIND']) + env.Append(CPPDEFINES=["TYPED_METHOD_BIND"]) env.extra_suffix = ".llvm" + env.extra_suffix - if env['use_lld']: - if env['use_llvm']: - env.Append(LINKFLAGS=['-fuse-ld=lld']) - if env['use_thinlto']: + if env["use_lld"]: + if env["use_llvm"]: + env.Append(LINKFLAGS=["-fuse-ld=lld"]) + if env["use_thinlto"]: # A convenience so you don't need to write use_lto too when using SCons - env['use_lto'] = True + env["use_lto"] = True else: print("Using LLD with GCC is not supported yet, try compiling with 'use_llvm=yes'.") sys.exit(255) - if env['use_coverage']: - env.Append(CCFLAGS=['-ftest-coverage', '-fprofile-arcs']) - env.Append(LINKFLAGS=['-ftest-coverage', '-fprofile-arcs']) + if env["use_coverage"]: + env.Append(CCFLAGS=["-ftest-coverage", "-fprofile-arcs"]) + env.Append(LINKFLAGS=["-ftest-coverage", "-fprofile-arcs"]) - if env['use_ubsan'] or env['use_asan'] or env['use_lsan'] or env['use_tsan']: + if env["use_ubsan"] or env["use_asan"] or env["use_lsan"] or env["use_tsan"]: env.extra_suffix += "s" - if env['use_ubsan']: - env.Append(CCFLAGS=['-fsanitize=undefined']) - env.Append(LINKFLAGS=['-fsanitize=undefined']) + if env["use_ubsan"]: + env.Append(CCFLAGS=["-fsanitize=undefined"]) + env.Append(LINKFLAGS=["-fsanitize=undefined"]) - if env['use_asan']: - env.Append(CCFLAGS=['-fsanitize=address']) - env.Append(LINKFLAGS=['-fsanitize=address']) + if env["use_asan"]: + env.Append(CCFLAGS=["-fsanitize=address"]) + env.Append(LINKFLAGS=["-fsanitize=address"]) - if env['use_lsan']: - env.Append(CCFLAGS=['-fsanitize=leak']) - env.Append(LINKFLAGS=['-fsanitize=leak']) + if env["use_lsan"]: + env.Append(CCFLAGS=["-fsanitize=leak"]) + env.Append(LINKFLAGS=["-fsanitize=leak"]) - if env['use_tsan']: - env.Append(CCFLAGS=['-fsanitize=thread']) - env.Append(LINKFLAGS=['-fsanitize=thread']) + if env["use_tsan"]: + env.Append(CCFLAGS=["-fsanitize=thread"]) + env.Append(LINKFLAGS=["-fsanitize=thread"]) - if env['use_lto']: - if not env['use_llvm'] and env.GetOption("num_jobs") > 1: - env.Append(CCFLAGS=['-flto']) - env.Append(LINKFLAGS=['-flto=' + str(env.GetOption("num_jobs"))]) + if env["use_lto"]: + if not env["use_llvm"] and env.GetOption("num_jobs") > 1: + env.Append(CCFLAGS=["-flto"]) + env.Append(LINKFLAGS=["-flto=" + str(env.GetOption("num_jobs"))]) else: - if env['use_lld'] and env['use_thinlto']: - env.Append(CCFLAGS=['-flto=thin']) - env.Append(LINKFLAGS=['-flto=thin']) + if env["use_lld"] and env["use_thinlto"]: + env.Append(CCFLAGS=["-flto=thin"]) + env.Append(LINKFLAGS=["-flto=thin"]) else: - env.Append(CCFLAGS=['-flto']) - env.Append(LINKFLAGS=['-flto']) + env.Append(CCFLAGS=["-flto"]) + env.Append(LINKFLAGS=["-flto"]) - if not env['use_llvm']: - env['RANLIB'] = 'gcc-ranlib' - env['AR'] = 'gcc-ar' + if not env["use_llvm"]: + env["RANLIB"] = "gcc-ranlib" + env["AR"] = "gcc-ar" - env.Append(CCFLAGS=['-pipe']) - env.Append(LINKFLAGS=['-pipe']) + env.Append(CCFLAGS=["-pipe"]) + env.Append(LINKFLAGS=["-pipe"]) # -fpie and -no-pie is supported on GCC 6+ and Clang 4+, both below our # minimal requirements. - env.Append(CCFLAGS=['-fpie']) - env.Append(LINKFLAGS=['-no-pie']) + env.Append(CCFLAGS=["-fpie"]) + env.Append(LINKFLAGS=["-no-pie"]) ## Dependencies - env.ParseConfig('pkg-config x11 --cflags --libs') - env.ParseConfig('pkg-config xcursor --cflags --libs') - env.ParseConfig('pkg-config xinerama --cflags --libs') - env.ParseConfig('pkg-config xrandr --cflags --libs') - env.ParseConfig('pkg-config xrender --cflags --libs') - env.ParseConfig('pkg-config xi --cflags --libs') + env.ParseConfig("pkg-config x11 --cflags --libs") + env.ParseConfig("pkg-config xcursor --cflags --libs") + env.ParseConfig("pkg-config xinerama --cflags --libs") + env.ParseConfig("pkg-config xrandr --cflags --libs") + env.ParseConfig("pkg-config xrender --cflags --libs") + env.ParseConfig("pkg-config xi --cflags --libs") - if (env['touch']): - env.Append(CPPDEFINES=['TOUCH_ENABLED']) + if env["touch"]: + env.Append(CPPDEFINES=["TOUCH_ENABLED"]) # FIXME: Check for existence of the libs before parsing their flags with pkg-config # freetype depends on libpng and zlib, so bundling one of them while keeping others # as shared libraries leads to weird issues - if env['builtin_freetype'] or env['builtin_libpng'] or env['builtin_zlib']: - env['builtin_freetype'] = True - env['builtin_libpng'] = True - env['builtin_zlib'] = True + if env["builtin_freetype"] or env["builtin_libpng"] or env["builtin_zlib"]: + env["builtin_freetype"] = True + env["builtin_libpng"] = True + env["builtin_zlib"] = True - if not env['builtin_freetype']: - env.ParseConfig('pkg-config freetype2 --cflags --libs') + if not env["builtin_freetype"]: + env.ParseConfig("pkg-config freetype2 --cflags --libs") - if not env['builtin_libpng']: - env.ParseConfig('pkg-config libpng16 --cflags --libs') + if not env["builtin_libpng"]: + env.ParseConfig("pkg-config libpng16 --cflags --libs") - if not env['builtin_bullet']: + if not env["builtin_bullet"]: # We need at least version 2.89 import subprocess - bullet_version = subprocess.check_output(['pkg-config', 'bullet', '--modversion']).strip() + + bullet_version = subprocess.check_output(["pkg-config", "bullet", "--modversion"]).strip() if str(bullet_version) < "2.89": # Abort as system bullet was requested but too old - print("Bullet: System version {0} does not match minimal requirements ({1}). Aborting.".format(bullet_version, "2.89")) + print( + "Bullet: System version {0} does not match minimal requirements ({1}). Aborting.".format( + bullet_version, "2.89" + ) + ) sys.exit(255) - env.ParseConfig('pkg-config bullet --cflags --libs') + env.ParseConfig("pkg-config bullet --cflags --libs") if False: # not env['builtin_assimp']: # FIXME: Add min version check - env.ParseConfig('pkg-config assimp --cflags --libs') + env.ParseConfig("pkg-config assimp --cflags --libs") - if not env['builtin_enet']: - env.ParseConfig('pkg-config libenet --cflags --libs') + if not env["builtin_enet"]: + env.ParseConfig("pkg-config libenet --cflags --libs") - if not env['builtin_squish']: - env.ParseConfig('pkg-config libsquish --cflags --libs') + if not env["builtin_squish"]: + env.ParseConfig("pkg-config libsquish --cflags --libs") - if not env['builtin_zstd']: - env.ParseConfig('pkg-config libzstd --cflags --libs') + if not env["builtin_zstd"]: + env.ParseConfig("pkg-config libzstd --cflags --libs") # Sound and video libraries # Keep the order as it triggers chained dependencies (ogg needed by others, etc.) - if not env['builtin_libtheora']: - env['builtin_libogg'] = False # Needed to link against system libtheora - env['builtin_libvorbis'] = False # Needed to link against system libtheora - env.ParseConfig('pkg-config theora theoradec --cflags --libs') + if not env["builtin_libtheora"]: + env["builtin_libogg"] = False # Needed to link against system libtheora + env["builtin_libvorbis"] = False # Needed to link against system libtheora + env.ParseConfig("pkg-config theora theoradec --cflags --libs") else: - list_of_x86 = ['x86_64', 'x86', 'i386', 'i586'] + list_of_x86 = ["x86_64", "x86", "i386", "i586"] if any(platform.machine() in s for s in list_of_x86): env["x86_libtheora_opt_gcc"] = True - if not env['builtin_libvpx']: - env.ParseConfig('pkg-config vpx --cflags --libs') + if not env["builtin_libvpx"]: + env.ParseConfig("pkg-config vpx --cflags --libs") - if not env['builtin_libvorbis']: - env['builtin_libogg'] = False # Needed to link against system libvorbis - env.ParseConfig('pkg-config vorbis vorbisfile --cflags --libs') + if not env["builtin_libvorbis"]: + env["builtin_libogg"] = False # Needed to link against system libvorbis + env.ParseConfig("pkg-config vorbis vorbisfile --cflags --libs") - if not env['builtin_opus']: - env['builtin_libogg'] = False # Needed to link against system opus - env.ParseConfig('pkg-config opus opusfile --cflags --libs') + if not env["builtin_opus"]: + env["builtin_libogg"] = False # Needed to link against system opus + env.ParseConfig("pkg-config opus opusfile --cflags --libs") - if not env['builtin_libogg']: - env.ParseConfig('pkg-config ogg --cflags --libs') + if not env["builtin_libogg"]: + env.ParseConfig("pkg-config ogg --cflags --libs") - if not env['builtin_libwebp']: - env.ParseConfig('pkg-config libwebp --cflags --libs') + if not env["builtin_libwebp"]: + env.ParseConfig("pkg-config libwebp --cflags --libs") - if not env['builtin_mbedtls']: + if not env["builtin_mbedtls"]: # mbedTLS does not provide a pkgconfig config yet. See https://github.com/ARMmbed/mbedtls/issues/228 - env.Append(LIBS=['mbedtls', 'mbedcrypto', 'mbedx509']) + env.Append(LIBS=["mbedtls", "mbedcrypto", "mbedx509"]) - if not env['builtin_wslay']: - env.ParseConfig('pkg-config libwslay --cflags --libs') + if not env["builtin_wslay"]: + env.ParseConfig("pkg-config libwslay --cflags --libs") - if not env['builtin_miniupnpc']: + if not env["builtin_miniupnpc"]: # No pkgconfig file so far, hardcode default paths. env.Prepend(CPPPATH=["/usr/include/miniupnpc"]) env.Append(LIBS=["miniupnpc"]) # On Linux wchar_t should be 32-bits # 16-bit library shouldn't be required due to compiler optimisations - if not env['builtin_pcre2']: - env.ParseConfig('pkg-config libpcre2-32 --cflags --libs') + if not env["builtin_pcre2"]: + env.ParseConfig("pkg-config libpcre2-32 --cflags --libs") ## Flags - if (os.system("pkg-config --exists alsa") == 0): # 0 means found + if os.system("pkg-config --exists alsa") == 0: # 0 means found print("Enabling ALSA") env.Append(CPPDEFINES=["ALSA_ENABLED", "ALSAMIDI_ENABLED"]) - # Don't parse --cflags, we don't need to add /usr/include/alsa to include path - env.ParseConfig('pkg-config alsa --libs') + # Don't parse --cflags, we don't need to add /usr/include/alsa to include path + env.ParseConfig("pkg-config alsa --libs") else: print("ALSA libraries not found, disabling driver") - if env['pulseaudio']: - if (os.system("pkg-config --exists libpulse") == 0): # 0 means found + if env["pulseaudio"]: + if os.system("pkg-config --exists libpulse") == 0: # 0 means found print("Enabling PulseAudio") env.Append(CPPDEFINES=["PULSEAUDIO_ENABLED"]) - env.ParseConfig('pkg-config --cflags --libs libpulse') + env.ParseConfig("pkg-config --cflags --libs libpulse") else: print("PulseAudio development libraries not found, disabling driver") - if (platform.system() == "Linux"): + if platform.system() == "Linux": env.Append(CPPDEFINES=["JOYDEV_ENABLED"]) - if env['udev']: - if (os.system("pkg-config --exists libudev") == 0): # 0 means found + if env["udev"]: + if os.system("pkg-config --exists libudev") == 0: # 0 means found print("Enabling udev support") env.Append(CPPDEFINES=["UDEV_ENABLED"]) - env.ParseConfig('pkg-config libudev --cflags --libs') + env.ParseConfig("pkg-config libudev --cflags --libs") else: print("libudev development libraries not found, disabling udev support") # Linkflags below this line should typically stay the last ones - if not env['builtin_zlib']: - env.ParseConfig('pkg-config zlib --cflags --libs') + if not env["builtin_zlib"]: + env.ParseConfig("pkg-config zlib --cflags --libs") - env.Prepend(CPPPATH=['#platform/linuxbsd']) - env.Append(CPPDEFINES=['X11_ENABLED', 'UNIX_ENABLED']) + env.Prepend(CPPPATH=["#platform/linuxbsd"]) + env.Append(CPPDEFINES=["X11_ENABLED", "UNIX_ENABLED"]) - env.Append(CPPDEFINES=['VULKAN_ENABLED']) - if not env['builtin_vulkan']: - env.ParseConfig('pkg-config vulkan --cflags --libs') - if not env['builtin_glslang']: + env.Append(CPPDEFINES=["VULKAN_ENABLED"]) + if not env["builtin_vulkan"]: + env.ParseConfig("pkg-config vulkan --cflags --libs") + if not env["builtin_glslang"]: # No pkgconfig file for glslang so far - env.Append(LIBS=['glslang', 'SPIRV']) + env.Append(LIBS=["glslang", "SPIRV"]) - #env.Append(CPPDEFINES=['OPENGL_ENABLED']) - env.Append(LIBS=['GL']) + # env.Append(CPPDEFINES=['OPENGL_ENABLED']) + env.Append(LIBS=["GL"]) - env.Append(LIBS=['pthread']) + env.Append(LIBS=["pthread"]) - if (platform.system() == "Linux"): - env.Append(LIBS=['dl']) + if platform.system() == "Linux": + env.Append(LIBS=["dl"]) - if (platform.system().find("BSD") >= 0): + if platform.system().find("BSD") >= 0: env["execinfo"] = True if env["execinfo"]: - env.Append(LIBS=['execinfo']) + env.Append(LIBS=["execinfo"]) - if not env['tools']: + if not env["tools"]: import subprocess import re - linker_version_str = subprocess.check_output([env.subst(env["LINK"]), '-Wl,--version']).decode("utf-8") - gnu_ld_version = re.search('^GNU ld [^$]*(\d+\.\d+)$', linker_version_str, re.MULTILINE) + + linker_version_str = subprocess.check_output([env.subst(env["LINK"]), "-Wl,--version"]).decode("utf-8") + gnu_ld_version = re.search("^GNU ld [^$]*(\d+\.\d+)$", linker_version_str, re.MULTILINE) if not gnu_ld_version: - print("Warning: Creating template binaries enabled for PCK embedding is currently only supported with GNU ld") + print( + "Warning: Creating template binaries enabled for PCK embedding is currently only supported with GNU ld" + ) else: if float(gnu_ld_version.group(1)) >= 2.30: - env.Append(LINKFLAGS=['-T', 'platform/linuxbsd/pck_embed.ld']) + env.Append(LINKFLAGS=["-T", "platform/linuxbsd/pck_embed.ld"]) else: - env.Append(LINKFLAGS=['-T', 'platform/linuxbsd/pck_embed.legacy.ld']) + env.Append(LINKFLAGS=["-T", "platform/linuxbsd/pck_embed.legacy.ld"]) ## Cross-compilation - if (is64 and env["bits"] == "32"): - env.Append(CCFLAGS=['-m32']) - env.Append(LINKFLAGS=['-m32', '-L/usr/lib/i386-linux-gnu']) - elif (not is64 and env["bits"] == "64"): - env.Append(CCFLAGS=['-m64']) - env.Append(LINKFLAGS=['-m64', '-L/usr/lib/i686-linux-gnu']) + if is64 and env["bits"] == "32": + env.Append(CCFLAGS=["-m32"]) + env.Append(LINKFLAGS=["-m32", "-L/usr/lib/i386-linux-gnu"]) + elif not is64 and env["bits"] == "64": + env.Append(CCFLAGS=["-m64"]) + env.Append(LINKFLAGS=["-m64", "-L/usr/lib/i686-linux-gnu"]) # Link those statically for portability - if env['use_static_cpp']: - env.Append(LINKFLAGS=['-static-libgcc', '-static-libstdc++']) + if env["use_static_cpp"]: + env.Append(LINKFLAGS=["-static-libgcc", "-static-libstdc++"]) diff --git a/platform/linuxbsd/display_server_x11.h b/platform/linuxbsd/display_server_x11.h index aa10be555c..113e504e9b 100644 --- a/platform/linuxbsd/display_server_x11.h +++ b/platform/linuxbsd/display_server_x11.h @@ -193,7 +193,6 @@ class DisplayServerX11 : public DisplayServer { void _handle_key_event(WindowID p_window, XKeyEvent *p_event, bool p_echo = false); - bool force_quit; bool minimized; bool window_has_focus; bool do_mouse_warp; diff --git a/platform/linuxbsd/platform_linuxbsd_builders.py b/platform/linuxbsd/platform_linuxbsd_builders.py index a72306a9c0..58234f3748 100644 --- a/platform/linuxbsd/platform_linuxbsd_builders.py +++ b/platform/linuxbsd/platform_linuxbsd_builders.py @@ -8,10 +8,10 @@ from platform_methods import subprocess_main def make_debug_linuxbsd(target, source, env): - os.system('objcopy --only-keep-debug {0} {0}.debugsymbols'.format(target[0])) - os.system('strip --strip-debug --strip-unneeded {0}'.format(target[0])) - os.system('objcopy --add-gnu-debuglink={0}.debugsymbols {0}'.format(target[0])) + os.system("objcopy --only-keep-debug {0} {0}.debugsymbols".format(target[0])) + os.system("strip --strip-debug --strip-unneeded {0}".format(target[0])) + os.system("objcopy --add-gnu-debuglink={0}.debugsymbols {0}".format(target[0])) -if __name__ == '__main__': +if __name__ == "__main__": subprocess_main(globals()) diff --git a/platform/osx/SCsub b/platform/osx/SCsub index 4ec8aeab6d..ad62db358b 100644 --- a/platform/osx/SCsub +++ b/platform/osx/SCsub @@ -1,23 +1,22 @@ #!/usr/bin/env python -Import('env') +Import("env") from platform_methods import run_in_subprocess import platform_osx_builders files = [ - 'crash_handler_osx.mm', - 'os_osx.mm', - 'display_server_osx.mm', - 'godot_main_osx.mm', - 'dir_access_osx.mm', - 'joypad_osx.cpp', - 'vulkan_context_osx.mm', - 'context_gl_osx.mm' + "crash_handler_osx.mm", + "os_osx.mm", + "display_server_osx.mm", + "godot_main_osx.mm", + "dir_access_osx.mm", + "joypad_osx.cpp", + "vulkan_context_osx.mm", + "context_gl_osx.mm", ] -prog = env.add_program('#bin/godot', files) +prog = env.add_program("#bin/godot", files) if (env["debug_symbols"] == "full" or env["debug_symbols"] == "yes") and env["separate_debug_symbols"]: env.AddPostAction(prog, run_in_subprocess(platform_osx_builders.make_debug_osx)) - diff --git a/platform/osx/detect.py b/platform/osx/detect.py index 12ca5c10dc..29aa8ece19 100644 --- a/platform/osx/detect.py +++ b/platform/osx/detect.py @@ -14,7 +14,7 @@ def get_name(): def can_build(): - if (sys.platform == "darwin" or ("OSXCROSS_ROOT" in os.environ)): + if sys.platform == "darwin" or ("OSXCROSS_ROOT" in os.environ): return True return False @@ -24,52 +24,55 @@ def get_opts(): from SCons.Variables import BoolVariable, EnumVariable return [ - ('osxcross_sdk', 'OSXCross SDK version', 'darwin14'), - ('MACOS_SDK_PATH', 'Path to the macOS SDK', ''), - BoolVariable('use_static_mvk', 'Link MoltenVK statically as Level-0 driver (better portability) or use Vulkan ICD loader (enables validation layers)', False), - EnumVariable('debug_symbols', 'Add debugging symbols to release builds', 'yes', ('yes', 'no', 'full')), - BoolVariable('separate_debug_symbols', 'Create a separate file containing debugging symbols', False), - BoolVariable('use_ubsan', 'Use LLVM/GCC compiler undefined behavior sanitizer (UBSAN)', False), - BoolVariable('use_asan', 'Use LLVM/GCC compiler address sanitizer (ASAN))', False), - BoolVariable('use_tsan', 'Use LLVM/GCC compiler thread sanitizer (TSAN))', False), + ("osxcross_sdk", "OSXCross SDK version", "darwin14"), + ("MACOS_SDK_PATH", "Path to the macOS SDK", ""), + BoolVariable( + "use_static_mvk", + "Link MoltenVK statically as Level-0 driver (better portability) or use Vulkan ICD loader (enables validation layers)", + False, + ), + EnumVariable("debug_symbols", "Add debugging symbols to release builds", "yes", ("yes", "no", "full")), + BoolVariable("separate_debug_symbols", "Create a separate file containing debugging symbols", False), + BoolVariable("use_ubsan", "Use LLVM/GCC compiler undefined behavior sanitizer (UBSAN)", False), + BoolVariable("use_asan", "Use LLVM/GCC compiler address sanitizer (ASAN))", False), + BoolVariable("use_tsan", "Use LLVM/GCC compiler thread sanitizer (TSAN))", False), ] def get_flags(): - return [ - ] + return [] def configure(env): - ## Build type - - if (env["target"] == "release"): - if (env["optimize"] == "speed"): #optimize for speed (default) - env.Prepend(CCFLAGS=['-O3', '-fomit-frame-pointer', '-ftree-vectorize', '-msse2']) - else: #optimize for size - env.Prepend(CCFLAGS=['-Os','-ftree-vectorize', '-msse2']) - - if (env["debug_symbols"] == "yes"): - env.Prepend(CCFLAGS=['-g1']) - if (env["debug_symbols"] == "full"): - env.Prepend(CCFLAGS=['-g2']) - - elif (env["target"] == "release_debug"): - if (env["optimize"] == "speed"): #optimize for speed (default) - env.Prepend(CCFLAGS=['-O2']) - else: #optimize for size - env.Prepend(CCFLAGS=['-Os']) - env.Prepend(CPPDEFINES=['DEBUG_ENABLED']) - if (env["debug_symbols"] == "yes"): - env.Prepend(CCFLAGS=['-g1']) - if (env["debug_symbols"] == "full"): - env.Prepend(CCFLAGS=['-g2']) - - elif (env["target"] == "debug"): - env.Prepend(CCFLAGS=['-g3']) - env.Prepend(CPPDEFINES=['DEBUG_ENABLED', 'DEBUG_MEMORY_ENABLED']) + ## Build type + + if env["target"] == "release": + if env["optimize"] == "speed": # optimize for speed (default) + env.Prepend(CCFLAGS=["-O3", "-fomit-frame-pointer", "-ftree-vectorize", "-msse2"]) + else: # optimize for size + env.Prepend(CCFLAGS=["-Os", "-ftree-vectorize", "-msse2"]) + + if env["debug_symbols"] == "yes": + env.Prepend(CCFLAGS=["-g1"]) + if env["debug_symbols"] == "full": + env.Prepend(CCFLAGS=["-g2"]) + + elif env["target"] == "release_debug": + if env["optimize"] == "speed": # optimize for speed (default) + env.Prepend(CCFLAGS=["-O2"]) + else: # optimize for size + env.Prepend(CCFLAGS=["-Os"]) + env.Prepend(CPPDEFINES=["DEBUG_ENABLED"]) + if env["debug_symbols"] == "yes": + env.Prepend(CCFLAGS=["-g1"]) + if env["debug_symbols"] == "full": + env.Prepend(CCFLAGS=["-g2"]) + + elif env["target"] == "debug": + env.Prepend(CCFLAGS=["-g3"]) + env.Prepend(CPPDEFINES=["DEBUG_ENABLED", "DEBUG_MEMORY_ENABLED"]) ## Architecture @@ -83,86 +86,109 @@ def configure(env): if "OSXCROSS_ROOT" in os.environ: env["osxcross"] = True - if not "osxcross" in env: # regular native build - env.Append(CCFLAGS=['-arch', 'x86_64']) - env.Append(LINKFLAGS=['-arch', 'x86_64']) - if (env["macports_clang"] != 'no'): + if not "osxcross" in env: # regular native build + env.Append(CCFLAGS=["-arch", "x86_64"]) + env.Append(LINKFLAGS=["-arch", "x86_64"]) + if env["macports_clang"] != "no": mpprefix = os.environ.get("MACPORTS_PREFIX", "/opt/local") mpclangver = env["macports_clang"] env["CC"] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/clang" env["LINK"] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/clang++" env["CXX"] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/clang++" - env['AR'] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/llvm-ar" - env['RANLIB'] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/llvm-ranlib" - env['AS'] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/llvm-as" - env.Append(CPPDEFINES=['__MACPORTS__']) #hack to fix libvpx MM256_BROADCASTSI128_SI256 define + env["AR"] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/llvm-ar" + env["RANLIB"] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/llvm-ranlib" + env["AS"] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/llvm-as" + env.Append(CPPDEFINES=["__MACPORTS__"]) # hack to fix libvpx MM256_BROADCASTSI128_SI256 define else: - env['CC'] = 'clang' - env['CXX'] = 'clang++' + env["CC"] = "clang" + env["CXX"] = "clang++" - detect_darwin_sdk_path('osx', env) - env.Append(CCFLAGS=['-isysroot', '$MACOS_SDK_PATH']) - env.Append(LINKFLAGS=['-isysroot', '$MACOS_SDK_PATH']) + detect_darwin_sdk_path("osx", env) + env.Append(CCFLAGS=["-isysroot", "$MACOS_SDK_PATH"]) + env.Append(LINKFLAGS=["-isysroot", "$MACOS_SDK_PATH"]) - else: # osxcross build + else: # osxcross build root = os.environ.get("OSXCROSS_ROOT", 0) basecmd = root + "/target/bin/x86_64-apple-" + env["osxcross_sdk"] + "-" ccache_path = os.environ.get("CCACHE") if ccache_path is None: - env['CC'] = basecmd + "cc" - env['CXX'] = basecmd + "c++" + env["CC"] = basecmd + "cc" + env["CXX"] = basecmd + "c++" else: # there aren't any ccache wrappers available for OS X cross-compile, # to enable caching we need to prepend the path to the ccache binary - env['CC'] = ccache_path + ' ' + basecmd + "cc" - env['CXX'] = ccache_path + ' ' + basecmd + "c++" - env['AR'] = basecmd + "ar" - env['RANLIB'] = basecmd + "ranlib" - env['AS'] = basecmd + "as" - env.Append(CPPDEFINES=['__MACPORTS__']) #hack to fix libvpx MM256_BROADCASTSI128_SI256 define - - if (env["CXX"] == "clang++"): - env.Append(CPPDEFINES=['TYPED_METHOD_BIND']) + env["CC"] = ccache_path + " " + basecmd + "cc" + env["CXX"] = ccache_path + " " + basecmd + "c++" + env["AR"] = basecmd + "ar" + env["RANLIB"] = basecmd + "ranlib" + env["AS"] = basecmd + "as" + env.Append(CPPDEFINES=["__MACPORTS__"]) # hack to fix libvpx MM256_BROADCASTSI128_SI256 define + + if env["CXX"] == "clang++": + env.Append(CPPDEFINES=["TYPED_METHOD_BIND"]) env["CC"] = "clang" env["LINK"] = "clang++" - if env['use_ubsan'] or env['use_asan'] or env['use_tsan']: + if env["use_ubsan"] or env["use_asan"] or env["use_tsan"]: env.extra_suffix += "s" - if env['use_ubsan']: - env.Append(CCFLAGS=['-fsanitize=undefined']) - env.Append(LINKFLAGS=['-fsanitize=undefined']) + if env["use_ubsan"]: + env.Append(CCFLAGS=["-fsanitize=undefined"]) + env.Append(LINKFLAGS=["-fsanitize=undefined"]) - if env['use_asan']: - env.Append(CCFLAGS=['-fsanitize=address']) - env.Append(LINKFLAGS=['-fsanitize=address']) + if env["use_asan"]: + env.Append(CCFLAGS=["-fsanitize=address"]) + env.Append(LINKFLAGS=["-fsanitize=address"]) - if env['use_tsan']: - env.Append(CCFLAGS=['-fsanitize=thread']) - env.Append(LINKFLAGS=['-fsanitize=thread']) + if env["use_tsan"]: + env.Append(CCFLAGS=["-fsanitize=thread"]) + env.Append(LINKFLAGS=["-fsanitize=thread"]) ## Dependencies - if env['builtin_libtheora']: + if env["builtin_libtheora"]: env["x86_libtheora_opt_gcc"] = True ## Flags - env.Prepend(CPPPATH=['#platform/osx']) - env.Append(CPPDEFINES=['OSX_ENABLED', 'UNIX_ENABLED', 'APPLE_STYLE_KEYS', 'COREAUDIO_ENABLED', 'COREMIDI_ENABLED']) - env.Append(LINKFLAGS=['-framework', 'Cocoa', '-framework', 'Carbon', '-framework', 'AudioUnit', '-framework', 'CoreAudio', '-framework', 'CoreMIDI', '-framework', 'IOKit', '-framework', 'ForceFeedback', '-framework', 'CoreVideo', '-framework', 'AVFoundation', '-framework', 'CoreMedia']) - env.Append(LIBS=['pthread', 'z']) - - env.Append(CPPDEFINES=['VULKAN_ENABLED']) - env.Append(LINKFLAGS=['-framework', 'Metal', '-framework', 'QuartzCore', '-framework', 'IOSurface']) - if (env['use_static_mvk']): - env.Append(LINKFLAGS=['-framework', 'MoltenVK']) - env['builtin_vulkan'] = False - elif not env['builtin_vulkan']: - env.Append(LIBS=['vulkan']) - - #env.Append(CPPDEFINES=['GLES_ENABLED', 'OPENGL_ENABLED']) - - env.Append(CCFLAGS=['-mmacosx-version-min=10.12']) - env.Append(LINKFLAGS=['-mmacosx-version-min=10.12']) + env.Prepend(CPPPATH=["#platform/osx"]) + env.Append(CPPDEFINES=["OSX_ENABLED", "UNIX_ENABLED", "APPLE_STYLE_KEYS", "COREAUDIO_ENABLED", "COREMIDI_ENABLED"]) + env.Append( + LINKFLAGS=[ + "-framework", + "Cocoa", + "-framework", + "Carbon", + "-framework", + "AudioUnit", + "-framework", + "CoreAudio", + "-framework", + "CoreMIDI", + "-framework", + "IOKit", + "-framework", + "ForceFeedback", + "-framework", + "CoreVideo", + "-framework", + "AVFoundation", + "-framework", + "CoreMedia", + ] + ) + env.Append(LIBS=["pthread", "z"]) + + env.Append(CPPDEFINES=["VULKAN_ENABLED"]) + env.Append(LINKFLAGS=["-framework", "Metal", "-framework", "QuartzCore", "-framework", "IOSurface"]) + if env["use_static_mvk"]: + env.Append(LINKFLAGS=["-framework", "MoltenVK"]) + env["builtin_vulkan"] = False + elif not env["builtin_vulkan"]: + env.Append(LIBS=["vulkan"]) + + # env.Append(CPPDEFINES=['GLES_ENABLED', 'OPENGL_ENABLED']) + + env.Append(CCFLAGS=["-mmacosx-version-min=10.12"]) + env.Append(LINKFLAGS=["-mmacosx-version-min=10.12"]) diff --git a/platform/osx/platform_osx_builders.py b/platform/osx/platform_osx_builders.py index 81997f674b..953ed479db 100644 --- a/platform/osx/platform_osx_builders.py +++ b/platform/osx/platform_osx_builders.py @@ -8,14 +8,14 @@ from platform_methods import subprocess_main def make_debug_osx(target, source, env): - if (env["macports_clang"] != 'no'): + if env["macports_clang"] != "no": mpprefix = os.environ.get("MACPORTS_PREFIX", "/opt/local") mpclangver = env["macports_clang"] - os.system(mpprefix + '/libexec/llvm-' + mpclangver + '/bin/llvm-dsymutil {0} -o {0}.dSYM'.format(target[0])) + os.system(mpprefix + "/libexec/llvm-" + mpclangver + "/bin/llvm-dsymutil {0} -o {0}.dSYM".format(target[0])) else: - os.system('dsymutil {0} -o {0}.dSYM'.format(target[0])) - os.system('strip -u -r {0}'.format(target[0])) + os.system("dsymutil {0} -o {0}.dSYM".format(target[0])) + os.system("strip -u -r {0}".format(target[0])) -if __name__ == '__main__': +if __name__ == "__main__": subprocess_main(globals()) diff --git a/platform/server/SCsub b/platform/server/SCsub index 8364164114..15b9af4d25 100644 --- a/platform/server/SCsub +++ b/platform/server/SCsub @@ -2,15 +2,15 @@ import sys -Import('env') +Import("env") -common_server = [\ - "os_server.cpp",\ +common_server = [ + "os_server.cpp", ] if sys.platform == "darwin": - common_server.append("#platform/osx/crash_handler_osx.mm") + common_server.append("#platform/osx/crash_handler_osx.mm") else: - common_server.append("#platform/x11/crash_handler_x11.cpp") + common_server.append("#platform/x11/crash_handler_x11.cpp") -prog = env.add_program('#bin/godot_server', ['godot_server.cpp'] + common_server) +prog = env.add_program("#bin/godot_server", ["godot_server.cpp"] + common_server) diff --git a/platform/server/detect.py b/platform/server/detect.py index 4ea4bddddd..a73810cdf4 100644 --- a/platform/server/detect.py +++ b/platform/server/detect.py @@ -5,6 +5,7 @@ import sys # This file is mostly based on platform/x11/detect.py. # If editing this file, make sure to apply relevant changes here too. + def is_active(): return True @@ -14,14 +15,14 @@ def get_name(): def get_program_suffix(): - if (sys.platform == "darwin"): + if sys.platform == "darwin": return "osx" return "linuxbsd" def can_build(): - if (os.name != "posix"): + if os.name != "posix": return False return True @@ -29,17 +30,18 @@ def can_build(): def get_opts(): from SCons.Variables import BoolVariable, EnumVariable + return [ - BoolVariable('use_llvm', 'Use the LLVM compiler', False), - BoolVariable('use_static_cpp', 'Link libgcc and libstdc++ statically for better portability', False), - BoolVariable('use_coverage', 'Test Godot coverage', False), - BoolVariable('use_ubsan', 'Use LLVM/GCC compiler undefined behavior sanitizer (UBSAN)', False), - BoolVariable('use_asan', 'Use LLVM/GCC compiler address sanitizer (ASAN))', False), - BoolVariable('use_lsan', 'Use LLVM/GCC compiler leak sanitizer (LSAN))', False), - BoolVariable('use_tsan', 'Use LLVM/GCC compiler thread sanitizer (TSAN))', False), - EnumVariable('debug_symbols', 'Add debugging symbols to release builds', 'yes', ('yes', 'no', 'full')), - BoolVariable('separate_debug_symbols', 'Create a separate file containing debugging symbols', False), - BoolVariable('execinfo', 'Use libexecinfo on systems where glibc is not available', False), + BoolVariable("use_llvm", "Use the LLVM compiler", False), + BoolVariable("use_static_cpp", "Link libgcc and libstdc++ statically for better portability", False), + BoolVariable("use_coverage", "Test Godot coverage", False), + BoolVariable("use_ubsan", "Use LLVM/GCC compiler undefined behavior sanitizer (UBSAN)", False), + BoolVariable("use_asan", "Use LLVM/GCC compiler address sanitizer (ASAN))", False), + BoolVariable("use_lsan", "Use LLVM/GCC compiler leak sanitizer (LSAN))", False), + BoolVariable("use_tsan", "Use LLVM/GCC compiler thread sanitizer (TSAN))", False), + EnumVariable("debug_symbols", "Add debugging symbols to release builds", "yes", ("yes", "no", "full")), + BoolVariable("separate_debug_symbols", "Create a separate file containing debugging symbols", False), + BoolVariable("execinfo", "Use libexecinfo on systems where glibc is not available", False), ] @@ -52,89 +54,89 @@ def configure(env): ## Build type - if (env["target"] == "release"): - if (env["optimize"] == "speed"): #optimize for speed (default) - env.Prepend(CCFLAGS=['-O3']) - else: #optimize for size - env.Prepend(CCFLAGS=['-Os']) - - if (env["debug_symbols"] == "yes"): - env.Prepend(CCFLAGS=['-g1']) - if (env["debug_symbols"] == "full"): - env.Prepend(CCFLAGS=['-g2']) - - elif (env["target"] == "release_debug"): - if (env["optimize"] == "speed"): #optimize for speed (default) - env.Prepend(CCFLAGS=['-O2']) - else: #optimize for size - env.Prepend(CCFLAGS=['-Os']) - env.Prepend(CPPDEFINES=['DEBUG_ENABLED']) - - if (env["debug_symbols"] == "yes"): - env.Prepend(CCFLAGS=['-g1']) - if (env["debug_symbols"] == "full"): - env.Prepend(CCFLAGS=['-g2']) - - elif (env["target"] == "debug"): - env.Prepend(CCFLAGS=['-g3']) - env.Prepend(CPPDEFINES=['DEBUG_ENABLED', 'DEBUG_MEMORY_ENABLED']) - env.Append(LINKFLAGS=['-rdynamic']) + if env["target"] == "release": + if env["optimize"] == "speed": # optimize for speed (default) + env.Prepend(CCFLAGS=["-O3"]) + else: # optimize for size + env.Prepend(CCFLAGS=["-Os"]) + + if env["debug_symbols"] == "yes": + env.Prepend(CCFLAGS=["-g1"]) + if env["debug_symbols"] == "full": + env.Prepend(CCFLAGS=["-g2"]) + + elif env["target"] == "release_debug": + if env["optimize"] == "speed": # optimize for speed (default) + env.Prepend(CCFLAGS=["-O2"]) + else: # optimize for size + env.Prepend(CCFLAGS=["-Os"]) + env.Prepend(CPPDEFINES=["DEBUG_ENABLED"]) + + if env["debug_symbols"] == "yes": + env.Prepend(CCFLAGS=["-g1"]) + if env["debug_symbols"] == "full": + env.Prepend(CCFLAGS=["-g2"]) + + elif env["target"] == "debug": + env.Prepend(CCFLAGS=["-g3"]) + env.Prepend(CPPDEFINES=["DEBUG_ENABLED", "DEBUG_MEMORY_ENABLED"]) + env.Append(LINKFLAGS=["-rdynamic"]) ## Architecture - is64 = sys.maxsize > 2**32 - if (env["bits"] == "default"): + is64 = sys.maxsize > 2 ** 32 + if env["bits"] == "default": env["bits"] = "64" if is64 else "32" ## Compiler configuration - if 'CXX' in env and 'clang' in os.path.basename(env['CXX']): + if "CXX" in env and "clang" in os.path.basename(env["CXX"]): # Convenience check to enforce the use_llvm overrides when CXX is clang(++) - env['use_llvm'] = True + env["use_llvm"] = True - if env['use_llvm']: - if ('clang++' not in os.path.basename(env['CXX'])): + if env["use_llvm"]: + if "clang++" not in os.path.basename(env["CXX"]): env["CC"] = "clang" env["CXX"] = "clang++" env["LINK"] = "clang++" - env.Append(CPPDEFINES=['TYPED_METHOD_BIND']) + env.Append(CPPDEFINES=["TYPED_METHOD_BIND"]) env.extra_suffix = ".llvm" + env.extra_suffix - if env['use_coverage']: - env.Append(CCFLAGS=['-ftest-coverage', '-fprofile-arcs']) - env.Append(LINKFLAGS=['-ftest-coverage', '-fprofile-arcs']) + if env["use_coverage"]: + env.Append(CCFLAGS=["-ftest-coverage", "-fprofile-arcs"]) + env.Append(LINKFLAGS=["-ftest-coverage", "-fprofile-arcs"]) - if env['use_ubsan'] or env['use_asan'] or env['use_lsan'] or env['use_tsan']: + if env["use_ubsan"] or env["use_asan"] or env["use_lsan"] or env["use_tsan"]: env.extra_suffix += "s" - if env['use_ubsan']: - env.Append(CCFLAGS=['-fsanitize=undefined']) - env.Append(LINKFLAGS=['-fsanitize=undefined']) + if env["use_ubsan"]: + env.Append(CCFLAGS=["-fsanitize=undefined"]) + env.Append(LINKFLAGS=["-fsanitize=undefined"]) - if env['use_asan']: - env.Append(CCFLAGS=['-fsanitize=address']) - env.Append(LINKFLAGS=['-fsanitize=address']) + if env["use_asan"]: + env.Append(CCFLAGS=["-fsanitize=address"]) + env.Append(LINKFLAGS=["-fsanitize=address"]) - if env['use_lsan']: - env.Append(CCFLAGS=['-fsanitize=leak']) - env.Append(LINKFLAGS=['-fsanitize=leak']) + if env["use_lsan"]: + env.Append(CCFLAGS=["-fsanitize=leak"]) + env.Append(LINKFLAGS=["-fsanitize=leak"]) - if env['use_tsan']: - env.Append(CCFLAGS=['-fsanitize=thread']) - env.Append(LINKFLAGS=['-fsanitize=thread']) + if env["use_tsan"]: + env.Append(CCFLAGS=["-fsanitize=thread"]) + env.Append(LINKFLAGS=["-fsanitize=thread"]) - if env['use_lto']: - env.Append(CCFLAGS=['-flto']) - if not env['use_llvm'] and env.GetOption("num_jobs") > 1: - env.Append(LINKFLAGS=['-flto=' + str(env.GetOption("num_jobs"))]) + if env["use_lto"]: + env.Append(CCFLAGS=["-flto"]) + if not env["use_llvm"] and env.GetOption("num_jobs") > 1: + env.Append(LINKFLAGS=["-flto=" + str(env.GetOption("num_jobs"))]) else: - env.Append(LINKFLAGS=['-flto']) - if not env['use_llvm']: - env['RANLIB'] = 'gcc-ranlib' - env['AR'] = 'gcc-ar' + env.Append(LINKFLAGS=["-flto"]) + if not env["use_llvm"]: + env["RANLIB"] = "gcc-ranlib" + env["AR"] = "gcc-ar" - env.Append(CCFLAGS=['-pipe']) - env.Append(LINKFLAGS=['-pipe']) + env.Append(CCFLAGS=["-pipe"]) + env.Append(LINKFLAGS=["-pipe"]) ## Dependencies @@ -142,109 +144,114 @@ def configure(env): # freetype depends on libpng and zlib, so bundling one of them while keeping others # as shared libraries leads to weird issues - if env['builtin_freetype'] or env['builtin_libpng'] or env['builtin_zlib']: - env['builtin_freetype'] = True - env['builtin_libpng'] = True - env['builtin_zlib'] = True + if env["builtin_freetype"] or env["builtin_libpng"] or env["builtin_zlib"]: + env["builtin_freetype"] = True + env["builtin_libpng"] = True + env["builtin_zlib"] = True - if not env['builtin_freetype']: - env.ParseConfig('pkg-config freetype2 --cflags --libs') + if not env["builtin_freetype"]: + env.ParseConfig("pkg-config freetype2 --cflags --libs") - if not env['builtin_libpng']: - env.ParseConfig('pkg-config libpng16 --cflags --libs') + if not env["builtin_libpng"]: + env.ParseConfig("pkg-config libpng16 --cflags --libs") - if not env['builtin_bullet']: + if not env["builtin_bullet"]: # We need at least version 2.89 import subprocess - bullet_version = subprocess.check_output(['pkg-config', 'bullet', '--modversion']).strip() + + bullet_version = subprocess.check_output(["pkg-config", "bullet", "--modversion"]).strip() if str(bullet_version) < "2.89": # Abort as system bullet was requested but too old - print("Bullet: System version {0} does not match minimal requirements ({1}). Aborting.".format(bullet_version, "2.89")) + print( + "Bullet: System version {0} does not match minimal requirements ({1}). Aborting.".format( + bullet_version, "2.89" + ) + ) sys.exit(255) - env.ParseConfig('pkg-config bullet --cflags --libs') + env.ParseConfig("pkg-config bullet --cflags --libs") if False: # not env['builtin_assimp']: # FIXME: Add min version check - env.ParseConfig('pkg-config assimp --cflags --libs') + env.ParseConfig("pkg-config assimp --cflags --libs") - if not env['builtin_enet']: - env.ParseConfig('pkg-config libenet --cflags --libs') + if not env["builtin_enet"]: + env.ParseConfig("pkg-config libenet --cflags --libs") - if not env['builtin_squish']: - env.ParseConfig('pkg-config libsquish --cflags --libs') + if not env["builtin_squish"]: + env.ParseConfig("pkg-config libsquish --cflags --libs") - if not env['builtin_zstd']: - env.ParseConfig('pkg-config libzstd --cflags --libs') + if not env["builtin_zstd"]: + env.ParseConfig("pkg-config libzstd --cflags --libs") # Sound and video libraries # Keep the order as it triggers chained dependencies (ogg needed by others, etc.) - if not env['builtin_libtheora']: - env['builtin_libogg'] = False # Needed to link against system libtheora - env['builtin_libvorbis'] = False # Needed to link against system libtheora - env.ParseConfig('pkg-config theora theoradec --cflags --libs') + if not env["builtin_libtheora"]: + env["builtin_libogg"] = False # Needed to link against system libtheora + env["builtin_libvorbis"] = False # Needed to link against system libtheora + env.ParseConfig("pkg-config theora theoradec --cflags --libs") else: - list_of_x86 = ['x86_64', 'x86', 'i386', 'i586'] + list_of_x86 = ["x86_64", "x86", "i386", "i586"] if any(platform.machine() in s for s in list_of_x86): env["x86_libtheora_opt_gcc"] = True - if not env['builtin_libvpx']: - env.ParseConfig('pkg-config vpx --cflags --libs') + if not env["builtin_libvpx"]: + env.ParseConfig("pkg-config vpx --cflags --libs") - if not env['builtin_libvorbis']: - env['builtin_libogg'] = False # Needed to link against system libvorbis - env.ParseConfig('pkg-config vorbis vorbisfile --cflags --libs') + if not env["builtin_libvorbis"]: + env["builtin_libogg"] = False # Needed to link against system libvorbis + env.ParseConfig("pkg-config vorbis vorbisfile --cflags --libs") - if not env['builtin_opus']: - env['builtin_libogg'] = False # Needed to link against system opus - env.ParseConfig('pkg-config opus opusfile --cflags --libs') + if not env["builtin_opus"]: + env["builtin_libogg"] = False # Needed to link against system opus + env.ParseConfig("pkg-config opus opusfile --cflags --libs") - if not env['builtin_libogg']: - env.ParseConfig('pkg-config ogg --cflags --libs') + if not env["builtin_libogg"]: + env.ParseConfig("pkg-config ogg --cflags --libs") - if not env['builtin_libwebp']: - env.ParseConfig('pkg-config libwebp --cflags --libs') + if not env["builtin_libwebp"]: + env.ParseConfig("pkg-config libwebp --cflags --libs") - if not env['builtin_mbedtls']: + if not env["builtin_mbedtls"]: # mbedTLS does not provide a pkgconfig config yet. See https://github.com/ARMmbed/mbedtls/issues/228 - env.Append(LIBS=['mbedtls', 'mbedcrypto', 'mbedx509']) + env.Append(LIBS=["mbedtls", "mbedcrypto", "mbedx509"]) - if not env['builtin_wslay']: - env.ParseConfig('pkg-config libwslay --cflags --libs') + if not env["builtin_wslay"]: + env.ParseConfig("pkg-config libwslay --cflags --libs") - if not env['builtin_miniupnpc']: + if not env["builtin_miniupnpc"]: # No pkgconfig file so far, hardcode default paths. env.Prepend(CPPPATH=["/usr/include/miniupnpc"]) env.Append(LIBS=["miniupnpc"]) # On Linux wchar_t should be 32-bits # 16-bit library shouldn't be required due to compiler optimisations - if not env['builtin_pcre2']: - env.ParseConfig('pkg-config libpcre2-32 --cflags --libs') + if not env["builtin_pcre2"]: + env.ParseConfig("pkg-config libpcre2-32 --cflags --libs") ## Flags # Linkflags below this line should typically stay the last ones - if not env['builtin_zlib']: - env.ParseConfig('pkg-config zlib --cflags --libs') + if not env["builtin_zlib"]: + env.ParseConfig("pkg-config zlib --cflags --libs") - env.Prepend(CPPPATH=['#platform/server']) - env.Append(CPPDEFINES=['SERVER_ENABLED', 'UNIX_ENABLED']) + env.Prepend(CPPPATH=["#platform/server"]) + env.Append(CPPDEFINES=["SERVER_ENABLED", "UNIX_ENABLED"]) - if (platform.system() == "Darwin"): - env.Append(LINKFLAGS=['-framework', 'Cocoa', '-framework', 'Carbon', '-lz', '-framework', 'IOKit']) + if platform.system() == "Darwin": + env.Append(LINKFLAGS=["-framework", "Cocoa", "-framework", "Carbon", "-lz", "-framework", "IOKit"]) - env.Append(LIBS=['pthread']) + env.Append(LIBS=["pthread"]) - if (platform.system() == "Linux"): - env.Append(LIBS=['dl']) + if platform.system() == "Linux": + env.Append(LIBS=["dl"]) - if (platform.system().find("BSD") >= 0): + if platform.system().find("BSD") >= 0: env["execinfo"] = True if env["execinfo"]: - env.Append(LIBS=['execinfo']) + env.Append(LIBS=["execinfo"]) # Link those statically for portability - if env['use_static_cpp']: - env.Append(LINKFLAGS=['-static-libgcc', '-static-libstdc++']) + if env["use_static_cpp"]: + env.Append(LINKFLAGS=["-static-libgcc", "-static-libstdc++"]) diff --git a/platform/uwp/SCsub b/platform/uwp/SCsub index 620d8c3c3a..4358b0eead 100644 --- a/platform/uwp/SCsub +++ b/platform/uwp/SCsub @@ -1,21 +1,21 @@ #!/usr/bin/env python -Import('env') +Import("env") files = [ - 'thread_uwp.cpp', - '#platform/windows/key_mapping_windows.cpp', - '#platform/windows/windows_terminal_logger.cpp', - 'joypad_uwp.cpp', - 'context_egl_uwp.cpp', - 'app.cpp', - 'os_uwp.cpp', + "thread_uwp.cpp", + "#platform/windows/key_mapping_windows.cpp", + "#platform/windows/windows_terminal_logger.cpp", + "joypad_uwp.cpp", + "context_egl_uwp.cpp", + "app.cpp", + "os_uwp.cpp", ] if "build_angle" in env and env["build_angle"]: - cmd = env.AlwaysBuild(env.ANGLE('libANGLE.lib', None)) + cmd = env.AlwaysBuild(env.ANGLE("libANGLE.lib", None)) -prog = env.add_program('#bin/godot', files) +prog = env.add_program("#bin/godot", files) if "build_angle" in env and env["build_angle"]: env.Depends(prog, [cmd]) diff --git a/platform/uwp/detect.py b/platform/uwp/detect.py index 000bd18e7d..669bfe6814 100644 --- a/platform/uwp/detect.py +++ b/platform/uwp/detect.py @@ -12,11 +12,11 @@ def get_name(): def can_build(): - if (os.name == "nt"): + if os.name == "nt": # building natively on windows! - if (os.getenv("VSINSTALLDIR")): + if os.getenv("VSINSTALLDIR"): - if (os.getenv("ANGLE_SRC_PATH") is None): + if os.getenv("ANGLE_SRC_PATH") is None: return False return True @@ -25,16 +25,16 @@ def can_build(): def get_opts(): return [ - ('msvc_version', 'MSVC version to use (ignored if the VCINSTALLDIR environment variable is set)', None), + ("msvc_version", "MSVC version to use (ignored if the VCINSTALLDIR environment variable is set)", None), ] def get_flags(): return [ - ('tools', False), - ('xaudio2', True), - ('builtin_pcre2_with_jit', False), + ("tools", False), + ("xaudio2", True), + ("builtin_pcre2_with_jit", False), ] @@ -42,45 +42,53 @@ def configure(env): env.msvc = True - if (env["bits"] != "default"): + if env["bits"] != "default": print("Error: bits argument is disabled for MSVC") - print(""" + print( + """ Bits argument is not supported for MSVC compilation. Architecture depends on the Native/Cross Compile Tools Prompt/Developer Console (or Visual Studio settings) that is being used to run SCons. As a consequence, bits argument is disabled. Run scons again without bits argument (example: scons p=uwp) and SCons will attempt to detect what MSVC compiler will be executed and inform you. - """) + """ + ) sys.exit() ## Build type - if (env["target"] == "release"): - env.Append(CCFLAGS=['/O2', '/GL']) - env.Append(CCFLAGS=['/MD']) - env.Append(LINKFLAGS=['/SUBSYSTEM:WINDOWS', '/LTCG']) + if env["target"] == "release": + env.Append(CCFLAGS=["/O2", "/GL"]) + env.Append(CCFLAGS=["/MD"]) + env.Append(LINKFLAGS=["/SUBSYSTEM:WINDOWS", "/LTCG"]) - elif (env["target"] == "release_debug"): - env.Append(CCFLAGS=['/O2', '/Zi']) - env.Append(CCFLAGS=['/MD']) - env.Append(CPPDEFINES=['DEBUG_ENABLED']) - env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE']) + elif env["target"] == "release_debug": + env.Append(CCFLAGS=["/O2", "/Zi"]) + env.Append(CCFLAGS=["/MD"]) + env.Append(CPPDEFINES=["DEBUG_ENABLED"]) + env.Append(LINKFLAGS=["/SUBSYSTEM:CONSOLE"]) - elif (env["target"] == "debug"): - env.Append(CCFLAGS=['/Zi']) - env.Append(CCFLAGS=['/MDd']) - env.Append(CPPDEFINES=['DEBUG_ENABLED', 'DEBUG_MEMORY_ENABLED']) - env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE']) - env.Append(LINKFLAGS=['/DEBUG']) + elif env["target"] == "debug": + env.Append(CCFLAGS=["/Zi"]) + env.Append(CCFLAGS=["/MDd"]) + env.Append(CPPDEFINES=["DEBUG_ENABLED", "DEBUG_MEMORY_ENABLED"]) + env.Append(LINKFLAGS=["/SUBSYSTEM:CONSOLE"]) + env.Append(LINKFLAGS=["/DEBUG"]) ## Compiler configuration - env['ENV'] = os.environ - vc_base_path = os.environ['VCTOOLSINSTALLDIR'] if "VCTOOLSINSTALLDIR" in os.environ else os.environ['VCINSTALLDIR'] + env["ENV"] = os.environ + vc_base_path = os.environ["VCTOOLSINSTALLDIR"] if "VCTOOLSINSTALLDIR" in os.environ else os.environ["VCINSTALLDIR"] # ANGLE angle_root = os.getenv("ANGLE_SRC_PATH") - env.Prepend(CPPPATH=[angle_root + '/include']) + env.Prepend(CPPPATH=[angle_root + "/include"]) jobs = str(env.GetOption("num_jobs")) - angle_build_cmd = "msbuild.exe " + angle_root + "/winrt/10/src/angle.sln /nologo /v:m /m:" + jobs + " /p:Configuration=Release /p:Platform=" + angle_build_cmd = ( + "msbuild.exe " + + angle_root + + "/winrt/10/src/angle.sln /nologo /v:m /m:" + + jobs + + " /p:Configuration=Release /p:Platform=" + ) if os.path.isfile(str(os.getenv("ANGLE_SRC_PATH")) + "/winrt/10/src/angle.sln"): env["build_angle"] = True @@ -88,49 +96,51 @@ def configure(env): ## Architecture arch = "" - if str(os.getenv('Platform')).lower() == "arm": + if str(os.getenv("Platform")).lower() == "arm": print("Compiled program architecture will be an ARM executable. (forcing bits=32).") arch = "arm" env["bits"] = "32" - env.Append(LINKFLAGS=['/MACHINE:ARM']) - env.Append(LIBPATH=[vc_base_path + 'lib/store/arm']) + env.Append(LINKFLAGS=["/MACHINE:ARM"]) + env.Append(LIBPATH=[vc_base_path + "lib/store/arm"]) angle_build_cmd += "ARM" - env.Append(LIBPATH=[angle_root + '/winrt/10/src/Release_ARM/lib']) + env.Append(LIBPATH=[angle_root + "/winrt/10/src/Release_ARM/lib"]) else: - compiler_version_str = methods.detect_visual_c_compiler_version(env['ENV']) + compiler_version_str = methods.detect_visual_c_compiler_version(env["ENV"]) - if(compiler_version_str == "amd64" or compiler_version_str == "x86_amd64"): + if compiler_version_str == "amd64" or compiler_version_str == "x86_amd64": env["bits"] = "64" print("Compiled program architecture will be a x64 executable (forcing bits=64).") - elif (compiler_version_str == "x86" or compiler_version_str == "amd64_x86"): + elif compiler_version_str == "x86" or compiler_version_str == "amd64_x86": env["bits"] = "32" print("Compiled program architecture will be a x86 executable. (forcing bits=32).") else: - print("Failed to detect MSVC compiler architecture version... Defaulting to 32-bit executable settings (forcing bits=32). Compilation attempt will continue, but SCons can not detect for what architecture this build is compiled for. You should check your settings/compilation setup.") + print( + "Failed to detect MSVC compiler architecture version... Defaulting to 32-bit executable settings (forcing bits=32). Compilation attempt will continue, but SCons can not detect for what architecture this build is compiled for. You should check your settings/compilation setup." + ) env["bits"] = "32" - if (env["bits"] == "32"): + if env["bits"] == "32": arch = "x86" angle_build_cmd += "Win32" - env.Append(LINKFLAGS=['/MACHINE:X86']) - env.Append(LIBPATH=[vc_base_path + 'lib/store']) - env.Append(LIBPATH=[angle_root + '/winrt/10/src/Release_Win32/lib']) + env.Append(LINKFLAGS=["/MACHINE:X86"]) + env.Append(LIBPATH=[vc_base_path + "lib/store"]) + env.Append(LIBPATH=[angle_root + "/winrt/10/src/Release_Win32/lib"]) else: arch = "x64" angle_build_cmd += "x64" - env.Append(LINKFLAGS=['/MACHINE:X64']) - env.Append(LIBPATH=[os.environ['VCINSTALLDIR'] + 'lib/store/amd64']) - env.Append(LIBPATH=[angle_root + '/winrt/10/src/Release_x64/lib']) + env.Append(LINKFLAGS=["/MACHINE:X64"]) + env.Append(LIBPATH=[os.environ["VCINSTALLDIR"] + "lib/store/amd64"]) + env.Append(LIBPATH=[angle_root + "/winrt/10/src/Release_x64/lib"]) env["PROGSUFFIX"] = "." + arch + env["PROGSUFFIX"] env["OBJSUFFIX"] = "." + arch + env["OBJSUFFIX"] @@ -138,39 +148,61 @@ def configure(env): ## Compile flags - env.Prepend(CPPPATH=['#platform/uwp', '#drivers/windows']) - env.Append(CPPDEFINES=['UWP_ENABLED', 'WINDOWS_ENABLED', 'TYPED_METHOD_BIND']) - env.Append(CPPDEFINES=['GLES_ENABLED', 'GL_GLEXT_PROTOTYPES', 'EGL_EGLEXT_PROTOTYPES', 'ANGLE_ENABLED']) - winver = "0x0602" # Windows 8 is the minimum target for UWP build - env.Append(CPPDEFINES=[('WINVER', winver), ('_WIN32_WINNT', winver), 'WIN32']) - - env.Append(CPPDEFINES=['__WRL_NO_DEFAULT_LIB__', ('PNG_ABORT', 'abort')]) - - env.Append(CPPFLAGS=['/AI', vc_base_path + 'lib/store/references']) - env.Append(CPPFLAGS=['/AI', vc_base_path + 'lib/x86/store/references']) - - env.Append(CCFLAGS='/FS /MP /GS /wd"4453" /wd"28204" /wd"4291" /Zc:wchar_t /Gm- /fp:precise /errorReport:prompt /WX- /Zc:forScope /Gd /EHsc /nologo'.split()) - env.Append(CPPDEFINES=['_UNICODE', 'UNICODE', ('WINAPI_FAMILY', 'WINAPI_FAMILY_APP')]) - env.Append(CXXFLAGS=['/ZW']) - env.Append(CCFLAGS=['/AI', vc_base_path + '\\vcpackages', '/AI', os.environ['WINDOWSSDKDIR'] + '\\References\\CommonConfiguration\\Neutral']) + env.Prepend(CPPPATH=["#platform/uwp", "#drivers/windows"]) + env.Append(CPPDEFINES=["UWP_ENABLED", "WINDOWS_ENABLED", "TYPED_METHOD_BIND"]) + env.Append(CPPDEFINES=["GLES_ENABLED", "GL_GLEXT_PROTOTYPES", "EGL_EGLEXT_PROTOTYPES", "ANGLE_ENABLED"]) + winver = "0x0602" # Windows 8 is the minimum target for UWP build + env.Append(CPPDEFINES=[("WINVER", winver), ("_WIN32_WINNT", winver), "WIN32"]) + + env.Append(CPPDEFINES=["__WRL_NO_DEFAULT_LIB__", ("PNG_ABORT", "abort")]) + + env.Append(CPPFLAGS=["/AI", vc_base_path + "lib/store/references"]) + env.Append(CPPFLAGS=["/AI", vc_base_path + "lib/x86/store/references"]) + + env.Append( + CCFLAGS='/FS /MP /GS /wd"4453" /wd"28204" /wd"4291" /Zc:wchar_t /Gm- /fp:precise /errorReport:prompt /WX- /Zc:forScope /Gd /EHsc /nologo'.split() + ) + env.Append(CPPDEFINES=["_UNICODE", "UNICODE", ("WINAPI_FAMILY", "WINAPI_FAMILY_APP")]) + env.Append(CXXFLAGS=["/ZW"]) + env.Append( + CCFLAGS=[ + "/AI", + vc_base_path + "\\vcpackages", + "/AI", + os.environ["WINDOWSSDKDIR"] + "\\References\\CommonConfiguration\\Neutral", + ] + ) ## Link flags - env.Append(LINKFLAGS=['/MANIFEST:NO', '/NXCOMPAT', '/DYNAMICBASE', '/WINMD', '/APPCONTAINER', '/ERRORREPORT:PROMPT', '/NOLOGO', '/TLBID:1', '/NODEFAULTLIB:"kernel32.lib"', '/NODEFAULTLIB:"ole32.lib"']) + env.Append( + LINKFLAGS=[ + "/MANIFEST:NO", + "/NXCOMPAT", + "/DYNAMICBASE", + "/WINMD", + "/APPCONTAINER", + "/ERRORREPORT:PROMPT", + "/NOLOGO", + "/TLBID:1", + '/NODEFAULTLIB:"kernel32.lib"', + '/NODEFAULTLIB:"ole32.lib"', + ] + ) LIBS = [ - 'WindowsApp', - 'mincore', - 'ws2_32', - 'libANGLE', - 'libEGL', - 'libGLESv2', - 'bcrypt', + "WindowsApp", + "mincore", + "ws2_32", + "libANGLE", + "libEGL", + "libGLESv2", + "bcrypt", ] env.Append(LINKFLAGS=[p + ".lib" for p in LIBS]) # Incremental linking fix - env['BUILDERS']['ProgramOriginal'] = env['BUILDERS']['Program'] - env['BUILDERS']['Program'] = methods.precious_program + env["BUILDERS"]["ProgramOriginal"] = env["BUILDERS"]["Program"] + env["BUILDERS"]["Program"] = methods.precious_program - env.Append(BUILDERS={'ANGLE': env.Builder(action=angle_build_cmd)}) + env.Append(BUILDERS={"ANGLE": env.Builder(action=angle_build_cmd)}) diff --git a/platform/windows/SCsub b/platform/windows/SCsub index 89ee4dfa7a..daffe59f34 100644 --- a/platform/windows/SCsub +++ b/platform/windows/SCsub @@ -1,6 +1,6 @@ #!/usr/bin/env python -Import('env') +Import("env") import os from platform_methods import run_in_subprocess @@ -15,17 +15,17 @@ common_win = [ "joypad_windows.cpp", "windows_terminal_logger.cpp", "vulkan_context_win.cpp", - "context_gl_windows.cpp" + "context_gl_windows.cpp", ] -res_file = 'godot_res.rc' +res_file = "godot_res.rc" res_target = "godot_res" + env["OBJSUFFIX"] res_obj = env.RES(res_target, res_file) -prog = env.add_program('#bin/godot', common_win + res_obj, PROGSUFFIX=env["PROGSUFFIX"]) +prog = env.add_program("#bin/godot", common_win + res_obj, PROGSUFFIX=env["PROGSUFFIX"]) # Microsoft Visual Studio Project Generation -if env['vsproj']: +if env["vsproj"]: env.vs_srcs = env.vs_srcs + ["platform/windows/" + res_file] env.vs_srcs = env.vs_srcs + ["platform/windows/godot.natvis"] for x in common_win: diff --git a/platform/windows/detect.py b/platform/windows/detect.py index cc859c0339..9f79e92dcb 100644 --- a/platform/windows/detect.py +++ b/platform/windows/detect.py @@ -14,10 +14,10 @@ def get_name(): def can_build(): - if (os.name == "nt"): + if os.name == "nt": # Building natively on Windows # If VCINSTALLDIR is set in the OS environ, use traditional Godot logic to set up MSVC - if (os.getenv("VCINSTALLDIR")): # MSVC, manual setup + if os.getenv("VCINSTALLDIR"): # MSVC, manual setup return True # Otherwise, let SCons find MSVC if installed, or else Mingw. @@ -26,18 +26,18 @@ def can_build(): # null compiler. return True - if (os.name == "posix"): + if os.name == "posix": # Cross-compiling with MinGW-w64 (old MinGW32 is not supported) mingw32 = "i686-w64-mingw32-" mingw64 = "x86_64-w64-mingw32-" - if (os.getenv("MINGW32_PREFIX")): + if os.getenv("MINGW32_PREFIX"): mingw32 = os.getenv("MINGW32_PREFIX") - if (os.getenv("MINGW64_PREFIX")): + if os.getenv("MINGW64_PREFIX"): mingw64 = os.getenv("MINGW64_PREFIX") test = "gcc --version > /dev/null 2>&1" - if (os.system(mingw64 + test) == 0 or os.system(mingw32 + test) == 0): + if os.system(mingw64 + test) == 0 or os.system(mingw32 + test) == 0: return True return False @@ -48,47 +48,47 @@ def get_opts(): mingw32 = "" mingw64 = "" - if (os.name == "posix"): + if os.name == "posix": mingw32 = "i686-w64-mingw32-" mingw64 = "x86_64-w64-mingw32-" - if (os.getenv("MINGW32_PREFIX")): + if os.getenv("MINGW32_PREFIX"): mingw32 = os.getenv("MINGW32_PREFIX") - if (os.getenv("MINGW64_PREFIX")): + if os.getenv("MINGW64_PREFIX"): mingw64 = os.getenv("MINGW64_PREFIX") return [ - ('mingw_prefix_32', 'MinGW prefix (Win32)', mingw32), - ('mingw_prefix_64', 'MinGW prefix (Win64)', mingw64), + ("mingw_prefix_32", "MinGW prefix (Win32)", mingw32), + ("mingw_prefix_64", "MinGW prefix (Win64)", mingw64), # Targeted Windows version: 7 (and later), minimum supported version # XP support dropped after EOL due to missing API for IPv6 and other issues # Vista support dropped after EOL due to GH-10243 - ('target_win_version', 'Targeted Windows version, >= 0x0601 (Windows 7)', '0x0601'), - EnumVariable('debug_symbols', 'Add debugging symbols to release builds', 'yes', ('yes', 'no', 'full')), - BoolVariable('separate_debug_symbols', 'Create a separate file containing debugging symbols', False), - ('msvc_version', 'MSVC version to use. Ignored if VCINSTALLDIR is set in shell env.', None), - BoolVariable('use_mingw', 'Use the Mingw compiler, even if MSVC is installed. Only used on Windows.', False), - BoolVariable('use_llvm', 'Use the LLVM compiler', False), - BoolVariable('use_thinlto', 'Use ThinLTO', False), + ("target_win_version", "Targeted Windows version, >= 0x0601 (Windows 7)", "0x0601"), + EnumVariable("debug_symbols", "Add debugging symbols to release builds", "yes", ("yes", "no", "full")), + BoolVariable("separate_debug_symbols", "Create a separate file containing debugging symbols", False), + ("msvc_version", "MSVC version to use. Ignored if VCINSTALLDIR is set in shell env.", None), + BoolVariable("use_mingw", "Use the Mingw compiler, even if MSVC is installed. Only used on Windows.", False), + BoolVariable("use_llvm", "Use the LLVM compiler", False), + BoolVariable("use_thinlto", "Use ThinLTO", False), ] def get_flags(): - return [ - ] + return [] def build_res_file(target, source, env): - if (env["bits"] == "32"): - cmdbase = env['mingw_prefix_32'] + if env["bits"] == "32": + cmdbase = env["mingw_prefix_32"] else: - cmdbase = env['mingw_prefix_64'] - cmdbase = cmdbase + 'windres --include-dir . ' + cmdbase = env["mingw_prefix_64"] + cmdbase = cmdbase + "windres --include-dir . " import subprocess + for x in range(len(source)): - cmd = cmdbase + '-i ' + str(source[x]) + ' -o ' + str(target[x]) + cmd = cmdbase + "-i " + str(source[x]) + " -o " + str(target[x]) try: out = subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE).communicate() if len(out[1]): @@ -100,12 +100,14 @@ def build_res_file(target, source, env): def setup_msvc_manual(env): """Set up env to use MSVC manually, using VCINSTALLDIR""" - if (env["bits"] != "default"): - print(""" + if env["bits"] != "default": + print( + """ Bits argument is not supported for MSVC compilation. Architecture depends on the Native/Cross Compile Tools Prompt/Developer Console (or Visual Studio settings) that is being used to run SCons. As a consequence, bits argument is disabled. Run scons again without bits argument (example: scons p=windows) and SCons will attempt to detect what MSVC compiler will be executed and inform you. - """) + """ + ) raise SCons.Errors.UserError("Bits argument should not be used when using VCINSTALLDIR") # Force bits arg @@ -114,18 +116,21 @@ def setup_msvc_manual(env): env["x86_libtheora_opt_vc"] = True # find compiler manually - compiler_version_str = methods.detect_visual_c_compiler_version(env['ENV']) + compiler_version_str = methods.detect_visual_c_compiler_version(env["ENV"]) print("Found MSVC compiler: " + compiler_version_str) # If building for 64bit architecture, disable assembly optimisations for 32 bit builds (theora as of writing)... vc compiler for 64bit can not compile _asm - if(compiler_version_str == "amd64" or compiler_version_str == "x86_amd64"): + if compiler_version_str == "amd64" or compiler_version_str == "x86_amd64": env["bits"] = "64" env["x86_libtheora_opt_vc"] = False print("Compiled program architecture will be a 64 bit executable (forcing bits=64).") - elif (compiler_version_str == "x86" or compiler_version_str == "amd64_x86"): + elif compiler_version_str == "x86" or compiler_version_str == "amd64_x86": print("Compiled program architecture will be a 32 bit executable. (forcing bits=32).") else: - print("Failed to manually detect MSVC compiler architecture version... Defaulting to 32bit executable settings (forcing bits=32). Compilation attempt will continue, but SCons can not detect for what architecture this build is compiled for. You should check your settings/compilation setup, or avoid setting VCINSTALLDIR.") + print( + "Failed to manually detect MSVC compiler architecture version... Defaulting to 32bit executable settings (forcing bits=32). Compilation attempt will continue, but SCons can not detect for what architecture this build is compiled for. You should check your settings/compilation setup, or avoid setting VCINSTALLDIR." + ) + def setup_msvc_auto(env): """Set up MSVC using SCons's auto-detection logic""" @@ -138,103 +143,127 @@ def setup_msvc_auto(env): # (Ideally we'd decide on the tool config before configuring any # environment, and just set the env up once, but this function runs # on an existing env so this is the simplest way.) - env['MSVC_SETUP_RUN'] = False # Need to set this to re-run the tool - env['MSVS_VERSION'] = None - env['MSVC_VERSION'] = None - env['TARGET_ARCH'] = None - if env['bits'] != 'default': - env['TARGET_ARCH'] = {'32': 'x86', '64': 'x86_64'}[env['bits']] - if env.has_key('msvc_version'): - env['MSVC_VERSION'] = env['msvc_version'] - env.Tool('msvc') - env.Tool('mssdk') # we want the MS SDK + env["MSVC_SETUP_RUN"] = False # Need to set this to re-run the tool + env["MSVS_VERSION"] = None + env["MSVC_VERSION"] = None + env["TARGET_ARCH"] = None + if env["bits"] != "default": + env["TARGET_ARCH"] = {"32": "x86", "64": "x86_64"}[env["bits"]] + if env.has_key("msvc_version"): + env["MSVC_VERSION"] = env["msvc_version"] + env.Tool("msvc") + env.Tool("mssdk") # we want the MS SDK # Note: actual compiler version can be found in env['MSVC_VERSION'], e.g. "14.1" for VS2015 # Get actual target arch into bits (it may be "default" at this point): - if env['TARGET_ARCH'] in ('amd64', 'x86_64'): - env['bits'] = '64' + if env["TARGET_ARCH"] in ("amd64", "x86_64"): + env["bits"] = "64" else: - env['bits'] = '32' - print("Found MSVC version %s, arch %s, bits=%s" % (env['MSVC_VERSION'], env['TARGET_ARCH'], env['bits'])) - if env['TARGET_ARCH'] in ('amd64', 'x86_64'): + env["bits"] = "32" + print("Found MSVC version %s, arch %s, bits=%s" % (env["MSVC_VERSION"], env["TARGET_ARCH"], env["bits"])) + if env["TARGET_ARCH"] in ("amd64", "x86_64"): env["x86_libtheora_opt_vc"] = False + def setup_mingw(env): """Set up env for use with mingw""" # Nothing to do here print("Using MinGW") pass + def configure_msvc(env, manual_msvc_config): """Configure env to work with MSVC""" # Build type - if (env["target"] == "release"): - if (env["optimize"] == "speed"): #optimize for speed (default) - env.Append(CCFLAGS=['/O2']) - else: # optimize for size - env.Append(CCFLAGS=['/O1']) - env.Append(LINKFLAGS=['/SUBSYSTEM:WINDOWS']) - env.Append(LINKFLAGS=['/ENTRY:mainCRTStartup']) - env.Append(LINKFLAGS=['/OPT:REF']) - - elif (env["target"] == "release_debug"): - if (env["optimize"] == "speed"): #optimize for speed (default) - env.Append(CCFLAGS=['/O2']) - else: # optimize for size - env.Append(CCFLAGS=['/O1']) - env.AppendUnique(CPPDEFINES = ['DEBUG_ENABLED']) - env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE']) - env.Append(LINKFLAGS=['/OPT:REF']) - - elif (env["target"] == "debug"): - env.AppendUnique(CCFLAGS=['/Z7', '/Od', '/EHsc']) - env.AppendUnique(CPPDEFINES = ['DEBUG_ENABLED', 'DEBUG_MEMORY_ENABLED', - 'D3D_DEBUG_INFO']) - env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE']) - env.Append(LINKFLAGS=['/DEBUG']) - - if (env["debug_symbols"] == "full" or env["debug_symbols"] == "yes"): - env.AppendUnique(CCFLAGS=['/Z7']) - env.AppendUnique(LINKFLAGS=['/DEBUG']) + if env["target"] == "release": + if env["optimize"] == "speed": # optimize for speed (default) + env.Append(CCFLAGS=["/O2"]) + else: # optimize for size + env.Append(CCFLAGS=["/O1"]) + env.Append(LINKFLAGS=["/SUBSYSTEM:WINDOWS"]) + env.Append(LINKFLAGS=["/ENTRY:mainCRTStartup"]) + env.Append(LINKFLAGS=["/OPT:REF"]) + + elif env["target"] == "release_debug": + if env["optimize"] == "speed": # optimize for speed (default) + env.Append(CCFLAGS=["/O2"]) + else: # optimize for size + env.Append(CCFLAGS=["/O1"]) + env.AppendUnique(CPPDEFINES=["DEBUG_ENABLED"]) + env.Append(LINKFLAGS=["/SUBSYSTEM:CONSOLE"]) + env.Append(LINKFLAGS=["/OPT:REF"]) + + elif env["target"] == "debug": + env.AppendUnique(CCFLAGS=["/Z7", "/Od", "/EHsc"]) + env.AppendUnique(CPPDEFINES=["DEBUG_ENABLED", "DEBUG_MEMORY_ENABLED", "D3D_DEBUG_INFO"]) + env.Append(LINKFLAGS=["/SUBSYSTEM:CONSOLE"]) + env.Append(LINKFLAGS=["/DEBUG"]) + + if env["debug_symbols"] == "full" or env["debug_symbols"] == "yes": + env.AppendUnique(CCFLAGS=["/Z7"]) + env.AppendUnique(LINKFLAGS=["/DEBUG"]) ## Compile/link flags - env.AppendUnique(CCFLAGS=['/MT', '/Gd', '/GR', '/nologo']) - if int(env['MSVC_VERSION'].split('.')[0]) >= 14: #vs2015 and later - env.AppendUnique(CCFLAGS=['/utf-8']) - env.AppendUnique(CXXFLAGS=['/TP']) # assume all sources are C++ - if manual_msvc_config: # should be automatic if SCons found it + env.AppendUnique(CCFLAGS=["/MT", "/Gd", "/GR", "/nologo"]) + if int(env["MSVC_VERSION"].split(".")[0]) >= 14: # vs2015 and later + env.AppendUnique(CCFLAGS=["/utf-8"]) + env.AppendUnique(CXXFLAGS=["/TP"]) # assume all sources are C++ + if manual_msvc_config: # should be automatic if SCons found it if os.getenv("WindowsSdkDir") is not None: env.Prepend(CPPPATH=[os.getenv("WindowsSdkDir") + "/Include"]) else: print("Missing environment variable: WindowsSdkDir") - env.AppendUnique(CPPDEFINES = ['WINDOWS_ENABLED', - 'WASAPI_ENABLED', 'WINMIDI_ENABLED', - 'TYPED_METHOD_BIND', - 'WIN32', 'MSVC', - 'WINVER=%s' % env["target_win_version"], - '_WIN32_WINNT=%s' % env["target_win_version"]]) - env.AppendUnique(CPPDEFINES=['NOMINMAX']) # disable bogus min/max WinDef.h macros + env.AppendUnique( + CPPDEFINES=[ + "WINDOWS_ENABLED", + "WASAPI_ENABLED", + "WINMIDI_ENABLED", + "TYPED_METHOD_BIND", + "WIN32", + "MSVC", + "WINVER=%s" % env["target_win_version"], + "_WIN32_WINNT=%s" % env["target_win_version"], + ] + ) + env.AppendUnique(CPPDEFINES=["NOMINMAX"]) # disable bogus min/max WinDef.h macros if env["bits"] == "64": - env.AppendUnique(CPPDEFINES=['_WIN64']) + env.AppendUnique(CPPDEFINES=["_WIN64"]) ## Libs - LIBS = ['winmm', 'dsound', 'kernel32', 'ole32', 'oleaut32', - 'user32', 'gdi32', 'IPHLPAPI', 'Shlwapi', 'wsock32', 'Ws2_32', - 'shell32', 'advapi32', 'dinput8', 'dxguid', 'imm32', 'bcrypt', 'Avrt', - 'dwmapi'] + LIBS = [ + "winmm", + "dsound", + "kernel32", + "ole32", + "oleaut32", + "user32", + "gdi32", + "IPHLPAPI", + "Shlwapi", + "wsock32", + "Ws2_32", + "shell32", + "advapi32", + "dinput8", + "dxguid", + "imm32", + "bcrypt", + "Avrt", + "dwmapi", + ] - env.AppendUnique(CPPDEFINES=['VULKAN_ENABLED']) - if not env['builtin_vulkan']: - LIBS += ['vulkan'] + env.AppendUnique(CPPDEFINES=["VULKAN_ENABLED"]) + if not env["builtin_vulkan"]: + LIBS += ["vulkan"] else: - LIBS += ['cfgmgr32'] + LIBS += ["cfgmgr32"] - #env.AppendUnique(CPPDEFINES = ['OPENGL_ENABLED']) - LIBS += ['opengl32'] + # env.AppendUnique(CPPDEFINES = ['OPENGL_ENABLED']) + LIBS += ["opengl32"] env.Append(LINKFLAGS=[p + env["LIBSUFFIX"] for p in LIBS]) @@ -246,23 +275,24 @@ def configure_msvc(env, manual_msvc_config): ## LTO - if (env["use_lto"]): - env.AppendUnique(CCFLAGS=['/GL']) - env.AppendUnique(ARFLAGS=['/LTCG']) + if env["use_lto"]: + env.AppendUnique(CCFLAGS=["/GL"]) + env.AppendUnique(ARFLAGS=["/LTCG"]) if env["progress"]: - env.AppendUnique(LINKFLAGS=['/LTCG:STATUS']) + env.AppendUnique(LINKFLAGS=["/LTCG:STATUS"]) else: - env.AppendUnique(LINKFLAGS=['/LTCG']) + env.AppendUnique(LINKFLAGS=["/LTCG"]) if manual_msvc_config: env.Prepend(CPPPATH=[p for p in os.getenv("INCLUDE").split(";")]) env.Append(LIBPATH=[p for p in os.getenv("LIB").split(";")]) # Incremental linking fix - env['BUILDERS']['ProgramOriginal'] = env['BUILDERS']['Program'] - env['BUILDERS']['Program'] = methods.precious_program + env["BUILDERS"]["ProgramOriginal"] = env["BUILDERS"]["Program"] + env["BUILDERS"]["Program"] = methods.precious_program + + env.AppendUnique(LINKFLAGS=["/STACK:" + str(STACK_SIZE)]) - env.AppendUnique(LINKFLAGS=['/STACK:' + str(STACK_SIZE)]) def configure_mingw(env): # Workaround for MinGW. See: @@ -271,125 +301,148 @@ def configure_mingw(env): ## Build type - if (env["target"] == "release"): - env.Append(CCFLAGS=['-msse2']) + if env["target"] == "release": + env.Append(CCFLAGS=["-msse2"]) - if (env["optimize"] == "speed"): #optimize for speed (default) - if (env["bits"] == "64"): - env.Append(CCFLAGS=['-O3']) + if env["optimize"] == "speed": # optimize for speed (default) + if env["bits"] == "64": + env.Append(CCFLAGS=["-O3"]) else: - env.Append(CCFLAGS=['-O2']) - else: #optimize for size - env.Prepend(CCFLAGS=['-Os']) - - - env.Append(LINKFLAGS=['-Wl,--subsystem,windows']) - - if (env["debug_symbols"] == "yes"): - env.Prepend(CCFLAGS=['-g1']) - if (env["debug_symbols"] == "full"): - env.Prepend(CCFLAGS=['-g2']) - - elif (env["target"] == "release_debug"): - env.Append(CCFLAGS=['-O2']) - env.Append(CPPDEFINES=['DEBUG_ENABLED']) - if (env["debug_symbols"] == "yes"): - env.Prepend(CCFLAGS=['-g1']) - if (env["debug_symbols"] == "full"): - env.Prepend(CCFLAGS=['-g2']) - if (env["optimize"] == "speed"): #optimize for speed (default) - env.Append(CCFLAGS=['-O2']) - else: #optimize for size - env.Prepend(CCFLAGS=['-Os']) - - elif (env["target"] == "debug"): - env.Append(CCFLAGS=['-g3']) - env.Append(CPPDEFINES=['DEBUG_ENABLED', 'DEBUG_MEMORY_ENABLED']) + env.Append(CCFLAGS=["-O2"]) + else: # optimize for size + env.Prepend(CCFLAGS=["-Os"]) + + env.Append(LINKFLAGS=["-Wl,--subsystem,windows"]) + + if env["debug_symbols"] == "yes": + env.Prepend(CCFLAGS=["-g1"]) + if env["debug_symbols"] == "full": + env.Prepend(CCFLAGS=["-g2"]) + + elif env["target"] == "release_debug": + env.Append(CCFLAGS=["-O2"]) + env.Append(CPPDEFINES=["DEBUG_ENABLED"]) + if env["debug_symbols"] == "yes": + env.Prepend(CCFLAGS=["-g1"]) + if env["debug_symbols"] == "full": + env.Prepend(CCFLAGS=["-g2"]) + if env["optimize"] == "speed": # optimize for speed (default) + env.Append(CCFLAGS=["-O2"]) + else: # optimize for size + env.Prepend(CCFLAGS=["-Os"]) + + elif env["target"] == "debug": + env.Append(CCFLAGS=["-g3"]) + env.Append(CPPDEFINES=["DEBUG_ENABLED", "DEBUG_MEMORY_ENABLED"]) ## Compiler configuration if os.name != "nt": env["PROGSUFFIX"] = env["PROGSUFFIX"] + ".exe" # for linux cross-compilation - if (env["bits"] == "default"): - if (os.name == "nt"): + if env["bits"] == "default": + if os.name == "nt": env["bits"] = "64" if "PROGRAMFILES(X86)" in os.environ else "32" - else: # default to 64-bit on Linux + else: # default to 64-bit on Linux env["bits"] = "64" mingw_prefix = "" - if (env["bits"] == "32"): - env.Append(LINKFLAGS=['-static']) - env.Append(LINKFLAGS=['-static-libgcc']) - env.Append(LINKFLAGS=['-static-libstdc++']) + if env["bits"] == "32": + env.Append(LINKFLAGS=["-static"]) + env.Append(LINKFLAGS=["-static-libgcc"]) + env.Append(LINKFLAGS=["-static-libstdc++"]) mingw_prefix = env["mingw_prefix_32"] else: - env.Append(LINKFLAGS=['-static']) + env.Append(LINKFLAGS=["-static"]) mingw_prefix = env["mingw_prefix_64"] - if env['use_llvm']: + if env["use_llvm"]: env["CC"] = mingw_prefix + "clang" - env['AS'] = mingw_prefix + "as" + env["AS"] = mingw_prefix + "as" env["CXX"] = mingw_prefix + "clang++" - env['AR'] = mingw_prefix + "ar" - env['RANLIB'] = mingw_prefix + "ranlib" + env["AR"] = mingw_prefix + "ar" + env["RANLIB"] = mingw_prefix + "ranlib" env["LINK"] = mingw_prefix + "clang++" else: env["CC"] = mingw_prefix + "gcc" - env['AS'] = mingw_prefix + "as" - env['CXX'] = mingw_prefix + "g++" - env['AR'] = mingw_prefix + "gcc-ar" - env['RANLIB'] = mingw_prefix + "gcc-ranlib" - env['LINK'] = mingw_prefix + "g++" + env["AS"] = mingw_prefix + "as" + env["CXX"] = mingw_prefix + "g++" + env["AR"] = mingw_prefix + "gcc-ar" + env["RANLIB"] = mingw_prefix + "gcc-ranlib" + env["LINK"] = mingw_prefix + "g++" env["x86_libtheora_opt_gcc"] = True - if env['use_lto']: - if not env['use_llvm'] and env.GetOption("num_jobs") > 1: - env.Append(CCFLAGS=['-flto']) - env.Append(LINKFLAGS=['-flto=' + str(env.GetOption("num_jobs"))]) + if env["use_lto"]: + if not env["use_llvm"] and env.GetOption("num_jobs") > 1: + env.Append(CCFLAGS=["-flto"]) + env.Append(LINKFLAGS=["-flto=" + str(env.GetOption("num_jobs"))]) else: - if env['use_thinlto']: - env.Append(CCFLAGS=['-flto=thin']) - env.Append(LINKFLAGS=['-flto=thin']) + if env["use_thinlto"]: + env.Append(CCFLAGS=["-flto=thin"]) + env.Append(LINKFLAGS=["-flto=thin"]) else: - env.Append(CCFLAGS=['-flto']) - env.Append(LINKFLAGS=['-flto']) + env.Append(CCFLAGS=["-flto"]) + env.Append(LINKFLAGS=["-flto"]) - env.Append(LINKFLAGS=['-Wl,--stack,' + str(STACK_SIZE)]) + env.Append(LINKFLAGS=["-Wl,--stack," + str(STACK_SIZE)]) ## Compile flags - env.Append(CCFLAGS=['-mwindows']) - - env.Append(CPPDEFINES=['WINDOWS_ENABLED', 'WASAPI_ENABLED', 'WINMIDI_ENABLED']) - env.Append(CPPDEFINES=[('WINVER', env['target_win_version']), ('_WIN32_WINNT', env['target_win_version'])]) - env.Append(LIBS=['mingw32', 'dsound', 'ole32', 'd3d9', 'winmm', 'gdi32', 'iphlpapi', 'shlwapi', 'wsock32', 'ws2_32', 'kernel32', 'oleaut32', 'dinput8', 'dxguid', 'ksuser', 'imm32', 'bcrypt', 'avrt', 'uuid', 'dwmapi']) - - env.Append(CPPDEFINES=['VULKAN_ENABLED']) - if not env['builtin_vulkan']: - env.Append(LIBS=['vulkan']) + env.Append(CCFLAGS=["-mwindows"]) + + env.Append(CPPDEFINES=["WINDOWS_ENABLED", "WASAPI_ENABLED", "WINMIDI_ENABLED"]) + env.Append(CPPDEFINES=[("WINVER", env["target_win_version"]), ("_WIN32_WINNT", env["target_win_version"])]) + env.Append( + LIBS=[ + "mingw32", + "dsound", + "ole32", + "d3d9", + "winmm", + "gdi32", + "iphlpapi", + "shlwapi", + "wsock32", + "ws2_32", + "kernel32", + "oleaut32", + "dinput8", + "dxguid", + "ksuser", + "imm32", + "bcrypt", + "avrt", + "uuid", + "dwmapi", + ] + ) + + env.Append(CPPDEFINES=["VULKAN_ENABLED"]) + if not env["builtin_vulkan"]: + env.Append(LIBS=["vulkan"]) else: - env.Append(LIBS=['cfgmgr32']) + env.Append(LIBS=["cfgmgr32"]) ## TODO !!! Reenable when OpenGLES Rendering Device is implemented !!! - #env.Append(CPPDEFINES=['OPENGL_ENABLED']) - env.Append(LIBS=['opengl32']) + # env.Append(CPPDEFINES=['OPENGL_ENABLED']) + env.Append(LIBS=["opengl32"]) - env.Append(CPPDEFINES=['MINGW_ENABLED', ('MINGW_HAS_SECURE_API', 1)]) + env.Append(CPPDEFINES=["MINGW_ENABLED", ("MINGW_HAS_SECURE_API", 1)]) # resrc - env.Append(BUILDERS={'RES': env.Builder(action=build_res_file, suffix='.o', src_suffix='.rc')}) + env.Append(BUILDERS={"RES": env.Builder(action=build_res_file, suffix=".o", src_suffix=".rc")}) + def configure(env): # At this point the env has been set up with basic tools/compilers. - env.Prepend(CPPPATH=['#platform/windows']) + env.Prepend(CPPPATH=["#platform/windows"]) - print("Configuring for Windows: target=%s, bits=%s" % (env['target'], env['bits'])) + print("Configuring for Windows: target=%s, bits=%s" % (env["target"], env["bits"])) - if (os.name == "nt"): - env['ENV'] = os.environ # this makes build less repeatable, but simplifies some things - env['ENV']['TMP'] = os.environ['TMP'] + if os.name == "nt": + env["ENV"] = os.environ # this makes build less repeatable, but simplifies some things + env["ENV"]["TMP"] = os.environ["TMP"] # First figure out which compiler, version, and target arch we're using if os.getenv("VCINSTALLDIR") and not env["use_mingw"]: @@ -397,7 +450,7 @@ def configure(env): setup_msvc_manual(env) env.msvc = True manual_msvc_config = True - elif env.get('MSVC_VERSION', '') and not env["use_mingw"]: + elif env.get("MSVC_VERSION", "") and not env["use_mingw"]: setup_msvc_auto(env) env.msvc = True manual_msvc_config = False @@ -409,5 +462,5 @@ def configure(env): if env.msvc: configure_msvc(env, manual_msvc_config) - else: # MinGW + else: # MinGW configure_mingw(env) diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp index 836fa5946a..5744f3506e 100644 --- a/platform/windows/display_server_windows.cpp +++ b/platform/windows/display_server_windows.cpp @@ -1019,7 +1019,8 @@ bool DisplayServerWindows::window_is_maximize_allowed(WindowID p_window) const { _THREAD_SAFE_METHOD_ ERR_FAIL_COND_V(!windows.has(p_window), false); - const WindowData &wd = windows[p_window]; + + // FIXME: Implement this, or confirm that it should always be true. return true; //no idea } @@ -1049,14 +1050,17 @@ void DisplayServerWindows::window_set_flag(WindowFlags p_flag, bool p_enabled, W } break; case WINDOW_FLAG_TRANSPARENT: { + // FIXME: Implement. } break; case WINDOW_FLAG_NO_FOCUS: { wd.no_focus = p_enabled; _update_window_style(p_window); } break; + case WINDOW_FLAG_MAX: break; } } + bool DisplayServerWindows::window_get_flag(WindowFlags p_flag, WindowID p_window) const { _THREAD_SAFE_METHOD_ @@ -1078,7 +1082,13 @@ bool DisplayServerWindows::window_get_flag(WindowFlags p_flag, WindowID p_window } break; case WINDOW_FLAG_TRANSPARENT: { + // FIXME: Implement. + } break; + case WINDOW_FLAG_NO_FOCUS: { + + return wd.no_focus; } break; + case WINDOW_FLAG_MAX: break; } return false; @@ -1882,7 +1892,6 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA _send_window_event(windows[window_id], WINDOW_EVENT_CLOSE_REQUEST); - //force_quit=true; return 0; // Jump Back } case WM_MOUSELEAVE: { diff --git a/platform/windows/display_server_windows.h b/platform/windows/display_server_windows.h index e2c2fd7253..470256cee7 100644 --- a/platform/windows/display_server_windows.h +++ b/platform/windows/display_server_windows.h @@ -266,7 +266,6 @@ class DisplayServerWindows : public DisplayServer { bool shift_mem = false; bool control_mem = false; bool meta_mem = false; - bool force_quit = false; uint32_t last_button_state = 0; bool use_raw_input = false; bool drop_events = false; diff --git a/platform/windows/platform_windows_builders.py b/platform/windows/platform_windows_builders.py index a1ad3b8b50..22e33b51b4 100644 --- a/platform/windows/platform_windows_builders.py +++ b/platform/windows/platform_windows_builders.py @@ -9,14 +9,14 @@ from platform_methods import subprocess_main def make_debug_mingw(target, source, env): mingw_prefix = "" - if (env["bits"] == "32"): + if env["bits"] == "32": mingw_prefix = env["mingw_prefix_32"] else: mingw_prefix = env["mingw_prefix_64"] - os.system(mingw_prefix + 'objcopy --only-keep-debug {0} {0}.debugsymbols'.format(target[0])) - os.system(mingw_prefix + 'strip --strip-debug --strip-unneeded {0}'.format(target[0])) - os.system(mingw_prefix + 'objcopy --add-gnu-debuglink={0}.debugsymbols {0}'.format(target[0])) + os.system(mingw_prefix + "objcopy --only-keep-debug {0} {0}.debugsymbols".format(target[0])) + os.system(mingw_prefix + "strip --strip-debug --strip-unneeded {0}".format(target[0])) + os.system(mingw_prefix + "objcopy --add-gnu-debuglink={0}.debugsymbols {0}".format(target[0])) -if __name__ == '__main__': +if __name__ == "__main__": subprocess_main(globals()) diff --git a/platform_methods.py b/platform_methods.py index eed76bc8a8..805d7de82a 100644 --- a/platform_methods.py +++ b/platform_methods.py @@ -11,7 +11,6 @@ JSON_SERIALIZABLE_TYPES = (bool, int, float, str) def run_in_subprocess(builder_function): - @functools.wraps(builder_function) def wrapper(target, source, env): @@ -20,38 +19,36 @@ def run_in_subprocess(builder_function): source = [node.srcnode().abspath for node in source] # Short circuit on non-Windows platforms, no need to run in subprocess - if sys.platform not in ('win32', 'cygwin'): + if sys.platform not in ("win32", "cygwin"): return builder_function(target, source, env) # Identify module module_name = builder_function.__module__ function_name = builder_function.__name__ module_path = sys.modules[module_name].__file__ - if module_path.endswith('.pyc') or module_path.endswith('.pyo'): + if module_path.endswith(".pyc") or module_path.endswith(".pyo"): module_path = module_path[:-1] # Subprocess environment subprocess_env = os.environ.copy() - subprocess_env['PYTHONPATH'] = os.pathsep.join([os.getcwd()] + sys.path) + subprocess_env["PYTHONPATH"] = os.pathsep.join([os.getcwd()] + sys.path) # Keep only JSON serializable environment items - filtered_env = dict( - (key, value) - for key, value in env.items() - if isinstance(value, JSON_SERIALIZABLE_TYPES) - ) + filtered_env = dict((key, value) for key, value in env.items() if isinstance(value, JSON_SERIALIZABLE_TYPES)) # Save parameters args = (target, source, filtered_env) data = dict(fn=function_name, args=args) - json_path = os.path.join(os.environ['TMP'], uuid.uuid4().hex + '.json') - with open(json_path, 'wt') as json_file: + json_path = os.path.join(os.environ["TMP"], uuid.uuid4().hex + ".json") + with open(json_path, "wt") as json_file: json.dump(data, json_file, indent=2) json_file_size = os.stat(json_path).st_size - print('Executing builder function in subprocess: ' - 'module_path=%r, parameter_file=%r, parameter_file_size=%r, target=%r, source=%r' % ( - module_path, json_path, json_file_size, target, source)) + print( + "Executing builder function in subprocess: " + "module_path=%r, parameter_file=%r, parameter_file_size=%r, target=%r, source=%r" + % (module_path, json_path, json_file_size, target, source) + ) try: exit_code = subprocess.call([sys.executable, module_path, json_path], env=subprocess_env) finally: @@ -59,13 +56,15 @@ def run_in_subprocess(builder_function): os.remove(json_path) except (OSError, IOError) as e: # Do not fail the entire build if it cannot delete a temporary file - print('WARNING: Could not delete temporary file: path=%r; [%s] %s' % - (json_path, e.__class__.__name__, e)) + print( + "WARNING: Could not delete temporary file: path=%r; [%s] %s" % (json_path, e.__class__.__name__, e) + ) # Must succeed if exit_code: raise RuntimeError( - 'Failed to run builder function in subprocess: module_path=%r; data=%r' % (module_path, data)) + "Failed to run builder function in subprocess: module_path=%r; data=%r" % (module_path, data) + ) return wrapper @@ -75,5 +74,5 @@ def subprocess_main(namespace): with open(sys.argv[1]) as json_file: data = json.load(json_file) - fn = namespace[data['fn']] - fn(*data['args']) + fn = namespace[data["fn"]] + fn(*data["args"]) diff --git a/scene/2d/SCsub b/scene/2d/SCsub index b01e2fd54d..fc61250247 100644 --- a/scene/2d/SCsub +++ b/scene/2d/SCsub @@ -1,5 +1,5 @@ #!/usr/bin/env python -Import('env') +Import("env") env.add_source_files(env.scene_sources, "*.cpp") diff --git a/scene/2d/cpu_particles_2d.cpp b/scene/2d/cpu_particles_2d.cpp index ba604c086e..47465f727e 100644 --- a/scene/2d/cpu_particles_2d.cpp +++ b/scene/2d/cpu_particles_2d.cpp @@ -1145,7 +1145,7 @@ void CPUParticles2D::_notification(int p_what) { void CPUParticles2D::convert_from_particles(Node *p_particles) { GPUParticles2D *particles = Object::cast_to<GPUParticles2D>(p_particles); - ERR_FAIL_COND_MSG(!particles, "Only Particles2D nodes can be converted to CPUParticles2D."); + ERR_FAIL_COND_MSG(!particles, "Only GPUParticles2D nodes can be converted to CPUParticles2D."); set_emitting(particles->is_emitting()); set_amount(particles->get_amount()); diff --git a/scene/2d/gpu_particles_2d.cpp b/scene/2d/gpu_particles_2d.cpp index fd9706eb2a..de3f8fa09e 100644 --- a/scene/2d/gpu_particles_2d.cpp +++ b/scene/2d/gpu_particles_2d.cpp @@ -229,7 +229,7 @@ bool GPUParticles2D::get_fractional_delta() const { String GPUParticles2D::get_configuration_warning() const { if (RenderingServer::get_singleton()->is_low_end()) { - return TTR("GPU-based particles are not supported by the GLES2 video driver.\nUse the CPUParticles2D node instead. You can use the \"Convert to CPUParticles\" option for this purpose."); + return TTR("GPU-based particles are not supported by the GLES2 video driver.\nUse the CPUParticles2D node instead. You can use the \"Convert to CPUParticles2D\" option for this purpose."); } String warnings; diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp index 942d2aac24..d866906ca5 100644 --- a/scene/2d/physics_body_2d.cpp +++ b/scene/2d/physics_body_2d.cpp @@ -157,7 +157,7 @@ void PhysicsBody2D::add_collision_exception_with(Node *p_node) { ERR_FAIL_NULL(p_node); PhysicsBody2D *physics_body = Object::cast_to<PhysicsBody2D>(p_node); - ERR_FAIL_COND_MSG(!physics_body, "Collision exception only works between two objects of PhysicsBody type."); + ERR_FAIL_COND_MSG(!physics_body, "Collision exception only works between two objects of PhysicsBody2D type."); PhysicsServer2D::get_singleton()->body_add_collision_exception(get_rid(), physics_body->get_rid()); } @@ -165,7 +165,7 @@ void PhysicsBody2D::remove_collision_exception_with(Node *p_node) { ERR_FAIL_NULL(p_node); PhysicsBody2D *physics_body = Object::cast_to<PhysicsBody2D>(p_node); - ERR_FAIL_COND_MSG(!physics_body, "Collision exception only works between two objects of PhysicsBody type."); + ERR_FAIL_COND_MSG(!physics_body, "Collision exception only works between two objects of PhysicsBody2D type."); PhysicsServer2D::get_singleton()->body_remove_collision_exception(get_rid(), physics_body->get_rid()); } diff --git a/scene/3d/SCsub b/scene/3d/SCsub index 45b96bd9c4..ce69e8aa19 100644 --- a/scene/3d/SCsub +++ b/scene/3d/SCsub @@ -1,8 +1,8 @@ #!/usr/bin/env python -Import('env') +Import("env") -if env['disable_3d']: +if env["disable_3d"]: env.add_source_files(env.scene_sources, "node_3d.cpp") env.add_source_files(env.scene_sources, "skeleton_3d.cpp") else: diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp index bddf748be7..9f5170fa98 100644 --- a/scene/3d/audio_stream_player_3d.cpp +++ b/scene/3d/audio_stream_player_3d.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "audio_stream_player_3d.h" + #include "core/engine.h" #include "scene/3d/area_3d.h" #include "scene/3d/camera_3d.h" @@ -96,7 +97,7 @@ static const Vector3 speaker_directions[7] = { }; void AudioStreamPlayer3D::_calc_output_vol(const Vector3 &source_dir, real_t tightness, AudioStreamPlayer3D::Output &output) { - unsigned int speaker_count; // only main speakers (no LFE) + unsigned int speaker_count = 0; // only main speakers (no LFE) switch (AudioServer::get_singleton()->get_speaker_mode()) { case AudioServer::SPEAKER_MODE_STEREO: speaker_count = 2; diff --git a/scene/3d/collision_object_3d.cpp b/scene/3d/collision_object_3d.cpp index da37ca8ae2..6ee0512546 100644 --- a/scene/3d/collision_object_3d.cpp +++ b/scene/3d/collision_object_3d.cpp @@ -374,7 +374,7 @@ String CollisionObject3D::get_configuration_warning() const { if (!warning.empty()) { warning += "\n\n"; } - warning += TTR("This node has no shape, so it can't collide or interact with other objects.\nConsider adding a CollisionShape or CollisionPolygon as a child to define its shape."); + warning += TTR("This node has no shape, so it can't collide or interact with other objects.\nConsider adding a CollisionShape3D or CollisionPolygon3D as a child to define its shape."); } return warning; diff --git a/scene/3d/collision_polygon_3d.cpp b/scene/3d/collision_polygon_3d.cpp index c8b1b728bc..982205137b 100644 --- a/scene/3d/collision_polygon_3d.cpp +++ b/scene/3d/collision_polygon_3d.cpp @@ -165,11 +165,11 @@ bool CollisionPolygon3D::is_disabled() const { String CollisionPolygon3D::get_configuration_warning() const { if (!Object::cast_to<CollisionObject3D>(get_parent())) { - return TTR("CollisionPolygon only serves to provide a collision shape to a CollisionObject derived node. Please only use it as a child of Area, StaticBody, RigidBody, KinematicBody, etc. to give them a shape."); + return TTR("CollisionPolygon3D only serves to provide a collision shape to a CollisionObject3D derived node. Please only use it as a child of Area3D, StaticBody3D, RigidBody3D, KinematicBody3D, etc. to give them a shape."); } if (polygon.empty()) { - return TTR("An empty CollisionPolygon has no effect on collision."); + return TTR("An empty CollisionPolygon3D has no effect on collision."); } return String(); diff --git a/scene/3d/collision_shape_3d.cpp b/scene/3d/collision_shape_3d.cpp index e736f20614..6aecfd08cc 100644 --- a/scene/3d/collision_shape_3d.cpp +++ b/scene/3d/collision_shape_3d.cpp @@ -29,6 +29,10 @@ /*************************************************************************/ #include "collision_shape_3d.h" + +#include "core/math/quick_hull.h" +#include "mesh_instance_3d.h" +#include "physics_body_3d.h" #include "scene/resources/box_shape_3d.h" #include "scene/resources/capsule_shape_3d.h" #include "scene/resources/concave_polygon_shape_3d.h" @@ -37,10 +41,8 @@ #include "scene/resources/sphere_shape_3d.h" #include "scene/resources/world_margin_shape_3d.h" #include "servers/rendering_server.h" + //TODO: Implement CylinderShape and HeightMapShape? -#include "core/math/quick_hull.h" -#include "mesh_instance_3d.h" -#include "physics_body_3d.h" void CollisionShape3D::make_convex_from_brothers() { @@ -116,17 +118,17 @@ void CollisionShape3D::resource_changed(RES res) { String CollisionShape3D::get_configuration_warning() const { if (!Object::cast_to<CollisionObject3D>(get_parent())) { - return TTR("CollisionShape only serves to provide a collision shape to a CollisionObject derived node. Please only use it as a child of Area, StaticBody, RigidBody, KinematicBody, etc. to give them a shape."); + return TTR("CollisionShape3D only serves to provide a collision shape to a CollisionObject3D derived node. Please only use it as a child of Area3D, StaticBody3D, RigidBody3D, KinematicBody3D, etc. to give them a shape."); } if (!shape.is_valid()) { - return TTR("A shape must be provided for CollisionShape to function. Please create a shape resource for it."); + return TTR("A shape must be provided for CollisionShape3D to function. Please create a shape resource for it."); } if (Object::cast_to<RigidBody3D>(get_parent())) { if (Object::cast_to<ConcavePolygonShape3D>(*shape)) { if (Object::cast_to<RigidBody3D>(get_parent())->get_mode() != RigidBody3D::MODE_STATIC) { - return TTR("ConcavePolygonShape doesn't support RigidBody in another mode than static."); + return TTR("ConcavePolygonShape3D doesn't support RigidBody3D in another mode than static."); } } } diff --git a/scene/3d/cpu_particles_3d.cpp b/scene/3d/cpu_particles_3d.cpp index 4350d4da25..2226b0ed83 100644 --- a/scene/3d/cpu_particles_3d.cpp +++ b/scene/3d/cpu_particles_3d.cpp @@ -228,7 +228,7 @@ String CPUParticles3D::get_configuration_warning() const { get_param_curve(PARAM_ANIM_SPEED).is_valid() || get_param_curve(PARAM_ANIM_OFFSET).is_valid())) { if (warnings != String()) warnings += "\n"; - warnings += "- " + TTR("CPUParticles animation requires the usage of a StandardMaterial3D whose Billboard Mode is set to \"Particle Billboard\"."); + warnings += "- " + TTR("CPUParticles3D animation requires the usage of a StandardMaterial3D whose Billboard Mode is set to \"Particle Billboard\"."); } return warnings; @@ -1206,7 +1206,7 @@ void CPUParticles3D::_notification(int p_what) { void CPUParticles3D::convert_from_particles(Node *p_particles) { GPUParticles3D *particles = Object::cast_to<GPUParticles3D>(p_particles); - ERR_FAIL_COND_MSG(!particles, "Only Particles nodes can be converted to CPUParticles."); + ERR_FAIL_COND_MSG(!particles, "Only GPUParticles3D nodes can be converted to CPUParticles3D."); set_emitting(particles->is_emitting()); set_amount(particles->get_amount()); diff --git a/scene/3d/gpu_particles_3d.cpp b/scene/3d/gpu_particles_3d.cpp index ad45228ca8..8646d4f290 100644 --- a/scene/3d/gpu_particles_3d.cpp +++ b/scene/3d/gpu_particles_3d.cpp @@ -241,7 +241,7 @@ bool GPUParticles3D::get_fractional_delta() const { String GPUParticles3D::get_configuration_warning() const { if (RenderingServer::get_singleton()->is_low_end()) { - return TTR("GPU-based particles are not supported by the GLES2 video driver.\nUse the CPUParticles node instead. You can use the \"Convert to CPUParticles\" option for this purpose."); + return TTR("GPU-based particles are not supported by the GLES2 video driver.\nUse the CPUParticles3D node instead. You can use the \"Convert to CPUParticles3D\" option for this purpose."); } String warnings; diff --git a/scene/3d/light_3d.cpp b/scene/3d/light_3d.cpp index 7fc7fe2bf5..be3b369724 100644 --- a/scene/3d/light_3d.cpp +++ b/scene/3d/light_3d.cpp @@ -336,7 +336,7 @@ Light3D::Light3D(RenderingServer::LightType p_type) { Light3D::Light3D() { type = RenderingServer::LIGHT_DIRECTIONAL; - ERR_PRINT("Light should not be instanced directly; use the DirectionalLight, OmniLight or SpotLight subtypes instead."); + ERR_PRINT("Light3D should not be instanced directly; use the DirectionalLight3D, OmniLight3D or SpotLight3D subtypes instead."); } Light3D::~Light3D() { @@ -464,7 +464,7 @@ String SpotLight3D::get_configuration_warning() const { warning += "\n\n"; } - warning += TTR("A SpotLight with an angle wider than 90 degrees cannot cast shadows."); + warning += TTR("A SpotLight3D with an angle wider than 90 degrees cannot cast shadows."); } return warning; diff --git a/scene/3d/mesh_instance_3d.cpp b/scene/3d/mesh_instance_3d.cpp index 284bbd7091..30aabf6e00 100644 --- a/scene/3d/mesh_instance_3d.cpp +++ b/scene/3d/mesh_instance_3d.cpp @@ -305,6 +305,23 @@ Ref<Material> MeshInstance3D::get_surface_material(int p_surface) const { return materials[p_surface]; } +Ref<Material> MeshInstance3D::get_active_material(int p_surface) const { + + if (get_material_override() != Ref<Material>()) { + return get_material_override(); + } else if (p_surface < materials.size()) { + return materials[p_surface]; + } else { + Ref<Mesh> mesh = get_mesh(); + + if (mesh.is_null() || p_surface >= mesh->get_surface_count()) { + return Ref<Material>(); + } + + return mesh->surface_get_material(p_surface); + } +} + void MeshInstance3D::_mesh_changed() { materials.resize(mesh->get_surface_count()); @@ -397,6 +414,7 @@ void MeshInstance3D::_bind_methods() { ClassDB::bind_method(D_METHOD("get_surface_material_count"), &MeshInstance3D::get_surface_material_count); ClassDB::bind_method(D_METHOD("set_surface_material", "surface", "material"), &MeshInstance3D::set_surface_material); ClassDB::bind_method(D_METHOD("get_surface_material", "surface"), &MeshInstance3D::get_surface_material); + ClassDB::bind_method(D_METHOD("get_active_material", "surface"), &MeshInstance3D::get_active_material); ClassDB::bind_method(D_METHOD("create_trimesh_collision"), &MeshInstance3D::create_trimesh_collision); ClassDB::set_method_flags("MeshInstance3D", "create_trimesh_collision", METHOD_FLAGS_DEFAULT); diff --git a/scene/3d/mesh_instance_3d.h b/scene/3d/mesh_instance_3d.h index e45f68e295..914148f427 100644 --- a/scene/3d/mesh_instance_3d.h +++ b/scene/3d/mesh_instance_3d.h @@ -84,6 +84,7 @@ public: int get_surface_material_count() const; void set_surface_material(int p_surface, const Ref<Material> &p_material); Ref<Material> get_surface_material(int p_surface) const; + Ref<Material> get_active_material(int p_surface) const; Node *create_trimesh_collision_node(); void create_trimesh_collision(); diff --git a/scene/3d/navigation_agent_3d.cpp b/scene/3d/navigation_agent_3d.cpp index 76f1d4688d..a131684a8a 100644 --- a/scene/3d/navigation_agent_3d.cpp +++ b/scene/3d/navigation_agent_3d.cpp @@ -298,7 +298,7 @@ void NavigationAgent3D::_avoidance_done(Vector3 p_new_velocity) { String NavigationAgent3D::get_configuration_warning() const { if (!Object::cast_to<Node3D>(get_parent())) { - return TTR("The NavigationAgent can be used only under a spatial node."); + return TTR("The NavigationAgent3D can be used only under a spatial node."); } return String(); diff --git a/scene/3d/navigation_obstacle_3d.cpp b/scene/3d/navigation_obstacle_3d.cpp index 63c273b4ca..fa976e5d18 100644 --- a/scene/3d/navigation_obstacle_3d.cpp +++ b/scene/3d/navigation_obstacle_3d.cpp @@ -118,7 +118,7 @@ Node *NavigationObstacle3D::get_navigation_node() const { String NavigationObstacle3D::get_configuration_warning() const { if (!Object::cast_to<Node3D>(get_parent())) { - return TTR("The NavigationObstacle only serves to provide collision avoidance to a spatial object."); + return TTR("The NavigationObstacle3D only serves to provide collision avoidance to a spatial object."); } return String(); diff --git a/scene/3d/navigation_region_3d.cpp b/scene/3d/navigation_region_3d.cpp index 4bb2c72172..08c0fbf4d1 100644 --- a/scene/3d/navigation_region_3d.cpp +++ b/scene/3d/navigation_region_3d.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "navigation_region_3d.h" + #include "core/os/thread.h" #include "mesh_instance_3d.h" #include "navigation_3d.h" @@ -214,7 +215,7 @@ String NavigationRegion3D::get_configuration_warning() const { c = Object::cast_to<Node3D>(c->get_parent()); } - return TTR("NavigationRegion must be a child or grandchild to a Navigation node. It only provides navigation data."); + return TTR("NavigationRegion3D must be a child or grandchild to a Navigation3D node. It only provides navigation data."); } void NavigationRegion3D::_bind_methods() { diff --git a/scene/3d/path_3d.cpp b/scene/3d/path_3d.cpp index 2169f664ea..0f1f9bb8a7 100644 --- a/scene/3d/path_3d.cpp +++ b/scene/3d/path_3d.cpp @@ -262,11 +262,11 @@ String PathFollow3D::get_configuration_warning() const { return String(); if (!Object::cast_to<Path3D>(get_parent())) { - return TTR("PathFollow only works when set as a child of a Path node."); + return TTR("PathFollow3D only works when set as a child of a Path3D node."); } else { Path3D *path = Object::cast_to<Path3D>(get_parent()); if (path->get_curve().is_valid() && !path->get_curve()->is_up_vector_enabled() && rotation_mode == ROTATION_ORIENTED) { - return TTR("PathFollow's ROTATION_ORIENTED requires \"Up Vector\" to be enabled in its parent Path's Curve resource."); + return TTR("PathFollow3D's ROTATION_ORIENTED requires \"Up Vector\" to be enabled in its parent Path3D's Curve resource."); } } diff --git a/scene/3d/physics_body_3d.cpp b/scene/3d/physics_body_3d.cpp index 680d6e8594..37981f914c 100644 --- a/scene/3d/physics_body_3d.cpp +++ b/scene/3d/physics_body_3d.cpp @@ -128,7 +128,7 @@ void PhysicsBody3D::add_collision_exception_with(Node *p_node) { ERR_FAIL_NULL(p_node); CollisionObject3D *collision_object = Object::cast_to<CollisionObject3D>(p_node); - ERR_FAIL_COND_MSG(!collision_object, "Collision exception only works between two CollisionObject."); + ERR_FAIL_COND_MSG(!collision_object, "Collision exception only works between two CollisionObject3Ds."); PhysicsServer3D::get_singleton()->body_add_collision_exception(get_rid(), collision_object->get_rid()); } @@ -136,7 +136,7 @@ void PhysicsBody3D::remove_collision_exception_with(Node *p_node) { ERR_FAIL_NULL(p_node); CollisionObject3D *collision_object = Object::cast_to<CollisionObject3D>(p_node); - ERR_FAIL_COND_MSG(!collision_object, "Collision exception only works between two CollisionObject."); + ERR_FAIL_COND_MSG(!collision_object, "Collision exception only works between two CollisionObject3Ds."); PhysicsServer3D::get_singleton()->body_remove_collision_exception(get_rid(), collision_object->get_rid()); } @@ -406,7 +406,7 @@ void RigidBody3D::_direct_state_changed(Object *p_state) { _RigidBodyInOut *toadd = (_RigidBodyInOut *)alloca(state->get_contact_count() * sizeof(_RigidBodyInOut)); int toadd_count = 0; //state->get_contact_count(); - RigidBody_RemoveAction *toremove = (RigidBody_RemoveAction *)alloca(rc * sizeof(RigidBody_RemoveAction)); + RigidBody3D_RemoveAction *toremove = (RigidBody3D_RemoveAction *)alloca(rc * sizeof(RigidBody3D_RemoveAction)); int toremove_count = 0; //put the ones to add @@ -794,7 +794,7 @@ String RigidBody3D::get_configuration_warning() const { if (warning != String()) { warning += "\n\n"; } - warning += TTR("Size changes to RigidBody (in character or rigid modes) will be overridden by the physics engine when running.\nChange the size in children collision shapes instead."); + warning += TTR("Size changes to RigidBody3D (in character or rigid modes) will be overridden by the physics engine when running.\nChange the size in children collision shapes instead."); } return warning; @@ -864,7 +864,7 @@ void RigidBody3D::_bind_methods() { ClassDB::bind_method(D_METHOD("get_colliding_bodies"), &RigidBody3D::get_colliding_bodies); - BIND_VMETHOD(MethodInfo("_integrate_forces", PropertyInfo(Variant::OBJECT, "state", PROPERTY_HINT_RESOURCE_TYPE, "PhysicsDirectBodyState"))); + BIND_VMETHOD(MethodInfo("_integrate_forces", PropertyInfo(Variant::OBJECT, "state", PROPERTY_HINT_RESOURCE_TYPE, "PhysicsDirectBodyState3D"))); ADD_PROPERTY(PropertyInfo(Variant::INT, "mode", PROPERTY_HINT_ENUM, "Rigid,Static,Character,Kinematic"), "set_mode", "get_mode"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "mass", PROPERTY_HINT_EXP_RANGE, "0.01,65535,0.01"), "set_mass", "get_mass"); diff --git a/scene/3d/physics_body_3d.h b/scene/3d/physics_body_3d.h index ed7cfa8733..bf7854b68d 100644 --- a/scene/3d/physics_body_3d.h +++ b/scene/3d/physics_body_3d.h @@ -156,7 +156,7 @@ protected: tagged = false; } }; - struct RigidBody_RemoveAction { + struct RigidBody3D_RemoveAction { ObjectID body_id; ShapePair pair; diff --git a/scene/3d/soft_body_3d.cpp b/scene/3d/soft_body_3d.cpp index ee9ce1dd71..6d2808cfce 100644 --- a/scene/3d/soft_body_3d.cpp +++ b/scene/3d/soft_body_3d.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "soft_body_3d.h" + #include "core/list.h" #include "core/object.h" #include "core/os/os.h" @@ -402,7 +403,7 @@ String SoftBody3D::get_configuration_warning() const { if (!warning.empty()) warning += "\n\n"; - warning += TTR("Size changes to SoftBody will be overridden by the physics engine when running.\nChange the size in children collision shapes instead."); + warning += TTR("Size changes to SoftBody3D will be overridden by the physics engine when running.\nChange the size in children collision shapes instead."); } return warning; @@ -585,14 +586,14 @@ Array SoftBody3D::get_collision_exceptions() { void SoftBody3D::add_collision_exception_with(Node *p_node) { ERR_FAIL_NULL(p_node); CollisionObject3D *collision_object = Object::cast_to<CollisionObject3D>(p_node); - ERR_FAIL_COND_MSG(!collision_object, "Collision exception only works between two CollisionObject."); + ERR_FAIL_COND_MSG(!collision_object, "Collision exception only works between two CollisionObject3Ds."); PhysicsServer3D::get_singleton()->soft_body_add_collision_exception(physics_rid, collision_object->get_rid()); } void SoftBody3D::remove_collision_exception_with(Node *p_node) { ERR_FAIL_NULL(p_node); CollisionObject3D *collision_object = Object::cast_to<CollisionObject3D>(p_node); - ERR_FAIL_COND_MSG(!collision_object, "Collision exception only works between two CollisionObject."); + ERR_FAIL_COND_MSG(!collision_object, "Collision exception only works between two CollisionObject3Ds."); PhysicsServer3D::get_singleton()->soft_body_remove_collision_exception(physics_rid, collision_object->get_rid()); } diff --git a/scene/3d/vehicle_body_3d.cpp b/scene/3d/vehicle_body_3d.cpp index 5984b776b2..ac7608a3d5 100644 --- a/scene/3d/vehicle_body_3d.cpp +++ b/scene/3d/vehicle_body_3d.cpp @@ -105,7 +105,7 @@ void VehicleWheel3D::_notification(int p_what) { String VehicleWheel3D::get_configuration_warning() const { if (!Object::cast_to<VehicleBody3D>(get_parent())) { - return TTR("VehicleWheel serves to provide a wheel system to a VehicleBody. Please use it as a child of a VehicleBody."); + return TTR("VehicleWheel3D serves to provide a wheel system to a VehicleBody3D. Please use it as a child of a VehicleBody3D."); } return String(); @@ -285,7 +285,7 @@ void VehicleWheel3D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "engine_force", PROPERTY_HINT_RANGE, "0.00,1024.0,0.01,or_greater"), "set_engine_force", "get_engine_force"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "brake", PROPERTY_HINT_RANGE, "0.0,1.0,0.01"), "set_brake", "get_brake"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "steering", PROPERTY_HINT_RANGE, "-180,180.0,0.01"), "set_steering", "get_steering"); - ADD_GROUP("VehicleBody Motion", ""); + ADD_GROUP("VehicleBody3D Motion", ""); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_as_traction"), "set_use_as_traction", "is_used_as_traction"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_as_steering"), "set_use_as_steering", "is_used_as_steering"); ADD_GROUP("Wheel", "wheel_"); diff --git a/scene/SCsub b/scene/SCsub index 1c5b87b87a..f9fc00f3f2 100644 --- a/scene/SCsub +++ b/scene/SCsub @@ -1,16 +1,16 @@ #!/usr/bin/env python -Import('env') +Import("env") env.scene_sources = [] # Thirdparty code thirdparty_dir = "#thirdparty/misc/" thirdparty_sources = [ - # C++ sources - "easing_equations.cpp", - # C sources - "mikktspace.c", + # C++ sources + "easing_equations.cpp", + # C sources + "mikktspace.c", ] thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] @@ -23,14 +23,14 @@ env.add_source_files(env.scene_sources, "*.cpp") # Chain load SCsubs -SConscript('main/SCsub') -SConscript('gui/SCsub') -SConscript('3d/SCsub') -SConscript('2d/SCsub') -SConscript('animation/SCsub') -SConscript('audio/SCsub') -SConscript('resources/SCsub') -SConscript('debugger/SCsub') +SConscript("main/SCsub") +SConscript("gui/SCsub") +SConscript("3d/SCsub") +SConscript("2d/SCsub") +SConscript("animation/SCsub") +SConscript("audio/SCsub") +SConscript("resources/SCsub") +SConscript("debugger/SCsub") # Build it all as a library diff --git a/scene/animation/SCsub b/scene/animation/SCsub index b01e2fd54d..fc61250247 100644 --- a/scene/animation/SCsub +++ b/scene/animation/SCsub @@ -1,5 +1,5 @@ #!/usr/bin/env python -Import('env') +Import("env") env.add_source_files(env.scene_sources, "*.cpp") diff --git a/scene/audio/SCsub b/scene/audio/SCsub index b01e2fd54d..fc61250247 100644 --- a/scene/audio/SCsub +++ b/scene/audio/SCsub @@ -1,5 +1,5 @@ #!/usr/bin/env python -Import('env') +Import("env") env.add_source_files(env.scene_sources, "*.cpp") diff --git a/scene/debugger/SCsub b/scene/debugger/SCsub index b01e2fd54d..fc61250247 100644 --- a/scene/debugger/SCsub +++ b/scene/debugger/SCsub @@ -1,5 +1,5 @@ #!/usr/bin/env python -Import('env') +Import("env") env.add_source_files(env.scene_sources, "*.cpp") diff --git a/scene/gui/SCsub b/scene/gui/SCsub index b01e2fd54d..fc61250247 100644 --- a/scene/gui/SCsub +++ b/scene/gui/SCsub @@ -1,5 +1,5 @@ #!/usr/bin/env python -Import('env') +Import("env") env.add_source_files(env.scene_sources, "*.cpp") diff --git a/scene/gui/panel.cpp b/scene/gui/panel.cpp index ae51463a15..a17d0eb9c6 100644 --- a/scene/gui/panel.cpp +++ b/scene/gui/panel.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "panel.h" + #include "core/print_string.h" void Panel::_notification(int p_what) { @@ -54,7 +55,11 @@ void Panel::_bind_methods() { ClassDB::bind_method(D_METHOD("get_mode"), &Panel::get_mode); ADD_PROPERTY(PropertyInfo(Variant::INT, "mode", PROPERTY_HINT_ENUM, "Background,Foreground"), "set_mode", "get_mode"); + + BIND_ENUM_CONSTANT(MODE_BACKGROUND); + BIND_ENUM_CONSTANT(MODE_FOREGROUND); } + Panel::Panel() { // Has visible stylebox, so stop by default. set_mouse_filter(MOUSE_FILTER_STOP); diff --git a/scene/gui/panel.h b/scene/gui/panel.h index 739c64c0a6..75e266b6a6 100644 --- a/scene/gui/panel.h +++ b/scene/gui/panel.h @@ -40,7 +40,7 @@ class Panel : public Control { public: enum Mode { MODE_BACKGROUND, - MODE_FOREGROUND + MODE_FOREGROUND, }; private: @@ -59,4 +59,5 @@ public: }; VARIANT_ENUM_CAST(Panel::Mode) -#endif + +#endif // PANEL_H diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index 986141aca1..1e933c9aa1 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -394,7 +394,7 @@ void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) { Ref<InputEventKey> k = p_event; - if (allow_search && k.is_valid() && k->get_unicode()) { + if (allow_search && k.is_valid() && k->get_unicode() && k->is_pressed()) { uint64_t now = OS::get_singleton()->get_ticks_msec(); uint64_t diff = now - search_time_msec; diff --git a/scene/main/SCsub b/scene/main/SCsub index b01e2fd54d..fc61250247 100644 --- a/scene/main/SCsub +++ b/scene/main/SCsub @@ -1,5 +1,5 @@ #!/usr/bin/env python -Import('env') +Import("env") env.add_source_files(env.scene_sources, "*.cpp") diff --git a/scene/main/window.cpp b/scene/main/window.cpp index 3a8f7ebb60..406f130b71 100644 --- a/scene/main/window.cpp +++ b/scene/main/window.cpp @@ -1285,7 +1285,7 @@ void Window::_bind_methods() { ClassDB::bind_method(D_METHOD("set_exclusive", "exclusive"), &Window::set_exclusive); ClassDB::bind_method(D_METHOD("is_exclusive"), &Window::is_exclusive); - ClassDB::bind_method(D_METHOD("can_draw"), &Window::is_transient); + ClassDB::bind_method(D_METHOD("can_draw"), &Window::can_draw); ClassDB::bind_method(D_METHOD("has_focus"), &Window::has_focus); ClassDB::bind_method(D_METHOD("grab_focus"), &Window::grab_focus); diff --git a/scene/main/window.h b/scene/main/window.h index be07762f20..adaa5ca3be 100644 --- a/scene/main/window.h +++ b/scene/main/window.h @@ -43,7 +43,7 @@ public: MODE_WINDOWED = DisplayServer::WINDOW_MODE_WINDOWED, MODE_MINIMIZED = DisplayServer::WINDOW_MODE_MINIMIZED, MODE_MAXIMIZED = DisplayServer::WINDOW_MODE_MAXIMIZED, - MODE_FULLSCREEN = DisplayServer::WINDOW_MODE_FULLSCREEN + MODE_FULLSCREEN = DisplayServer::WINDOW_MODE_FULLSCREEN, }; enum Flags { @@ -59,7 +59,6 @@ public: CONTENT_SCALE_MODE_DISABLED, CONTENT_SCALE_MODE_OBJECTS, CONTENT_SCALE_MODE_PIXELS, - }; enum ContentScaleAspect { @@ -68,10 +67,10 @@ public: CONTENT_SCALE_ASPECT_KEEP_WIDTH, CONTENT_SCALE_ASPECT_KEEP_HEIGHT, CONTENT_SCALE_ASPECT_EXPAND, - }; + enum { - DEFAULT_WINDOW_SIZE = 100 + DEFAULT_WINDOW_SIZE = 100, }; private: @@ -258,8 +257,8 @@ public: ~Window(); }; -VARIANT_ENUM_CAST(Window::Window::Mode); -VARIANT_ENUM_CAST(Window::Window::Flags); +VARIANT_ENUM_CAST(Window::Mode); +VARIANT_ENUM_CAST(Window::Flags); VARIANT_ENUM_CAST(Window::ContentScaleMode); VARIANT_ENUM_CAST(Window::ContentScaleAspect); diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index 774d943efe..22c000fae7 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -270,6 +270,7 @@ void register_scene_types() { ClassDB::register_virtual_class<InstancePlaceholder>(); ClassDB::register_virtual_class<Viewport>(); + ClassDB::register_class<SubViewport>(); ClassDB::register_class<ViewportTexture>(); ClassDB::register_class<HTTPRequest>(); ClassDB::register_class<Timer>(); @@ -754,6 +755,8 @@ void register_scene_types() { ClassDB::add_compatibility_class("Area", "Area3D"); ClassDB::add_compatibility_class("BoneAttachment", "BoneAttachment3D"); ClassDB::add_compatibility_class("BoxShape", "BoxShape3D"); + ClassDB::add_compatibility_class("BulletPhysicsDirectBodyState", "BulletPhysicsDirectBodyState3D"); + ClassDB::add_compatibility_class("BulletPhysicsServer", "BulletPhysicsServer3D"); ClassDB::add_compatibility_class("Camera", "Camera3D"); ClassDB::add_compatibility_class("CapsuleShape", "CapsuleShape3D"); ClassDB::add_compatibility_class("ClippedCamera", "ClippedCamera3D"); @@ -764,8 +767,19 @@ void register_scene_types() { ClassDB::add_compatibility_class("ConeTwistJoint", "ConeTwistJoint3D"); ClassDB::add_compatibility_class("ConvexPolygonShape", "ConvexPolygonShape3D"); ClassDB::add_compatibility_class("CPUParticles", "CPUParticles3D"); + ClassDB::add_compatibility_class("CSGBox", "CSGBox3D"); + ClassDB::add_compatibility_class("CSGCombiner", "CSGCombiner3D"); + ClassDB::add_compatibility_class("CSGCylinder", "CSGCylinder3D"); + ClassDB::add_compatibility_class("CSGMesh", "CSGMesh3D"); + ClassDB::add_compatibility_class("CSGPolygon", "CSGPolygon3D"); + ClassDB::add_compatibility_class("CSGPrimitive", "CSGPrimitive3D"); + ClassDB::add_compatibility_class("CSGShape", "CSGShape3D"); + ClassDB::add_compatibility_class("CSGSphere", "CSGSphere3D"); + ClassDB::add_compatibility_class("CSGTorus", "CSGTorus3D"); ClassDB::add_compatibility_class("CylinderShape", "CylinderShape3D"); ClassDB::add_compatibility_class("DirectionalLight", "DirectionalLight3D"); + ClassDB::add_compatibility_class("EditorSpatialGizmo", "EditorNode3DGizmo"); + ClassDB::add_compatibility_class("EditorSpatialGizmoPlugin", "EditorNode3DGizmoPlugin"); ClassDB::add_compatibility_class("Generic6DOFJoint", "Generic6DOFJoint3D"); ClassDB::add_compatibility_class("HeightMapShape", "HeightMapShape3D"); ClassDB::add_compatibility_class("HingeJoint", "HingeJoint3D"); @@ -783,6 +797,8 @@ void register_scene_types() { ClassDB::add_compatibility_class("NavigationObstacle", "NavigationObstacle3D"); ClassDB::add_compatibility_class("NavigationPolygonInstance", "NavigationRegion2D"); ClassDB::add_compatibility_class("NavigationRegion", "NavigationRegion3D"); + ClassDB::add_compatibility_class("Navigation2DServer", "NavigationServer2D"); + ClassDB::add_compatibility_class("NavigationServer", "NavigationServer3D"); ClassDB::add_compatibility_class("OmniLight", "OmniLight3D"); ClassDB::add_compatibility_class("Particles", "GPUParticles3D"); ClassDB::add_compatibility_class("Particles2D", "GPUParticles2D"); @@ -816,6 +832,7 @@ void register_scene_types() { ClassDB::add_compatibility_class("SliderJoint", "SliderJoint3D"); ClassDB::add_compatibility_class("SoftBody", "SoftBody3D"); ClassDB::add_compatibility_class("Spatial", "Node3D"); + ClassDB::add_compatibility_class("SpatialGizmo", "Node3DGizmo"); ClassDB::add_compatibility_class("SpatialMaterial", "StandardMaterial3D"); ClassDB::add_compatibility_class("SpatialVelocityTracker", "VelocityTracker3D"); ClassDB::add_compatibility_class("SphereShape", "SphereShape3D"); diff --git a/scene/resources/SCsub b/scene/resources/SCsub index 5e5b6f8fd5..3a86b22835 100644 --- a/scene/resources/SCsub +++ b/scene/resources/SCsub @@ -1,6 +1,6 @@ #!/usr/bin/env python -Import('env') +Import("env") env.add_source_files(env.scene_sources, "*.cpp") diff --git a/scene/resources/default_theme/SCsub b/scene/resources/default_theme/SCsub index b01e2fd54d..fc61250247 100644 --- a/scene/resources/default_theme/SCsub +++ b/scene/resources/default_theme/SCsub @@ -1,5 +1,5 @@ #!/usr/bin/env python -Import('env') +Import("env") env.add_source_files(env.scene_sources, "*.cpp") diff --git a/scene/resources/default_theme/make_header.py b/scene/resources/default_theme/make_header.py index cf0ccf1c3a..efad3b2815 100755 --- a/scene/resources/default_theme/make_header.py +++ b/scene/resources/default_theme/make_header.py @@ -13,7 +13,7 @@ os.chdir(os.path.dirname(os.path.realpath(__file__))) f = open("theme_data.h", "wb") -f.write(b"// THIS FILE HAS BEEN AUTOGENERATED, DON\'T EDIT!!\n") +f.write(b"// THIS FILE HAS BEEN AUTOGENERATED, DON'T EDIT!!\n") # Generate png image block f.write(b"\n// png image block\n") @@ -31,17 +31,17 @@ for x in pixmaps: pngf = open(x, "rb") b = pngf.read(1) - while(len(b) == 1): + while len(b) == 1: f.write(hex(ord(b)).encode(enc)) b = pngf.read(1) - if (len(b) == 1): + if len(b) == 1: f.write(b", ") f.write(b"\n};\n") pngf.close() # Generate shaders block -f.write(b"\n// shaders block\n"); +f.write(b"\n// shaders block\n") shaders = glob.glob("*.gsl") shaders.sort() @@ -56,15 +56,15 @@ for x in shaders: sf = open(x, "rb") b = sf.readline() - while(b != ""): - if (b.endswith("\r\n")): + while b != "": + if b.endswith("\r\n"): b = b[:-2] - if (b.endswith("\n")): + if b.endswith("\n"): b = b[:-1] - s = ' \"' + b + s = ' "' + b f.write(s.encode(enc)) b = sf.readline() - if (b != ""): + if b != "": f.write(b'"\n') f.write(b'";\n') diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp index 89937238c1..6fa52e6f05 100644 --- a/scene/resources/environment.cpp +++ b/scene/resources/environment.cpp @@ -546,7 +546,7 @@ float Environment::get_ssao_edge_sharpness() const { void Environment::set_glow_enabled(bool p_enabled) { glow_enabled = p_enabled; - RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap, glow_bicubic_upscale); + RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap); _change_notify(); } @@ -564,7 +564,7 @@ void Environment::set_glow_level(int p_level, bool p_enabled) { else glow_levels &= ~(1 << p_level); - RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap, glow_bicubic_upscale); + RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap); } bool Environment::is_glow_level_enabled(int p_level) const { @@ -577,7 +577,7 @@ void Environment::set_glow_intensity(float p_intensity) { glow_intensity = p_intensity; - RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap, glow_bicubic_upscale); + RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap); } float Environment::get_glow_intensity() const { @@ -587,7 +587,7 @@ float Environment::get_glow_intensity() const { void Environment::set_glow_strength(float p_strength) { glow_strength = p_strength; - RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap, glow_bicubic_upscale); + RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap); } float Environment::get_glow_strength() const { @@ -597,7 +597,7 @@ float Environment::get_glow_strength() const { void Environment::set_glow_mix(float p_mix) { glow_mix = p_mix; - RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap, glow_bicubic_upscale); + RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap); } float Environment::get_glow_mix() const { @@ -608,7 +608,7 @@ void Environment::set_glow_bloom(float p_threshold) { glow_bloom = p_threshold; - RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap, glow_bicubic_upscale); + RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap); } float Environment::get_glow_bloom() const { @@ -619,7 +619,7 @@ void Environment::set_glow_blend_mode(GlowBlendMode p_mode) { glow_blend_mode = p_mode; - RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap, glow_bicubic_upscale); + RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap); _change_notify(); } Environment::GlowBlendMode Environment::get_glow_blend_mode() const { @@ -631,7 +631,7 @@ void Environment::set_glow_hdr_bleed_threshold(float p_threshold) { glow_hdr_bleed_threshold = p_threshold; - RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap, glow_bicubic_upscale); + RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap); } float Environment::get_glow_hdr_bleed_threshold() const { @@ -642,7 +642,7 @@ void Environment::set_glow_hdr_luminance_cap(float p_amount) { glow_hdr_luminance_cap = p_amount; - RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap, glow_bicubic_upscale); + RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap); } float Environment::get_glow_hdr_luminance_cap() const { @@ -653,24 +653,13 @@ void Environment::set_glow_hdr_bleed_scale(float p_scale) { glow_hdr_bleed_scale = p_scale; - RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap, glow_bicubic_upscale); + RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap); } float Environment::get_glow_hdr_bleed_scale() const { return glow_hdr_bleed_scale; } -void Environment::set_glow_bicubic_upscale(bool p_enable) { - - glow_bicubic_upscale = p_enable; - RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap, glow_bicubic_upscale); -} - -bool Environment::is_glow_bicubic_upscale_enabled() const { - - return glow_bicubic_upscale; -} - void Environment::set_fog_enabled(bool p_enabled) { fog_enabled = p_enabled; @@ -1067,9 +1056,6 @@ void Environment::_bind_methods() { ClassDB::bind_method(D_METHOD("set_glow_hdr_bleed_scale", "scale"), &Environment::set_glow_hdr_bleed_scale); ClassDB::bind_method(D_METHOD("get_glow_hdr_bleed_scale"), &Environment::get_glow_hdr_bleed_scale); - ClassDB::bind_method(D_METHOD("set_glow_bicubic_upscale", "enabled"), &Environment::set_glow_bicubic_upscale); - ClassDB::bind_method(D_METHOD("is_glow_bicubic_upscale_enabled"), &Environment::is_glow_bicubic_upscale_enabled); - ADD_GROUP("Glow", "glow_"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "glow_enabled"), "set_glow_enabled", "is_glow_enabled"); ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "glow_levels/1"), "set_glow_level", "is_glow_level_enabled", 0); @@ -1088,7 +1074,6 @@ void Environment::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "glow_hdr_threshold", PROPERTY_HINT_RANGE, "0.0,4.0,0.01"), "set_glow_hdr_bleed_threshold", "get_glow_hdr_bleed_threshold"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "glow_hdr_luminance_cap", PROPERTY_HINT_RANGE, "0.0,256.0,0.01"), "set_glow_hdr_luminance_cap", "get_glow_hdr_luminance_cap"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "glow_hdr_scale", PROPERTY_HINT_RANGE, "0.0,4.0,0.01"), "set_glow_hdr_bleed_scale", "get_glow_hdr_bleed_scale"); - ADD_PROPERTY(PropertyInfo(Variant::BOOL, "glow_bicubic_upscale"), "set_glow_bicubic_upscale", "is_glow_bicubic_upscale_enabled"); ClassDB::bind_method(D_METHOD("set_adjustment_enable", "enabled"), &Environment::set_adjustment_enable); ClassDB::bind_method(D_METHOD("is_adjustment_enabled"), &Environment::is_adjustment_enabled); @@ -1209,7 +1194,6 @@ Environment::Environment() : glow_hdr_bleed_threshold = 1.0; glow_hdr_luminance_cap = 12.0; glow_hdr_bleed_scale = 2.0; - glow_bicubic_upscale = false; fog_enabled = false; fog_color = Color(0.5, 0.5, 0.5); diff --git a/scene/resources/environment.h b/scene/resources/environment.h index 657c7190e5..83f9a3f509 100644 --- a/scene/resources/environment.h +++ b/scene/resources/environment.h @@ -146,7 +146,6 @@ private: float glow_hdr_bleed_threshold; float glow_hdr_bleed_scale; float glow_hdr_luminance_cap; - bool glow_bicubic_upscale; bool fog_enabled; Color fog_color; @@ -318,9 +317,6 @@ public: void set_glow_hdr_bleed_scale(float p_scale); float get_glow_hdr_bleed_scale() const; - void set_glow_bicubic_upscale(bool p_enable); - bool is_glow_bicubic_upscale_enabled() const; - void set_fog_enabled(bool p_enabled); bool is_fog_enabled() const; diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp index c47e80c807..f9fcda3ac0 100644 --- a/scene/resources/visual_shader.cpp +++ b/scene/resources/visual_shader.cpp @@ -1478,7 +1478,7 @@ void VisualShader::_bind_methods() { ClassDB::bind_method(D_METHOD("remove_node", "type", "id"), &VisualShader::remove_node); ClassDB::bind_method(D_METHOD("is_node_connection", "type", "from_node", "from_port", "to_node", "to_port"), &VisualShader::is_node_connection); - ClassDB::bind_method(D_METHOD("can_connect_nodes", "type", "from_node", "from_port", "to_node", "to_port"), &VisualShader::is_node_connection); + ClassDB::bind_method(D_METHOD("can_connect_nodes", "type", "from_node", "from_port", "to_node", "to_port"), &VisualShader::can_connect_nodes); ClassDB::bind_method(D_METHOD("connect_nodes", "type", "from_node", "from_port", "to_node", "to_port"), &VisualShader::connect_nodes); ClassDB::bind_method(D_METHOD("disconnect_nodes", "type", "from_node", "from_port", "to_node", "to_port"), &VisualShader::disconnect_nodes); diff --git a/scene/resources/world_3d.cpp b/scene/resources/world_3d.cpp index 8e45b22cbf..a33f850755 100644 --- a/scene/resources/world_3d.cpp +++ b/scene/resources/world_3d.cpp @@ -348,7 +348,7 @@ void World3D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "camera_effects", PROPERTY_HINT_RESOURCE_TYPE, "CameraEffects"), "set_camera_effects", "get_camera_effects"); ADD_PROPERTY(PropertyInfo(Variant::_RID, "space", PROPERTY_HINT_NONE, "", 0), "", "get_space"); ADD_PROPERTY(PropertyInfo(Variant::_RID, "scenario", PROPERTY_HINT_NONE, "", 0), "", "get_scenario"); - ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "direct_space_state", PROPERTY_HINT_RESOURCE_TYPE, "PhysicsDirectSpaceState", 0), "", "get_direct_space_state"); + ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "direct_space_state", PROPERTY_HINT_RESOURCE_TYPE, "PhysicsDirectSpaceState3D", 0), "", "get_direct_space_state"); } World3D::World3D() { diff --git a/servers/SCsub b/servers/SCsub index 7706b99d87..7080a110da 100644 --- a/servers/SCsub +++ b/servers/SCsub @@ -1,16 +1,16 @@ #!/usr/bin/env python -Import('env') +Import("env") env.servers_sources = [] env.add_source_files(env.servers_sources, "*.cpp") -SConscript('arvr/SCsub') -SConscript('camera/SCsub') -SConscript('physics_3d/SCsub') -SConscript('physics_2d/SCsub') -SConscript('rendering/SCsub') -SConscript('audio/SCsub') +SConscript("arvr/SCsub") +SConscript("camera/SCsub") +SConscript("physics_3d/SCsub") +SConscript("physics_2d/SCsub") +SConscript("rendering/SCsub") +SConscript("audio/SCsub") lib = env.add_library("servers", env.servers_sources) diff --git a/servers/arvr/SCsub b/servers/arvr/SCsub index d730144861..86681f9c74 100644 --- a/servers/arvr/SCsub +++ b/servers/arvr/SCsub @@ -1,5 +1,5 @@ #!/usr/bin/env python -Import('env') +Import("env") env.add_source_files(env.servers_sources, "*.cpp") diff --git a/servers/audio/SCsub b/servers/audio/SCsub index 3c18c18043..5021e578c3 100644 --- a/servers/audio/SCsub +++ b/servers/audio/SCsub @@ -1,6 +1,6 @@ #!/usr/bin/env python -Import('env') +Import("env") env.add_source_files(env.servers_sources, "*.cpp") diff --git a/servers/audio/effects/SCsub b/servers/audio/effects/SCsub index d730144861..86681f9c74 100644 --- a/servers/audio/effects/SCsub +++ b/servers/audio/effects/SCsub @@ -1,5 +1,5 @@ #!/usr/bin/env python -Import('env') +Import("env") env.add_source_files(env.servers_sources, "*.cpp") diff --git a/servers/camera/SCsub b/servers/camera/SCsub index ccc76e823f..c949f3bb25 100644 --- a/servers/camera/SCsub +++ b/servers/camera/SCsub @@ -1,7 +1,7 @@ #!/usr/bin/env python -Import('env') +Import("env") env.add_source_files(env.servers_sources, "*.cpp") -Export('env') +Export("env") diff --git a/servers/display_server.cpp b/servers/display_server.cpp index 9798c57707..da1a68a179 100644 --- a/servers/display_server.cpp +++ b/servers/display_server.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "display_server.h" + #include "core/input/input_filter.h" #include "scene/resources/texture.h" @@ -434,7 +435,7 @@ void DisplayServer::_bind_methods() { ClassDB::bind_method(D_METHOD("native_video_unpause"), &DisplayServer::native_video_unpause); ClassDB::bind_method(D_METHOD("dialog_show", "title", "description", "buttons", "callback"), &DisplayServer::dialog_show); - ClassDB::bind_method(D_METHOD("dialog_input_text", "title", "description", "existing_text", "callback"), &DisplayServer::dialog_show); + ClassDB::bind_method(D_METHOD("dialog_input_text", "title", "description", "existing_text", "callback"), &DisplayServer::dialog_input_text); ClassDB::bind_method(D_METHOD("get_latin_keyboard_variant"), &DisplayServer::get_latin_keyboard_variant); @@ -517,11 +518,6 @@ void DisplayServer::_bind_methods() { BIND_ENUM_CONSTANT(WINDOW_FLAG_TRANSPARENT); BIND_ENUM_CONSTANT(WINDOW_FLAG_NO_FOCUS); BIND_ENUM_CONSTANT(WINDOW_FLAG_MAX); - BIND_ENUM_CONSTANT(WINDOW_FLAG_RESIZE_DISABLED_BIT); - BIND_ENUM_CONSTANT(WINDOW_FLAG_BORDERLESS_BIT); - BIND_ENUM_CONSTANT(WINDOW_FLAG_ALWAYS_ON_TOP_BIT); - BIND_ENUM_CONSTANT(WINDOW_FLAG_TRANSPARENT_BIT); - BIND_ENUM_CONSTANT(WINDOW_FLAG_NO_FOCUS_BIT); BIND_ENUM_CONSTANT(LATIN_KEYBOARD_QWERTY); BIND_ENUM_CONSTANT(LATIN_KEYBOARD_QWERTZ); diff --git a/servers/display_server.h b/servers/display_server.h index c0e92891a3..1956bcafca 100644 --- a/servers/display_server.h +++ b/servers/display_server.h @@ -200,6 +200,10 @@ public: WINDOW_FLAG_TRANSPARENT, WINDOW_FLAG_NO_FOCUS, WINDOW_FLAG_MAX, + }; + + // Separate enum otherwise we get warnings in switches not handling all values. + enum WindowFlagsBit { WINDOW_FLAG_RESIZE_DISABLED_BIT = (1 << WINDOW_FLAG_RESIZE_DISABLED), WINDOW_FLAG_BORDERLESS_BIT = (1 << WINDOW_FLAG_BORDERLESS), WINDOW_FLAG_ALWAYS_ON_TOP_BIT = (1 << WINDOW_FLAG_ALWAYS_ON_TOP), diff --git a/servers/navigation_server_2d.h b/servers/navigation_server_2d.h index af914e5ba9..d7384bae74 100644 --- a/servers/navigation_server_2d.h +++ b/servers/navigation_server_2d.h @@ -39,7 +39,7 @@ #include "core/rid.h" #include "scene/2d/navigation_region_2d.h" -// This server exposes the 3D `NavigationServer` features in the 2D world. +// This server exposes the `NavigationServer3D` features in the 2D world. class NavigationServer2D : public Object { GDCLASS(NavigationServer2D, Object); diff --git a/servers/physics_2d/SCsub b/servers/physics_2d/SCsub index d730144861..86681f9c74 100644 --- a/servers/physics_2d/SCsub +++ b/servers/physics_2d/SCsub @@ -1,5 +1,5 @@ #!/usr/bin/env python -Import('env') +Import("env") env.add_source_files(env.servers_sources, "*.cpp") diff --git a/servers/physics_3d/SCsub b/servers/physics_3d/SCsub index c5cc889112..df7b521693 100644 --- a/servers/physics_3d/SCsub +++ b/servers/physics_3d/SCsub @@ -1,6 +1,6 @@ #!/usr/bin/env python -Import('env') +Import("env") env.add_source_files(env.servers_sources, "*.cpp") diff --git a/servers/physics_3d/joints/SCsub b/servers/physics_3d/joints/SCsub index d730144861..86681f9c74 100644 --- a/servers/physics_3d/joints/SCsub +++ b/servers/physics_3d/joints/SCsub @@ -1,5 +1,5 @@ #!/usr/bin/env python -Import('env') +Import("env") env.add_source_files(env.servers_sources, "*.cpp") diff --git a/servers/physics_3d/physics_server_3d_sw.cpp b/servers/physics_3d/physics_server_3d_sw.cpp index da84630088..11a3b7bbb8 100644 --- a/servers/physics_3d/physics_server_3d_sw.cpp +++ b/servers/physics_3d/physics_server_3d_sw.cpp @@ -70,7 +70,7 @@ RID PhysicsServer3DSW::shape_create(ShapeType p_shape) { } break; case SHAPE_CYLINDER: { - ERR_FAIL_V_MSG(RID(), "CylinderShape is not supported in GodotPhysics. Please switch to Bullet in the Project Settings."); + ERR_FAIL_V_MSG(RID(), "CylinderShape3D is not supported in GodotPhysics. Please switch to Bullet in the Project Settings."); } break; case SHAPE_CONVEX_POLYGON: { diff --git a/servers/register_server_types.cpp b/servers/register_server_types.cpp index c53ffcc7b5..f96752813d 100644 --- a/servers/register_server_types.cpp +++ b/servers/register_server_types.cpp @@ -194,10 +194,10 @@ void register_server_singletons() { Engine::get_singleton()->add_singleton(Engine::Singleton("RenderingServer", RenderingServer::get_singleton())); Engine::get_singleton()->add_singleton(Engine::Singleton("AudioServer", AudioServer::get_singleton())); - Engine::get_singleton()->add_singleton(Engine::Singleton("PhysicsServer3D", PhysicsServer3D::get_singleton())); Engine::get_singleton()->add_singleton(Engine::Singleton("PhysicsServer2D", PhysicsServer2D::get_singleton())); - Engine::get_singleton()->add_singleton(Engine::Singleton("NavigationServer", NavigationServer3D::get_singleton_mut())); + Engine::get_singleton()->add_singleton(Engine::Singleton("PhysicsServer3D", PhysicsServer3D::get_singleton())); Engine::get_singleton()->add_singleton(Engine::Singleton("NavigationServer2D", NavigationServer2D::get_singleton_mut())); + Engine::get_singleton()->add_singleton(Engine::Singleton("NavigationServer3D", NavigationServer3D::get_singleton_mut())); Engine::get_singleton()->add_singleton(Engine::Singleton("ARVRServer", ARVRServer::get_singleton())); Engine::get_singleton()->add_singleton(Engine::Singleton("CameraServer", CameraServer::get_singleton())); } diff --git a/servers/rendering/SCsub b/servers/rendering/SCsub index fca18bfea0..5ea0d40486 100644 --- a/servers/rendering/SCsub +++ b/servers/rendering/SCsub @@ -1,6 +1,6 @@ #!/usr/bin/env python -Import('env') +Import("env") env.add_source_files(env.servers_sources, "*.cpp") diff --git a/servers/rendering/rasterizer.h b/servers/rendering/rasterizer.h index f63d1077bb..eb33db04fc 100644 --- a/servers/rendering/rasterizer.h +++ b/servers/rendering/rasterizer.h @@ -75,7 +75,8 @@ public: virtual void environment_set_camera_feed_id(RID p_env, int p_camera_feed_id) = 0; #endif - virtual void environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_mix, float p_bloom_threshold, RS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, float p_hdr_luminance_cap, bool p_bicubic_upscale) = 0; + virtual void environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_mix, float p_bloom_threshold, RS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, float p_hdr_luminance_cap) = 0; + virtual void environment_glow_set_use_bicubic_upscale(bool p_enable) = 0; virtual void environment_set_fog(RID p_env, bool p_enable, float p_begin, float p_end, RID p_gradient_texture) = 0; virtual void environment_set_ssr(RID p_env, bool p_enable, int p_max_steps, float p_fade_int, float p_fade_out, float p_depth_tolerance, bool p_roughness) = 0; diff --git a/servers/rendering/rasterizer_rd/SCsub b/servers/rendering/rasterizer_rd/SCsub index cc17feeb05..6a2e682c67 100644 --- a/servers/rendering/rasterizer_rd/SCsub +++ b/servers/rendering/rasterizer_rd/SCsub @@ -1,6 +1,6 @@ #!/usr/bin/env python -Import('env') +Import("env") env.add_source_files(env.servers_sources, "*.cpp") diff --git a/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp b/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp index 842f7046c9..517eea12f4 100644 --- a/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp +++ b/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp @@ -1211,7 +1211,7 @@ void RasterizerSceneRD::environment_set_tonemap(RID p_env, RS::EnvironmentToneMa env->auto_exp_scale = p_auto_exp_scale; } -void RasterizerSceneRD::environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_mix, float p_bloom_threshold, RS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, float p_hdr_luminance_cap, bool p_bicubic_upscale) { +void RasterizerSceneRD::environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_mix, float p_bloom_threshold, RS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, float p_hdr_luminance_cap) { Environent *env = environment_owner.getornull(p_env); ERR_FAIL_COND(!env); @@ -1225,7 +1225,10 @@ void RasterizerSceneRD::environment_set_glow(RID p_env, bool p_enable, int p_lev env->glow_hdr_bleed_threshold = p_hdr_bleed_threshold; env->glow_hdr_bleed_scale = p_hdr_bleed_scale; env->glow_hdr_luminance_cap = p_hdr_luminance_cap; - env->glow_bicubic_upscale = p_bicubic_upscale; +} + +void RasterizerSceneRD::environment_glow_set_use_bicubic_upscale(bool p_enable) { + glow_bicubic_upscale = p_enable; } void RasterizerSceneRD::environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_bias, float p_light_affect, float p_ao_channel_affect, RS::EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness) { @@ -3339,7 +3342,7 @@ void RasterizerSceneRD::_render_buffers_post_process_and_tonemap(RID p_render_bu tonemap.glow_level_flags = glow_mask; tonemap.glow_texture_size.x = rb->blur[1].mipmaps[0].width; tonemap.glow_texture_size.y = rb->blur[1].mipmaps[0].height; - tonemap.glow_use_bicubic_upscale = env->glow_bicubic_upscale; + tonemap.glow_use_bicubic_upscale = glow_bicubic_upscale; tonemap.glow_texture = rb->blur[1].texture; } else { tonemap.glow_texture = storage->texture_rd_get_default(RasterizerStorageRD::DEFAULT_RD_TEXTURE_BLACK); @@ -4008,6 +4011,7 @@ RasterizerSceneRD::RasterizerSceneRD(RasterizerStorageRD *p_storage) { environment_set_ssao_quality(RS::EnvironmentSSAOQuality(int(GLOBAL_GET("rendering/quality/ssao/quality"))), GLOBAL_GET("rendering/quality/ssao/half_size")); screen_space_roughness_limiter = GLOBAL_GET("rendering/quality/filters/screen_space_roughness_limiter"); screen_space_roughness_limiter_curve = GLOBAL_GET("rendering/quality/filters/screen_space_roughness_limiter_curve"); + glow_bicubic_upscale = int(GLOBAL_GET("rendering/quality/glow/upscale_mode")) > 0; } RasterizerSceneRD::~RasterizerSceneRD() { diff --git a/servers/rendering/rasterizer_rd/rasterizer_scene_rd.h b/servers/rendering/rasterizer_rd/rasterizer_scene_rd.h index 2b30855915..dbdaf2f447 100644 --- a/servers/rendering/rasterizer_rd/rasterizer_scene_rd.h +++ b/servers/rendering/rasterizer_rd/rasterizer_scene_rd.h @@ -646,7 +646,6 @@ private: float glow_hdr_bleed_threshold = 1.0; float glow_hdr_luminance_cap = 12.0; float glow_hdr_bleed_scale = 2.0; - bool glow_bicubic_upscale = false; /// SSAO @@ -662,6 +661,7 @@ private: RS::EnvironmentSSAOQuality ssao_quality = RS::ENV_SSAO_QUALITY_MEDIUM; bool ssao_half_size = false; + bool glow_bicubic_upscale = false; static uint64_t auto_exposure_counter; @@ -827,7 +827,8 @@ public: bool is_environment(RID p_env) const; - void environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_mix, float p_bloom_threshold, RS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, float p_hdr_luminance_cap, bool p_bicubic_upscale); + void environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_mix, float p_bloom_threshold, RS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, float p_hdr_luminance_cap); + void environment_glow_set_use_bicubic_upscale(bool p_enable); void environment_set_fog(RID p_env, bool p_enable, float p_begin, float p_end, RID p_gradient_texture) {} diff --git a/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp b/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp index 83af15602c..b6b6b5a040 100644 --- a/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp +++ b/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "rasterizer_storage_rd.h" + #include "core/engine.h" #include "core/project_settings.h" #include "servers/rendering/shader_language.h" @@ -1664,7 +1665,7 @@ void RasterizerStorageRD::MaterialData::update_textures(const Map<StringName, Va RasterizerStorageRD *singleton = (RasterizerStorageRD *)RasterizerStorage::base_singleton; #ifdef TOOLS_ENABLED Texture *roughness_detect_texture = nullptr; - RS::TextureDetectRoughnessChannel roughness_channel; + RS::TextureDetectRoughnessChannel roughness_channel = RS::TEXTURE_DETECT_ROUGNHESS_R; Texture *normal_detect_texture = nullptr; #endif diff --git a/servers/rendering/rasterizer_rd/shaders/SCsub b/servers/rendering/rasterizer_rd/shaders/SCsub index 2dcb2a703f..6e852e2dc5 100644 --- a/servers/rendering/rasterizer_rd/shaders/SCsub +++ b/servers/rendering/rasterizer_rd/shaders/SCsub @@ -1,24 +1,24 @@ #!/usr/bin/env python -Import('env') +Import("env") -if 'RD_GLSL' in env['BUILDERS']: - env.RD_GLSL('canvas.glsl'); - env.RD_GLSL('canvas_occlusion.glsl'); - env.RD_GLSL('blur.glsl'); - env.RD_GLSL('cubemap_roughness.glsl'); - env.RD_GLSL('cubemap_downsampler.glsl'); - env.RD_GLSL('cubemap_filter.glsl'); - env.RD_GLSL('scene_high_end.glsl'); - env.RD_GLSL('sky.glsl'); - env.RD_GLSL('tonemap.glsl'); - env.RD_GLSL('copy.glsl'); - env.RD_GLSL('giprobe.glsl'); - env.RD_GLSL('giprobe_debug.glsl'); - env.RD_GLSL('giprobe_sdf.glsl'); - env.RD_GLSL('luminance_reduce.glsl'); - env.RD_GLSL('bokeh_dof.glsl'); - env.RD_GLSL('ssao.glsl'); - env.RD_GLSL('ssao_minify.glsl'); - env.RD_GLSL('ssao_blur.glsl'); - env.RD_GLSL('roughness_limiter.glsl'); +if "RD_GLSL" in env["BUILDERS"]: + env.RD_GLSL("canvas.glsl") + env.RD_GLSL("canvas_occlusion.glsl") + env.RD_GLSL("blur.glsl") + env.RD_GLSL("cubemap_roughness.glsl") + env.RD_GLSL("cubemap_downsampler.glsl") + env.RD_GLSL("cubemap_filter.glsl") + env.RD_GLSL("scene_high_end.glsl") + env.RD_GLSL("sky.glsl") + env.RD_GLSL("tonemap.glsl") + env.RD_GLSL("copy.glsl") + env.RD_GLSL("giprobe.glsl") + env.RD_GLSL("giprobe_debug.glsl") + env.RD_GLSL("giprobe_sdf.glsl") + env.RD_GLSL("luminance_reduce.glsl") + env.RD_GLSL("bokeh_dof.glsl") + env.RD_GLSL("ssao.glsl") + env.RD_GLSL("ssao_minify.glsl") + env.RD_GLSL("ssao_blur.glsl") + env.RD_GLSL("roughness_limiter.glsl") diff --git a/servers/rendering/rendering_server_raster.h b/servers/rendering/rendering_server_raster.h index d69968868e..7c18bf91ce 100644 --- a/servers/rendering/rendering_server_raster.h +++ b/servers/rendering/rendering_server_raster.h @@ -527,7 +527,8 @@ public: BIND9(environment_set_ssao, RID, bool, float, float, float, float, float, EnvironmentSSAOBlur, float) BIND2(environment_set_ssao_quality, EnvironmentSSAOQuality, bool) - BIND12(environment_set_glow, RID, bool, int, float, float, float, float, EnvironmentGlowBlendMode, float, float, float, bool) + BIND11(environment_set_glow, RID, bool, int, float, float, float, float, EnvironmentGlowBlendMode, float, float, float) + BIND1(environment_glow_set_use_bicubic_upscale, bool) BIND9(environment_set_tonemap, RID, EnvironmentToneMapper, float, float, bool, float, float, float, float) diff --git a/servers/rendering/rendering_server_wrap_mt.h b/servers/rendering/rendering_server_wrap_mt.h index ee4065094b..bcd1344f44 100644 --- a/servers/rendering/rendering_server_wrap_mt.h +++ b/servers/rendering/rendering_server_wrap_mt.h @@ -442,7 +442,8 @@ public: FUNC2(environment_set_ssao_quality, EnvironmentSSAOQuality, bool) - FUNC12(environment_set_glow, RID, bool, int, float, float, float, float, EnvironmentGlowBlendMode, float, float, float, bool) + FUNC11(environment_set_glow, RID, bool, int, float, float, float, float, EnvironmentGlowBlendMode, float, float, float) + FUNC1(environment_glow_set_use_bicubic_upscale, bool) FUNC9(environment_set_tonemap, RID, EnvironmentToneMapper, float, float, bool, float, float, float, float) diff --git a/servers/rendering_server.cpp b/servers/rendering_server.cpp index 084b8f7952..0bad644b95 100644 --- a/servers/rendering_server.cpp +++ b/servers/rendering_server.cpp @@ -1802,7 +1802,7 @@ void RenderingServer::_bind_methods() { ClassDB::bind_method(D_METHOD("environment_set_bg_energy", "env", "energy"), &RenderingServer::environment_set_bg_energy); ClassDB::bind_method(D_METHOD("environment_set_canvas_max_layer", "env", "max_layer"), &RenderingServer::environment_set_canvas_max_layer); ClassDB::bind_method(D_METHOD("environment_set_ambient_light", "env", "color", "ambient", "energy", "sky_contibution", "reflection_source", "ao_color"), &RenderingServer::environment_set_ambient_light, DEFVAL(RS::ENV_AMBIENT_SOURCE_BG), DEFVAL(1.0), DEFVAL(0.0), DEFVAL(RS::ENV_REFLECTION_SOURCE_BG), DEFVAL(Color())); - ClassDB::bind_method(D_METHOD("environment_set_glow", "env", "enable", "level_flags", "intensity", "strength", "mix", "bloom_threshold", "blend_mode", "hdr_bleed_threshold", "hdr_bleed_scale", "hdr_luminance_cap", "bicubic_upscale"), &RenderingServer::environment_set_glow); + ClassDB::bind_method(D_METHOD("environment_set_glow", "env", "enable", "level_flags", "intensity", "strength", "mix", "bloom_threshold", "blend_mode", "hdr_bleed_threshold", "hdr_bleed_scale", "hdr_luminance_cap"), &RenderingServer::environment_set_glow); ClassDB::bind_method(D_METHOD("environment_set_tonemap", "env", "tone_mapper", "exposure", "white", "auto_exposure", "min_luminance", "max_luminance", "auto_exp_speed", "auto_exp_grey"), &RenderingServer::environment_set_tonemap); ClassDB::bind_method(D_METHOD("environment_set_adjustment", "env", "enable", "brightness", "contrast", "saturation", "ramp"), &RenderingServer::environment_set_adjustment); ClassDB::bind_method(D_METHOD("environment_set_ssr", "env", "enable", "max_steps", "fade_in", "fade_out", "depth_tolerance", "roughness"), &RenderingServer::environment_set_ssr); @@ -2355,6 +2355,10 @@ RenderingServer::RenderingServer() { ProjectSettings::get_singleton()->set_custom_property_info("rendering/quality/filters/screen_space_roughness_limiter", PropertyInfo(Variant::INT, "rendering/quality/filters/screen_space_roughness_limiter", PROPERTY_HINT_ENUM, "Disabled,Enabled (Small Cost)")); GLOBAL_DEF("rendering/quality/filters/screen_space_roughness_limiter_curve", 1.0); ProjectSettings::get_singleton()->set_custom_property_info("rendering/quality/filters/screen_space_roughness_limiter_curve", PropertyInfo(Variant::FLOAT, "rendering/quality/filters/screen_space_roughness_limiter_curve", PROPERTY_HINT_EXP_EASING, "0.01,8,0.01")); + + GLOBAL_DEF("rendering/quality/glow/upscale_mode", 1); + ProjectSettings::get_singleton()->set_custom_property_info("rendering/quality/glow/upscale_mode", PropertyInfo(Variant::INT, "rendering/quality/glow/upscale_mode", PROPERTY_HINT_ENUM, "Linear (Fast),Bicubic (Slower)")); + GLOBAL_DEF("rendering/quality/glow/upscale_mode.mobile", 0); } RenderingServer::~RenderingServer() { diff --git a/servers/rendering_server.h b/servers/rendering_server.h index 76f16bd7f6..702a66405a 100644 --- a/servers/rendering_server.h +++ b/servers/rendering_server.h @@ -733,7 +733,9 @@ public: ENV_GLOW_BLEND_MODE_REPLACE, ENV_GLOW_BLEND_MODE_MIX, }; - virtual void environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_mix, float p_bloom_threshold, EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, float p_hdr_luminance_cap, bool p_bicubic_upscale) = 0; + virtual void environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_mix, float p_bloom_threshold, EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, float p_hdr_luminance_cap) = 0; + + virtual void environment_glow_set_use_bicubic_upscale(bool p_enable) = 0; enum EnvironmentToneMapper { ENV_TONE_MAPPER_LINEAR, diff --git a/thirdparty/README.md b/thirdparty/README.md index 3d41c9d166..95a6902089 100644 --- a/thirdparty/README.md +++ b/thirdparty/README.md @@ -574,6 +574,8 @@ Files extracted from upstream source: `vk_enum_string_helper.h` is taken from the matching `Vulkan-ValidationLayers` SDK release: https://github.com/KhronosGroup/Vulkan-ValidationLayers/blob/master/layers/generated/vk_enum_string_helper.h +Includes custom change to disable MSVC pragma, might be upstreamed via: +https://github.com/KhronosGroup/Vulkan-ValidationLayers/pull/1666 `vk_mem_alloc.h` is taken from https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator Version: 2.3.0 diff --git a/thirdparty/etc2comp/EtcBlock4x4Encoding_RGB8.cpp b/thirdparty/etc2comp/EtcBlock4x4Encoding_RGB8.cpp index 5656556db9..5c7ebed788 100644 --- a/thirdparty/etc2comp/EtcBlock4x4Encoding_RGB8.cpp +++ b/thirdparty/etc2comp/EtcBlock4x4Encoding_RGB8.cpp @@ -508,7 +508,7 @@ namespace Etc int iMaxRed1 = iColor1Red + (int)a_uiRadius; if (iMaxRed1 > 15) { - iMinRed1 = 15; + iMaxRed1 = 15; } int iMinGreen1 = iColor1Green - (int)a_uiRadius; @@ -519,7 +519,7 @@ namespace Etc int iMaxGreen1 = iColor1Green + (int)a_uiRadius; if (iMaxGreen1 > 15) { - iMinGreen1 = 15; + iMaxGreen1 = 15; } int iMinBlue1 = iColor1Blue - (int)a_uiRadius; @@ -530,7 +530,7 @@ namespace Etc int iMaxBlue1 = iColor1Blue + (int)a_uiRadius; if (iMaxBlue1 > 15) { - iMinBlue1 = 15; + iMaxBlue1 = 15; } int iColor2Red = m_frgbaOriginalColor2_TAndH.IntRed(15.0f); @@ -545,7 +545,7 @@ namespace Etc int iMaxRed2 = iColor2Red + (int)a_uiRadius; if (iMaxRed2 > 15) { - iMinRed2 = 15; + iMaxRed2 = 15; } int iMinGreen2 = iColor2Green - (int)a_uiRadius; @@ -556,7 +556,7 @@ namespace Etc int iMaxGreen2 = iColor2Green + (int)a_uiRadius; if (iMaxGreen2 > 15) { - iMinGreen2 = 15; + iMaxGreen2 = 15; } int iMinBlue2 = iColor2Blue - (int)a_uiRadius; @@ -567,7 +567,7 @@ namespace Etc int iMaxBlue2 = iColor2Blue + (int)a_uiRadius; if (iMaxBlue2 > 15) { - iMinBlue2 = 15; + iMaxBlue2 = 15; } for (unsigned int uiDistance = 0; uiDistance < TH_DISTANCES; uiDistance++) @@ -761,7 +761,7 @@ namespace Etc int iMaxRed1 = iColor1Red + (int)a_uiRadius; if (iMaxRed1 > 15) { - iMinRed1 = 15; + iMaxRed1 = 15; } int iMinGreen1 = iColor1Green - (int)a_uiRadius; @@ -772,7 +772,7 @@ namespace Etc int iMaxGreen1 = iColor1Green + (int)a_uiRadius; if (iMaxGreen1 > 15) { - iMinGreen1 = 15; + iMaxGreen1 = 15; } int iMinBlue1 = iColor1Blue - (int)a_uiRadius; @@ -783,7 +783,7 @@ namespace Etc int iMaxBlue1 = iColor1Blue + (int)a_uiRadius; if (iMaxBlue1 > 15) { - iMinBlue1 = 15; + iMaxBlue1 = 15; } int iColor2Red = m_frgbaOriginalColor2_TAndH.IntRed(15.0f); @@ -798,7 +798,7 @@ namespace Etc int iMaxRed2 = iColor2Red + (int)a_uiRadius; if (iMaxRed2 > 15) { - iMinRed2 = 15; + iMaxRed2 = 15; } int iMinGreen2 = iColor2Green - (int)a_uiRadius; @@ -809,7 +809,7 @@ namespace Etc int iMaxGreen2 = iColor2Green + (int)a_uiRadius; if (iMaxGreen2 > 15) { - iMinGreen2 = 15; + iMaxGreen2 = 15; } int iMinBlue2 = iColor2Blue - (int)a_uiRadius; @@ -820,7 +820,7 @@ namespace Etc int iMaxBlue2 = iColor2Blue + (int)a_uiRadius; if (iMaxBlue2 > 15) { - iMinBlue2 = 15; + iMaxBlue2 = 15; } for (unsigned int uiDistance = 0; uiDistance < TH_DISTANCES; uiDistance++) diff --git a/thirdparty/etc2comp/EtcBlock4x4Encoding_RGB8A1.cpp b/thirdparty/etc2comp/EtcBlock4x4Encoding_RGB8A1.cpp index ba2b42fb05..b94b64e68c 100644 --- a/thirdparty/etc2comp/EtcBlock4x4Encoding_RGB8A1.cpp +++ b/thirdparty/etc2comp/EtcBlock4x4Encoding_RGB8A1.cpp @@ -847,7 +847,7 @@ namespace Etc int iMaxRed1 = iColor1Red + (int)a_uiRadius; if (iMaxRed1 > 15) { - iMinRed1 = 15; + iMaxRed1 = 15; } int iMinGreen1 = iColor1Green - (int)a_uiRadius; @@ -858,7 +858,7 @@ namespace Etc int iMaxGreen1 = iColor1Green + (int)a_uiRadius; if (iMaxGreen1 > 15) { - iMinGreen1 = 15; + iMaxGreen1 = 15; } int iMinBlue1 = iColor1Blue - (int)a_uiRadius; @@ -869,7 +869,7 @@ namespace Etc int iMaxBlue1 = iColor1Blue + (int)a_uiRadius; if (iMaxBlue1 > 15) { - iMinBlue1 = 15; + iMaxBlue1 = 15; } int iColor2Red = m_frgbaOriginalColor2_TAndH.IntRed(15.0f); @@ -884,7 +884,7 @@ namespace Etc int iMaxRed2 = iColor2Red + (int)a_uiRadius; if (iMaxRed2 > 15) { - iMinRed2 = 15; + iMaxRed2 = 15; } int iMinGreen2 = iColor2Green - (int)a_uiRadius; @@ -895,7 +895,7 @@ namespace Etc int iMaxGreen2 = iColor2Green + (int)a_uiRadius; if (iMaxGreen2 > 15) { - iMinGreen2 = 15; + iMaxGreen2 = 15; } int iMinBlue2 = iColor2Blue - (int)a_uiRadius; @@ -906,7 +906,7 @@ namespace Etc int iMaxBlue2 = iColor2Blue + (int)a_uiRadius; if (iMaxBlue2 > 15) { - iMinBlue2 = 15; + iMaxBlue2 = 15; } for (unsigned int uiDistance = 0; uiDistance < TH_DISTANCES; uiDistance++) @@ -1108,7 +1108,7 @@ namespace Etc int iMaxRed1 = iColor1Red + (int)a_uiRadius; if (iMaxRed1 > 15) { - iMinRed1 = 15; + iMaxRed1 = 15; } int iMinGreen1 = iColor1Green - (int)a_uiRadius; @@ -1119,7 +1119,7 @@ namespace Etc int iMaxGreen1 = iColor1Green + (int)a_uiRadius; if (iMaxGreen1 > 15) { - iMinGreen1 = 15; + iMaxGreen1 = 15; } int iMinBlue1 = iColor1Blue - (int)a_uiRadius; @@ -1130,7 +1130,7 @@ namespace Etc int iMaxBlue1 = iColor1Blue + (int)a_uiRadius; if (iMaxBlue1 > 15) { - iMinBlue1 = 15; + iMaxBlue1 = 15; } int iColor2Red = m_frgbaOriginalColor2_TAndH.IntRed(15.0f); @@ -1145,7 +1145,7 @@ namespace Etc int iMaxRed2 = iColor2Red + (int)a_uiRadius; if (iMaxRed2 > 15) { - iMinRed2 = 15; + iMaxRed2 = 15; } int iMinGreen2 = iColor2Green - (int)a_uiRadius; @@ -1156,7 +1156,7 @@ namespace Etc int iMaxGreen2 = iColor2Green + (int)a_uiRadius; if (iMaxGreen2 > 15) { - iMinGreen2 = 15; + iMaxGreen2 = 15; } int iMinBlue2 = iColor2Blue - (int)a_uiRadius; @@ -1167,7 +1167,7 @@ namespace Etc int iMaxBlue2 = iColor2Blue + (int)a_uiRadius; if (iMaxBlue2 > 15) { - iMinBlue2 = 15; + iMaxBlue2 = 15; } for (unsigned int uiDistance = 0; uiDistance < TH_DISTANCES; uiDistance++) diff --git a/thirdparty/etc2comp/patches/fix-rgba8-max-channels.patch b/thirdparty/etc2comp/patches/fix-rgba8-max-channels.patch new file mode 100644 index 0000000000..ea9b5640b6 --- /dev/null +++ b/thirdparty/etc2comp/patches/fix-rgba8-max-channels.patch @@ -0,0 +1,224 @@ +diff --git a/thirdparty/etc2comp/EtcBlock4x4Encoding_RGB8.cpp b/thirdparty/etc2comp/EtcBlock4x4Encoding_RGB8.cpp +index 5656556db9..5c7ebed788 100644 +--- a/thirdparty/etc2comp/EtcBlock4x4Encoding_RGB8.cpp ++++ b/thirdparty/etc2comp/EtcBlock4x4Encoding_RGB8.cpp +@@ -508,7 +508,7 @@ namespace Etc + int iMaxRed1 = iColor1Red + (int)a_uiRadius; + if (iMaxRed1 > 15) + { +- iMinRed1 = 15; ++ iMaxRed1 = 15; + } + + int iMinGreen1 = iColor1Green - (int)a_uiRadius; +@@ -519,7 +519,7 @@ namespace Etc + int iMaxGreen1 = iColor1Green + (int)a_uiRadius; + if (iMaxGreen1 > 15) + { +- iMinGreen1 = 15; ++ iMaxGreen1 = 15; + } + + int iMinBlue1 = iColor1Blue - (int)a_uiRadius; +@@ -530,7 +530,7 @@ namespace Etc + int iMaxBlue1 = iColor1Blue + (int)a_uiRadius; + if (iMaxBlue1 > 15) + { +- iMinBlue1 = 15; ++ iMaxBlue1 = 15; + } + + int iColor2Red = m_frgbaOriginalColor2_TAndH.IntRed(15.0f); +@@ -545,7 +545,7 @@ namespace Etc + int iMaxRed2 = iColor2Red + (int)a_uiRadius; + if (iMaxRed2 > 15) + { +- iMinRed2 = 15; ++ iMaxRed2 = 15; + } + + int iMinGreen2 = iColor2Green - (int)a_uiRadius; +@@ -556,7 +556,7 @@ namespace Etc + int iMaxGreen2 = iColor2Green + (int)a_uiRadius; + if (iMaxGreen2 > 15) + { +- iMinGreen2 = 15; ++ iMaxGreen2 = 15; + } + + int iMinBlue2 = iColor2Blue - (int)a_uiRadius; +@@ -567,7 +567,7 @@ namespace Etc + int iMaxBlue2 = iColor2Blue + (int)a_uiRadius; + if (iMaxBlue2 > 15) + { +- iMinBlue2 = 15; ++ iMaxBlue2 = 15; + } + + for (unsigned int uiDistance = 0; uiDistance < TH_DISTANCES; uiDistance++) +@@ -761,7 +761,7 @@ namespace Etc + int iMaxRed1 = iColor1Red + (int)a_uiRadius; + if (iMaxRed1 > 15) + { +- iMinRed1 = 15; ++ iMaxRed1 = 15; + } + + int iMinGreen1 = iColor1Green - (int)a_uiRadius; +@@ -772,7 +772,7 @@ namespace Etc + int iMaxGreen1 = iColor1Green + (int)a_uiRadius; + if (iMaxGreen1 > 15) + { +- iMinGreen1 = 15; ++ iMaxGreen1 = 15; + } + + int iMinBlue1 = iColor1Blue - (int)a_uiRadius; +@@ -783,7 +783,7 @@ namespace Etc + int iMaxBlue1 = iColor1Blue + (int)a_uiRadius; + if (iMaxBlue1 > 15) + { +- iMinBlue1 = 15; ++ iMaxBlue1 = 15; + } + + int iColor2Red = m_frgbaOriginalColor2_TAndH.IntRed(15.0f); +@@ -798,7 +798,7 @@ namespace Etc + int iMaxRed2 = iColor2Red + (int)a_uiRadius; + if (iMaxRed2 > 15) + { +- iMinRed2 = 15; ++ iMaxRed2 = 15; + } + + int iMinGreen2 = iColor2Green - (int)a_uiRadius; +@@ -809,7 +809,7 @@ namespace Etc + int iMaxGreen2 = iColor2Green + (int)a_uiRadius; + if (iMaxGreen2 > 15) + { +- iMinGreen2 = 15; ++ iMaxGreen2 = 15; + } + + int iMinBlue2 = iColor2Blue - (int)a_uiRadius; +@@ -820,7 +820,7 @@ namespace Etc + int iMaxBlue2 = iColor2Blue + (int)a_uiRadius; + if (iMaxBlue2 > 15) + { +- iMinBlue2 = 15; ++ iMaxBlue2 = 15; + } + + for (unsigned int uiDistance = 0; uiDistance < TH_DISTANCES; uiDistance++) +diff --git a/thirdparty/etc2comp/EtcBlock4x4Encoding_RGB8A1.cpp b/thirdparty/etc2comp/EtcBlock4x4Encoding_RGB8A1.cpp +index ba2b42fb05..b94b64e68c 100644 +--- a/thirdparty/etc2comp/EtcBlock4x4Encoding_RGB8A1.cpp ++++ b/thirdparty/etc2comp/EtcBlock4x4Encoding_RGB8A1.cpp +@@ -847,7 +847,7 @@ namespace Etc + int iMaxRed1 = iColor1Red + (int)a_uiRadius; + if (iMaxRed1 > 15) + { +- iMinRed1 = 15; ++ iMaxRed1 = 15; + } + + int iMinGreen1 = iColor1Green - (int)a_uiRadius; +@@ -858,7 +858,7 @@ namespace Etc + int iMaxGreen1 = iColor1Green + (int)a_uiRadius; + if (iMaxGreen1 > 15) + { +- iMinGreen1 = 15; ++ iMaxGreen1 = 15; + } + + int iMinBlue1 = iColor1Blue - (int)a_uiRadius; +@@ -869,7 +869,7 @@ namespace Etc + int iMaxBlue1 = iColor1Blue + (int)a_uiRadius; + if (iMaxBlue1 > 15) + { +- iMinBlue1 = 15; ++ iMaxBlue1 = 15; + } + + int iColor2Red = m_frgbaOriginalColor2_TAndH.IntRed(15.0f); +@@ -884,7 +884,7 @@ namespace Etc + int iMaxRed2 = iColor2Red + (int)a_uiRadius; + if (iMaxRed2 > 15) + { +- iMinRed2 = 15; ++ iMaxRed2 = 15; + } + + int iMinGreen2 = iColor2Green - (int)a_uiRadius; +@@ -895,7 +895,7 @@ namespace Etc + int iMaxGreen2 = iColor2Green + (int)a_uiRadius; + if (iMaxGreen2 > 15) + { +- iMinGreen2 = 15; ++ iMaxGreen2 = 15; + } + + int iMinBlue2 = iColor2Blue - (int)a_uiRadius; +@@ -906,7 +906,7 @@ namespace Etc + int iMaxBlue2 = iColor2Blue + (int)a_uiRadius; + if (iMaxBlue2 > 15) + { +- iMinBlue2 = 15; ++ iMaxBlue2 = 15; + } + + for (unsigned int uiDistance = 0; uiDistance < TH_DISTANCES; uiDistance++) +@@ -1108,7 +1108,7 @@ namespace Etc + int iMaxRed1 = iColor1Red + (int)a_uiRadius; + if (iMaxRed1 > 15) + { +- iMinRed1 = 15; ++ iMaxRed1 = 15; + } + + int iMinGreen1 = iColor1Green - (int)a_uiRadius; +@@ -1119,7 +1119,7 @@ namespace Etc + int iMaxGreen1 = iColor1Green + (int)a_uiRadius; + if (iMaxGreen1 > 15) + { +- iMinGreen1 = 15; ++ iMaxGreen1 = 15; + } + + int iMinBlue1 = iColor1Blue - (int)a_uiRadius; +@@ -1130,7 +1130,7 @@ namespace Etc + int iMaxBlue1 = iColor1Blue + (int)a_uiRadius; + if (iMaxBlue1 > 15) + { +- iMinBlue1 = 15; ++ iMaxBlue1 = 15; + } + + int iColor2Red = m_frgbaOriginalColor2_TAndH.IntRed(15.0f); +@@ -1145,7 +1145,7 @@ namespace Etc + int iMaxRed2 = iColor2Red + (int)a_uiRadius; + if (iMaxRed2 > 15) + { +- iMinRed2 = 15; ++ iMaxRed2 = 15; + } + + int iMinGreen2 = iColor2Green - (int)a_uiRadius; +@@ -1156,7 +1156,7 @@ namespace Etc + int iMaxGreen2 = iColor2Green + (int)a_uiRadius; + if (iMaxGreen2 > 15) + { +- iMinGreen2 = 15; ++ iMaxGreen2 = 15; + } + + int iMinBlue2 = iColor2Blue - (int)a_uiRadius; +@@ -1167,7 +1167,7 @@ namespace Etc + int iMaxBlue2 = iColor2Blue + (int)a_uiRadius; + if (iMaxBlue2 > 15) + { +- iMinBlue2 = 15; ++ iMaxBlue2 = 15; + } + + for (unsigned int uiDistance = 0; uiDistance < TH_DISTANCES; uiDistance++) diff --git a/thirdparty/vulkan/vk_enum_string_helper.h b/thirdparty/vulkan/vk_enum_string_helper.h index 00c2b9d1d5..1c99b31270 100644 --- a/thirdparty/vulkan/vk_enum_string_helper.h +++ b/thirdparty/vulkan/vk_enum_string_helper.h @@ -31,7 +31,7 @@ #pragma once -#ifdef _WIN32 +#ifdef _MSC_VER #pragma warning( disable : 4065 ) #endif |