Skip to content

Commit b836db9

Browse files
authored
Add API documentation for Meta's Scene Understanding and Spatial Anchor APIs. (#156)
1 parent d1039ab commit b836db9

30 files changed

+668
-91
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ local.properties
2424

2525
# Misc
2626
.DS_Store
27+
/common/src/gen/

SConstruct

+4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ sources += Glob("#common/src/main/cpp/export/*.cpp")
1919
sources += Glob("#common/src/main/cpp/extensions/*.cpp")
2020
sources += Glob("#common/src/main/cpp/classes/*.cpp")
2121

22+
if env["target"] in ["editor", "template_debug"]:
23+
doc_data = env.GodotCPPDocData("#common/src/gen/doc_data.gen.cpp", source=Glob("doc_classes/*.xml"))
24+
sources.append(doc_data)
25+
2226
binary_path = '#demo/addons/godotopenxrvendors/.bin'
2327
project_name = 'godotopenxrvendors'
2428

common/src/main/cpp/classes/openxr_fb_spatial_entity_query.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ bool OpenXRFbSpatialEntityQuery::_execute_query_by_uuid() {
178178
XR_TYPE_SPACE_QUERY_INFO_FB, // type
179179
nullptr, // next
180180
XR_SPACE_QUERY_ACTION_LOAD_FB, // queryAction
181-
max_results, // maxResultsCount
181+
uuid_array.size(), // maxResultsCount
182182
(XrDuration)(timeout * 1000000), // timeout
183183
(XrSpaceFilterInfoBaseHeaderFB *)&filter, // filter
184184
nullptr, // excludeFilter
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<class name="OpenXRFbCompositionLayerAlphaBlendExtensionWrapper" inherits="OpenXRExtensionWrapperExtension" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/godotengine/godot/master/doc/class.xsd">
3+
<brief_description>
4+
</brief_description>
5+
<description>
6+
</description>
7+
<tutorials>
8+
</tutorials>
9+
<constants>
10+
<constant name="BLEND_FACTOR_ZERO" value="0" enum="BlendFactor">
11+
</constant>
12+
<constant name="BLEND_FACTOR_ONE" value="1" enum="BlendFactor">
13+
</constant>
14+
<constant name="BLEND_FACTOR_SRC_ALPHA" value="2" enum="BlendFactor">
15+
</constant>
16+
<constant name="BLEND_FACTOR_ONE_MINUS_SRC_ALPHA" value="3" enum="BlendFactor">
17+
</constant>
18+
<constant name="BLEND_FACTOR_DST_ALPHA" value="4" enum="BlendFactor">
19+
</constant>
20+
<constant name="BLEND_FACTOR_ONE_MINUS_DST_ALPHA" value="5" enum="BlendFactor">
21+
</constant>
22+
</constants>
23+
</class>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<class name="OpenXRFbCompositionLayerSettingsExtensionWrapper" inherits="OpenXRExtensionWrapperExtension" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/godotengine/godot/master/doc/class.xsd">
3+
<brief_description>
4+
</brief_description>
5+
<description>
6+
</description>
7+
<tutorials>
8+
</tutorials>
9+
<constants>
10+
<constant name="SUPERSAMPLING_MODE_DISABLED" value="0" enum="SupersamplingMode">
11+
</constant>
12+
<constant name="SUPERSAMPLING_MODE_NORMAL" value="1" enum="SupersamplingMode">
13+
</constant>
14+
<constant name="SUPERSAMPLING_MODE_QUALITY" value="2" enum="SupersamplingMode">
15+
</constant>
16+
<constant name="SHARPENING_MODE_DISABLED" value="0" enum="SharpeningMode">
17+
</constant>
18+
<constant name="SHARPENING_MODE_NORMAL" value="1" enum="SharpeningMode">
19+
</constant>
20+
<constant name="SHARPENING_MODE_QUALITY" value="2" enum="SharpeningMode">
21+
</constant>
22+
</constants>
23+
</class>

doc_classes/OpenXRFbHandTrackingCapsulesExtensionWrapper.xml

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,33 +7,33 @@
77
<tutorials>
88
</tutorials>
99
<methods>
10-
<method name="get_hand_capsule_count">
10+
<method name="get_hand_capsule_count" qualifiers="const">
1111
<return type="int" />
1212
<description>
1313
</description>
1414
</method>
15-
<method name="get_hand_capsule_height">
15+
<method name="get_hand_capsule_height" qualifiers="const">
1616
<return type="float" />
1717
<param index="0" name="hand_index" type="int" />
1818
<param index="1" name="capsule_index" type="int" />
1919
<description>
2020
</description>
2121
</method>
22-
<method name="get_hand_capsule_joint">
22+
<method name="get_hand_capsule_joint" qualifiers="const">
2323
<return type="int" enum="XRHandTracker.HandJoint" />
2424
<param index="0" name="hand_index" type="int" />
2525
<param index="1" name="capsule_index" type="int" />
2626
<description>
2727
</description>
2828
</method>
29-
<method name="get_hand_capsule_radius">
29+
<method name="get_hand_capsule_radius" qualifiers="const">
3030
<return type="float" />
3131
<param index="0" name="hand_index" type="int" />
3232
<param index="1" name="capsule_index" type="int" />
3333
<description>
3434
</description>
3535
</method>
36-
<method name="get_hand_capsule_transform">
36+
<method name="get_hand_capsule_transform" qualifiers="const">
3737
<return type="Transform3D" />
3838
<param index="0" name="hand_index" type="int" />
3939
<param index="1" name="capsule_index" type="int" />

doc_classes/OpenXRFbHandTrackingMesh.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<tutorials>
88
</tutorials>
99
<methods>
10-
<method name="get_mesh_instance">
10+
<method name="get_mesh_instance" qualifiers="const">
1111
<return type="MeshInstance3D" />
1212
<description>
1313
</description>
@@ -18,9 +18,9 @@
1818
</member>
1919
<member name="material" type="Material" setter="set_material" getter="get_material">
2020
</member>
21-
<member name="scale_override" type="float" setter="set_scale_override" getter="get_scale_override" default="2.51113e-42">
21+
<member name="scale_override" type="float" setter="set_scale_override" getter="get_scale_override">
2222
</member>
23-
<member name="use_scale_override" type="bool" setter="set_use_scale_override" getter="get_use_scale_override" default="true">
23+
<member name="use_scale_override" type="bool" setter="set_use_scale_override" getter="get_use_scale_override">
2424
</member>
2525
</members>
2626
<constants>

doc_classes/OpenXRFbPassthroughExtensionWrapper.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
</method>
8686
<method name="set_color_map">
8787
<return type="void" />
88-
<param index="0" name="gradient" type="GradientTexture1D" />
88+
<param index="0" name="gradient" type="Gradient" />
8989
<description>
9090
</description>
9191
</method>

doc_classes/OpenXRFbPassthroughGeometry.xml

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
<tutorials>
88
</tutorials>
99
<members>
10+
<member name="enable_hole_punch" type="bool" setter="set_enable_hole_punch" getter="get_enable_hole_punch" default="true">
11+
</member>
1012
<member name="mesh" type="Mesh" setter="set_mesh" getter="get_mesh">
1113
</member>
1214
</members>

doc_classes/OpenXRFbRenderModelExtensionWrapper.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<tutorials>
88
</tutorials>
99
<methods>
10-
<method name="is_enabled">
10+
<method name="is_enabled" qualifiers="const">
1111
<return type="bool" />
1212
<description>
1313
</description>

doc_classes/OpenXRFbSceneCaptureExtensionWrapper.xml

+10-3
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,38 @@
11
<?xml version="1.0" encoding="UTF-8" ?>
22
<class name="OpenXRFbSceneCaptureExtensionWrapper" inherits="OpenXRExtensionWrapperExtension" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/godotengine/godot/master/doc/class.xsd">
33
<brief_description>
4+
Wraps the [code]XR_FB_scene_capture[/code] extension.
45
</brief_description>
56
<description>
7+
Wraps the [code]XR_FB_scene_capture[/code] extension.
68
</description>
79
<tutorials>
810
</tutorials>
911
<methods>
10-
<method name="is_scene_capture_enabled">
12+
<method name="is_scene_capture_enabled" deprecated="Use [method OpenXRFbSceneManager.is_scene_capture_enabled] instead.">
1113
<return type="bool" />
1214
<description>
15+
Checks if this extension is enabled.
1316
</description>
1417
</method>
15-
<method name="is_scene_capture_supported">
18+
<method name="is_scene_capture_supported" deprecated="Use [method OpenXRFbSceneManager.is_scene_capture_enabled] instead.">
1619
<return type="bool" />
1720
<description>
21+
Checks if scene capture is supported.
1822
</description>
1923
</method>
20-
<method name="request_scene_capture">
24+
<method name="request_scene_capture" deprecated="Use [method OpenXRFbSceneManager.request_scene_capture] instead.">
2125
<return type="bool" />
2226
<description>
27+
Requests the user go through the scene capture process.
28+
The [signal scene_capture_completed] signal will be emitted when the process has completed.
2329
</description>
2430
</method>
2531
</methods>
2632
<signals>
2733
<signal name="scene_capture_completed">
2834
<description>
35+
Emitted when the scene capture process is completed.
2936
</description>
3037
</signal>
3138
</signals>

doc_classes/OpenXRFbSceneExtensionWrapper.xml

+3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
<?xml version="1.0" encoding="UTF-8" ?>
22
<class name="OpenXRFbSceneExtensionWrapper" inherits="OpenXRExtensionWrapperExtension" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/godotengine/godot/master/doc/class.xsd">
33
<brief_description>
4+
Wraps the [code]XR_FB_scene[/code] extension.
45
</brief_description>
56
<description>
7+
Wraps the [code]XR_FB_scene[/code] extension.
68
</description>
79
<tutorials>
810
</tutorials>
911
<methods>
1012
<method name="is_scene_supported">
1113
<return type="bool" />
1214
<description>
15+
Checks if this extension is supported.
1316
</description>
1417
</method>
1518
</methods>

doc_classes/OpenXRFbSceneManager.xml

+38-6
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,122 @@
11
<?xml version="1.0" encoding="UTF-8" ?>
22
<class name="OpenXRFbSceneManager" inherits="Node" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/godotengine/godot/master/doc/class.xsd">
33
<brief_description>
4+
Provides an easy-to-use way to interact with Meta's Scene Understanding.
45
</brief_description>
56
<description>
7+
Provides an easy-to-use way to interact with Meta's Scene Understanding.
8+
This node allows you to register scenes to be instantiated for each scene anchor that is discovered, and provide a method that will be called on them after creation with a [OpenXRFbSpatialEntity] that can be used to setup the scene using data from the scene anchor.
9+
Each instantiated scene will be added as a child of an [XRAnchor3D] node that will be positioned using tracking data from the headset.
610
</description>
711
<tutorials>
812
</tutorials>
913
<methods>
10-
<method name="are_scene_anchors_created">
14+
<method name="are_scene_anchors_created" qualifiers="const">
1115
<return type="bool" />
1216
<description>
17+
Checks if the scene anchors have been created already or not.
1318
</description>
1419
</method>
1520
<method name="create_scene_anchors">
1621
<return type="int" enum="Error" />
1722
<description>
23+
Attempts to create the scene anchors discovered in the physical space around the user.
24+
This is an asynchronous operation - the [signal openxr_fb_scene_data_missing] signal will be emitted if no scene data can be found, and the [signal openxr_fb_scene_anchor_created] signal will be emitted for each scene anchor successfully created.
25+
This will only work during an active OpenXR session. If you've set [member auto_create] to [code]true[/code], then this method will be called automatically when an OpenXR session has begun.
1826
</description>
1927
</method>
20-
<method name="get_anchor_node">
28+
<method name="get_anchor_node" qualifiers="const">
2129
<return type="XRAnchor3D" />
2230
<param index="0" name="uuid" type="StringName" />
2331
<description>
32+
Gets the [XRAnchor3D] node which was created for the spatial entity with the given UUID.
33+
Note: All anchors will be created asynchronously, either by calling [method create_scene_anchors] or when the OpenXR session begins if [member auto_create] is set to [code]true[/code].
2434
</description>
2535
</method>
26-
<method name="get_anchor_uuids">
36+
<method name="get_anchor_uuids" qualifiers="const">
2737
<return type="Array" />
2838
<description>
39+
Gets the UUIDs of all scene anchors that have been created.
40+
Note: All anchors will be created asynchronously, either by calling [method create_scene_anchors] or when the OpenXR session begins if [member auto_create] is set to [code]true[/code].
2941
</description>
3042
</method>
31-
<method name="get_spatial_entity">
43+
<method name="get_spatial_entity" qualifiers="const">
3244
<return type="OpenXRFbSpatialEntity" />
3345
<param index="0" name="uuid" type="StringName" />
3446
<description>
47+
Gets the spatial entity identified by the given UUID.
48+
Note: Only works for spatial entities that were loaded as a result of calling [method create_scene_anchors] or when the OpenXR session begins if [member auto_create] is set to [code]true[/code].
3549
</description>
3650
</method>
3751
<method name="hide">
3852
<return type="void" />
3953
<description>
54+
Hides all scene anchors created by this manager.
4055
</description>
4156
</method>
42-
<method name="is_scene_capture_enabled">
57+
<method name="is_scene_capture_enabled" qualifiers="const">
4358
<return type="bool" />
4459
<description>
60+
Checks if scene capture is enabled.
4561
</description>
4662
</method>
4763
<method name="remove_scene_anchors">
4864
<return type="void" />
4965
<description>
66+
Removes all scene anchors.
67+
This will be done automatically when the OpenXR session ends, or when this node is removed from the scene tree.
5068
</description>
5169
</method>
52-
<method name="request_scene_capture">
70+
<method name="request_scene_capture" qualifiers="const">
5371
<return type="bool" />
5472
<param index="0" name="request" type="String" default="&quot;&quot;" />
5573
<description>
74+
Requests the user go through the scene capture process.
75+
This will only work if scene capture is enabled, which can be checked by calling [method is_scene_capture_enabled].
76+
The [signal openxr_fb_scene_capture_completed] signal will be emitted when the process has completed.
5677
</description>
5778
</method>
5879
<method name="show">
5980
<return type="void" />
6081
<description>
82+
Shows all scene anchors created by this manager, if they had been previously hidden.
6183
</description>
6284
</method>
6385
</methods>
6486
<members>
6587
<member name="auto_create" type="bool" setter="set_auto_create" getter="get_auto_create" default="true">
88+
If enabled, this node will run [method create_scene_anchors] when an OpenXR session starts.
6689
</member>
6790
<member name="default_scene" type="PackedScene" setter="set_default_scene" getter="get_default_scene">
91+
The default scene to be instatiated for any scene anchor, if there isn't a scene registered for the given type of scene anchor.
6892
</member>
6993
<member name="scene_setup_method" type="StringName" setter="set_scene_setup_method" getter="get_scene_setup_method" default="&amp;&quot;setup_scene&quot;">
94+
The method that will be called on scenes after they have been instantiated for a scene anchor.
95+
The method will be called with a single [OpenXRFbSpatialEntity] argument, representing the scene anchor.
7096
</member>
7197
<member name="visible" type="bool" setter="set_visible" getter="get_visible" default="true">
98+
Controls the visibility of the scene anchors managed by this node.
7299
</member>
73100
</members>
74101
<signals>
75102
<signal name="openxr_fb_scene_anchor_created">
76103
<param index="0" name="scene_node" type="Object" />
77104
<param index="1" name="spatial_entity" type="Object" />
78105
<description>
106+
Emitted when a new scene anchor is created.
107+
It will receive the scene that was instantiated, and the `OpenXRFbSpatialEntity` object representing the scene anchor.
79108
</description>
80109
</signal>
81110
<signal name="openxr_fb_scene_capture_completed">
82111
<param index="0" name="success" type="bool" />
83112
<description>
113+
Emitted when the scene capture process is completed.
84114
</description>
85115
</signal>
86116
<signal name="openxr_fb_scene_data_missing">
87117
<description>
118+
Emitted after [method create_scene_anchors] is called (or the OpenXR session has begun if [member auto_create] is [code]true[/code]), if no scene data can be found.
119+
Depending on your application, this may be a good time to initiate the scene capture process via [method request_scene_capture].
88120
</description>
89121
</signal>
90122
</signals>

0 commit comments

Comments
 (0)