Repository: godotengine/godot (language: cpp)

Issue:
Error when building with `disable_3d`
### Tested versions

- Reproducible in current master b377562b52fa8a68a99d5e818d8e08ac8d3fd7da

### System information

Windows 11

### Issue description

I’m getting some errors when building with the following command: `scons platform=android target=template_debug arch=arm64 disable_3d=yes`

```
ERROR: modules\mobile_vr\mobile_vr_interface.cpp:43:9: error: no member named 'XR_STEREO' in 'RefCounted'; did you mean simply 'XR_STEREO'?
        return XRInterface::XR_STEREO;
               ^~~~~~~~~~~~~~~~~~~~~~
               XR_STEREO
.\servers/rendering/rendering_method.h:39:21: note: expanded from macro 'XRInterface'
#define XRInterface RefCounted
                    ^
.\servers/xr/xr_interface.h:58:3: note: 'XR_STEREO' declared here
                XR_STEREO = 2, /* can be used with stereo output */
                ^
modules\mobile_vr\mobile_vr_interface.cpp:183:20: error: no member named 'XR_NORMAL_TRACKING' in 'RefCounted'; did you mean simply 'XR_NORMAL_TRACKING'?
                tracking_state = XRInterface::XR_NORMAL_TRACKING;
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                 XR_NORMAL_TRACKING
.\servers/rendering/rendering_method.h:39:21: note: expanded from macro 'XRInterface'
#define XRInterface RefCounted
                    ^
.\servers/xr/xr_interface.h:66:3: note: 'XR_NORMAL_TRACKING' declared here
                XR_NORMAL_TRACKING,
                ^
modules\mobile_vr\mobile_vr_interface.cpp:196:20: error: no member named 'XR_NORMAL_TRACKING' in 'RefCounted'; did you mean simply 'XR_NORMAL_TRACKING'?
                tracking_state = XRInterface::XR_NORMAL_TRACKING;
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                 XR_NORMAL_TRACKING
.\servers/rendering/rendering_method.h:39:21: note: expanded from macro 'XRInterface'
#define XRInterface RefCounted
                    ^
.\servers/xr/xr_interface.h:66:3: note: 'XR_NORMAL_TRACKING' declared here
                XR_NORMAL_TRACKING,
                ^
modules\mobile_vr\mobile_vr_interface.cpp:350:1: error: no type named 'TrackingStatus' in 'RefCounted'; did you mean 'MobileVRInterface::TrackingStatus'?
XRInterface::TrackingStatus MobileVRInterface::get_tracking_status() const {
^~~~~~~~~~~~~~~~~~~~~~~~~~~
MobileVRInterface::TrackingStatus
.\servers/rendering/rendering_method.h:39:21: note: expanded from macro 'XRInterface'
#define XRInterface RefCounted
                    ^
.\servers/xr/xr_interface.h:65:7: note: 'MobileVRInterface::TrackingStatus' declared here
        enum TrackingStatus { /* tracking status currently based on AR but we can start doing more with this for VR as well */
             ^
modules\mobile_vr\mobile_vr_interface.cpp:422:49: error: no type named 'PlayAreaMode' in 'RefCounted'; did you mean simply 'PlayAreaMode'?
bool MobileVRInterface::supports_play_area_mode(XRInterface::PlayAreaMode p_mode) {
                                                ^~~~~~~~~~~~~~~~~~~~~~~~~
                                                PlayAreaMode
.\servers/rendering/rendering_method.h:39:21: note: expanded from macro 'XRInterface'
#define XRInterface RefCounted
                    ^
.\servers/xr/xr_interface.h:73:7: note: 'PlayAreaMode' declared here
        enum PlayAreaMode { /* defines the mode used by the XR interface for tracking */
             ^
modules\mobile_vr\mobile_vr_interface.cpp:427:1: error: no type named 'PlayAreaMode' in 'RefCounted'; did you mean 'MobileVRInterface::PlayAreaMode'?
XRInterface::PlayAreaMode MobileVRInterface::get_play_area_mode() const {
^~~~~~~~~~~~~~~~~~~~~~~~~
MobileVRInterface::PlayAreaMode
.\servers/rendering/rendering_method.h:39:21: note: expanded from macro 'XRInterface'
#define XRInterface RefCounted
                    ^
.\servers/xr/xr_interface.h:73:7: note: 'MobileVRInterface::PlayAreaMode' declared here
        enum PlayAreaMode { /* defines the mode used by the XR interface for tracking */
             ^
modules\mobile_vr\mobile_vr_interface.cpp:431:44: error: no type named 'PlayAreaMode' in 'RefCounted'; did you mean simply 'PlayAreaMode'?
bool MobileVRInterface::set_play_area_mode(XRInterface::PlayAreaMode p_mode) {
                                           ^~~~~~~~~~~~~~~~~~~~~~~~~
                                           PlayAreaMode
.\servers/rendering/rendering_method.h:39:21: note: expanded from macro 'XRInterface'
#define XRInterface RefCounted
                    ^
.\servers/xr/xr_interface.h:73:7: note: 'PlayAreaMode' declared here
        enum PlayAreaMode { /* defines the mode used by the XR interface for tracking */
             ^
7 errors generated
```

### Steps to reproduce

1. Clone master b377562b52fa8a68a99d5e818d8e08ac8d3fd7da
2. Build with `scons platform=android target=template_debug arch=arm64 disable_3d=yes`
3. Wait for it to throw errors.

### Minimal reproduction project (MRP)

N/A


Discussion / hints:
I reverted https://github.com/godotengine/godot/pull/103267 locally and it doesn't throw these errors now.

CC @YeldhamDev 

Fix patch:
diff --git a/SConstruct b/SConstruct
index 87bf5f2f8b1c..ba0139c90f24 100644
--- a/SConstruct
+++ b/SConstruct
@@ -918,6 +918,31 @@ suffix += env.extra_suffix
 sys.path.remove(tmppath)
 sys.modules.pop("detect")
 
+if env["disable_3d"]:
+    if env.editor_build:
+        print_error("Build option `disable_3d=yes` cannot be used for editor builds, only for export template builds.")
+        Exit(255)
+    else:
+        env.Append(CPPDEFINES=["_3D_DISABLED"])
+        env["disable_xr"] = True
+if env["disable_advanced_gui"]:
+    if env.editor_build:
+        print_error(
+            "Build option `disable_advanced_gui=yes` cannot be used for editor builds, only for export template builds."
+        )
+        Exit(255)
+    else:
+        env.Append(CPPDEFINES=["ADVANCED_GUI_DISABLED"])
+if env["disable_xr"]:
+    env.Append(CPPDEFINES=["XR_DISABLED"])
+if env["minizip"]:
+    env.Append(CPPDEFINES=["MINIZIP_ENABLED"])
+if env["brotli"]:
+    env.Append(CPPDEFINES=["BROTLI_ENABLED"])
+
+if not env["verbose"]:
+    methods.no_verbose(env)
+
 modules_enabled = OrderedDict()
 env.module_dependencies = {}
 env.module_icons_paths = []
@@ -987,31 +1012,6 @@ env["SHLIBSUFFIX"] = suffix + env["SHLIBSUFFIX"]
 env["OBJPREFIX"] = env["object_prefix"]
 env["SHOBJPREFIX"] = env["object_prefix"]
 
-if env["disable_3d"]:
-    if env.editor_build:
-        print_error("Build option `disable_3d=yes` cannot be used for editor builds, only for export template builds.")
-        Exit(255)
-    else:
-        env.Append(CPPDEFINES=["_3D_DISABLED"])
-        env["disable_xr"] = True
-if env["disable_advanced_gui"]:
-    if env.editor_build:
-        print_error(
-            "Build option `disable_advanced_gui=yes` cannot be used for editor builds, only for export template builds."
-        )
-        Exit(255)
-    else:
-        env.Append(CPPDEFINES=["ADVANCED_GUI_DISABLED"])
-if env["disable_xr"]:
-    env.Append(CPPDEFINES=["XR_DISABLED"])
-if env["minizip"]:
-    env.Append(CPPDEFINES=["MINIZIP_ENABLED"])
-if env["brotli"]:
-    env.Append(CPPDEFINES=["BROTLI_ENABLED"])
-
-if not env["verbose"]:
-    methods.no_verbose(env)
-
 GLSL_BUILDERS = {
     "RD_GLSL": env.Builder(
         action=env.Run(glsl_builders.build_rd_headers),


Test patch: