Add GLOBAL_GET cached macros.

GLOBAL_GET is an expensive operation which should not be used each frame / tick.
This PR adds macros which do a cheaper revision check, and only call the expensive GLOBAL_GET when project settings have changed.

Co-authored-by: Lukas Tenbrink <lukas.tenbrink@gmail.com>
This commit is contained in:
lawnjelly 2025-04-29 14:48:52 +01:00
parent 8edf97e342
commit f8f350a32a
48 changed files with 110 additions and 77 deletions

View file

@ -43,7 +43,7 @@ Node *EditorSceneFormatImporterUFBX::import_scene(const String &p_path, uint32_t
const HashMap<StringName, Variant> &p_options,
List<String> *r_missing_deps, Error *r_err) {
// FIXME: Hack to work around GH-86309.
if (p_options.has("fbx/importer") && int(p_options["fbx/importer"]) == FBX_IMPORTER_FBX2GLTF && GLOBAL_GET("filesystem/import/fbx2gltf/enabled")) {
if (p_options.has("fbx/importer") && int(p_options["fbx/importer"]) == FBX_IMPORTER_FBX2GLTF && GLOBAL_GET_CACHED(bool, "filesystem/import/fbx2gltf/enabled")) {
Ref<EditorSceneFormatImporterFBX2GLTF> fbx2gltf_importer;
fbx2gltf_importer.instantiate();
Node *scene = fbx2gltf_importer->import_scene(p_path, p_flags, p_options, r_missing_deps, r_err);