-
-
Notifications
You must be signed in to change notification settings - Fork 101
Open
Labels
Description
Describe the project you are working on
Template project
Describe the problem or limitation you are having in your project
When debugging issues related to feature tags, it would be convenient to get a list of all possible tags, and their true/false values.
With only OS.has_feature(), one has to manually check the docs for a list of all possible feature tags, and check them one by one.
https://docs.godotengine.org/en/stable/tutorials/export/feature_tags.html
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Add some methods such as OS.get_features() that returns an array of strings containing the names of all possible features.
Then one can simply iterate over the list to check each feature.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
func get_features_list() -> Array[Dictionary]:
var FEATURE_TAGS:Array[Dictionary] = [
{"name": "android", "desc": "Running on Android (but not within a Web browser)"},
{"name": "bsd", "desc": "Running on *BSD (but not within a Web browser)"},
{"name": "linux", "desc": "Running on Linux (but not within a Web browser)"},
{"name": "macos", "desc": "Running on macOS (but not within a Web browser)"},
{"name": "ios", "desc": "Running on iOS (but not within a Web browser)"},
{"name": "visionos", "desc": "Running on visionOS (but not within a Web browser)"},
{"name": "windows", "desc": "Running on Windows"},
{"name": "linuxbsd", "desc": "Running on Linux or *BSD"},
{"name": "debug", "desc": "Running on a debug build (including the editor)"},
{"name": "release", "desc": "Running on a release build"},
{"name": "editor", "desc": "Running on an editor build"},
{"name": "editor_hint", "desc": "Running on an editor build, and inside the editor"},
{"name": "editor_runtime", "desc": "Running on an editor build, and running the project"},
{"name": "template", "desc": "Running on a non-editor (export template) build"},
{"name": "double", "desc": "Running on a double-precision build"},
{"name": "single", "desc": "Running on a single-precision build"},
{"name": "64", "desc": "Running on a 64-bit build (any architecture)"},
{"name": "32", "desc": "Running on a 32-bit build (any architecture)"},
{"name": "x86_64", "desc": "Running on a 64-bit x86 build"},
{"name": "x86_32", "desc": "Running on a 32-bit x86 build"},
{"name": "x86", "desc": "Running on an x86 build (any bitness)"},
{"name": "arm64", "desc": "Running on a 64-bit ARM build"},
{"name": "arm32", "desc": "Running on a 32-bit ARM build"},
{"name": "arm", "desc": "Running on an ARM build (any bitness)"},
{"name": "rv64", "desc": "Running on a 64-bit RISC-V build"},
{"name": "riscv", "desc": "Running on a RISC-V build (any bitness)"},
{"name": "ppc64", "desc": "Running on a 64-bit PowerPC build"},
{"name": "ppc32", "desc": "Running on a 32-bit PowerPC build"},
{"name": "ppc", "desc": "Running on a PowerPC build (any bitness)"},
{"name": "wasm64", "desc": "Running on a 64-bit WebAssembly build (not yet possible)"},
{"name": "wasm32", "desc": "Running on a 32-bit WebAssembly build"},
{"name": "wasm", "desc": "Running on a WebAssembly build (any bitness)"},
{"name": "mobile", "desc": "Host OS is a mobile platform"},
{"name": "pc", "desc": "Host OS is a PC platform (desktop/laptop)"},
{"name": "web", "desc": "Host OS is a Web browser"},
{"name": "nothreads", "desc": "Running without threading support"},
{"name": "threads", "desc": "Running with threading support"},
{"name": "web_android", "desc": "Host OS is a Web browser running on Android"},
{"name": "web_ios", "desc": "Host OS is a Web browser running on iOS"},
{"name": "web_linuxbsd", "desc": "Host OS is a Web browser running on Linux or *BSD"},
{"name": "web_macos", "desc": "Host OS is a Web browser running on macOS"},
{"name": "web_windows", "desc": "Host OS is a Web browser running on Windows"},
{"name": "etc", "desc": "Textures using ETC1 compression are supported"},
{"name": "etc2", "desc": "Textures using ETC2 compression are supported"},
{"name": "s3tc", "desc": "Textures using S3TC (DXT/BC) compression are supported"},
{"name": "movie", "desc": "Movie Maker mode is active"},
{"name": "shader_baker", "desc": "Project was exported with shader baking enabled (only applies to the exported project, not when running in the editor)"},
{"name": "dedicated_server", "desc": "Project was exported as a dedicated server (only applies to the exported project, not when running in the editor)"}
]
# Add has_feature to each entry
for f in FEATURE_TAGS:
f["has_feature"] = OS.has_feature(f["name"])
return FEATURE_TAGS
func print_features(only_true := true, include_desc := true) -> void:
print("====================================================")
print("OS.has_feature():")
print("====================================================")
var features = get_features_list()
for f in features:
if only_true and not f["has_feature"]:
continue
if include_desc:
print("[%s] %s: %s" % [f["has_feature"], f["name"], f["desc"]])
else:
print(f["name"])
print("====================================================")
print()
Example output:
====================================================
OS.has_feature():
====================================================
[true] windows: Running on Windows
[true] debug: Running on a debug build (including the editor)
[true] editor: Running on an editor build
[true] editor_runtime: Running on an editor build, and running the project
[true] single: Running on a single-precision build
[true] 64: Running on a 64-bit build (any architecture)
[true] x86_64: Running on a 64-bit x86 build
[true] x86: Running on an x86 build (any bitness)
[true] pc: Host OS is a PC platform (desktop/laptop)
[true] threads: Running with threading support
[true] s3tc: Textures using S3TC (DXT/BC) compression are supported
====================================================
If this enhancement will not be used often, can it be worked around with a few lines of script?
Yes
Is there a reason why this should be core and not an add-on in the asset library?
This is for core (OS)
AThousandShips and Mickeon