Skip to content

Commit d530ccb

Browse files
Improved Plane Detection (#406)
* chore: add vertices and plane classification * feat: get plane classification working * chore: remove debug logs * chore: 16kb page size support * fix: building issues * feat: update viroarplaneselector with newest features
1 parent 77b1de7 commit d530ccb

File tree

42 files changed

+2434
-683
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+2434
-683
lines changed
481 Bytes
Binary file not shown.

android/settings.gradle

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,15 @@ pluginManagement {
33
includeBuild("../node_modules/expo-modules-core/expo-module-gradle-plugin")
44
}
55
plugins { id("com.facebook.react.settings") }
6-
extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }
6+
extensions.configure(com.facebook.react.ReactSettingsExtension){ ex ->
7+
// Use a config file outside the build directory to avoid it being cleaned
8+
def autolinkConfigFile = new File(rootDir, ".gradle/autolinking.json")
9+
if (autolinkConfigFile.exists()) {
10+
ex.autolinkLibrariesFromConfigFile(autolinkConfigFile)
11+
} else {
12+
ex.autolinkLibrariesFromCommand()
13+
}
14+
}
715
includeBuild("../node_modules/@react-native/gradle-plugin")
816
includeBuild("../node_modules/expo-modules-core/expo-module-gradle-plugin")
917
include ':gvr_common', ':viro_bridge', ':viro_renderer', ':arcore_client'

android/viro_bridge/build.gradle

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,37 @@ android {
7171
*/
7272
}
7373

74+
react {
75+
// Configure node executable with full path to avoid PATH issues
76+
def nodeExec = project.hasProperty('nodeExecutable') ? project.property('nodeExecutable') : null
77+
if (nodeExec != null && !nodeExec.isEmpty()) {
78+
nodeExecutableAndArgs.set([nodeExec])
79+
} else {
80+
// Try to find node in common locations as fallback
81+
def nodePath = ["/usr/local/bin/node", "/usr/bin/node",
82+
System.getProperty("user.home") + "/.local/share/fnm/node-versions/v20.19.5/installation/bin/node"]
83+
.find { new File(it).exists() }
84+
if (nodePath != null) {
85+
nodeExecutableAndArgs.set([nodePath])
86+
}
87+
}
88+
}
89+
90+
// Also configure the tasks directly to ensure the setting is applied
91+
// This is necessary because the React plugin creates tasks before the react {} block is evaluated
92+
afterEvaluate {
93+
def nodeExec = project.hasProperty('nodeExecutable') ? project.property('nodeExecutable') : null
94+
if (nodeExec != null && !nodeExec.isEmpty()) {
95+
// Configure all React Native codegen tasks with the full path to node
96+
tasks.withType(com.facebook.react.tasks.GenerateCodegenSchemaTask).configureEach {
97+
nodeExecutableAndArgs.set([nodeExec])
98+
}
99+
tasks.withType(com.facebook.react.tasks.GenerateCodegenArtifactsTask).configureEach {
100+
nodeExecutableAndArgs.set([nodeExec])
101+
}
102+
}
103+
}
104+
74105
dependencies {
75106
androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
76107
exclude group: 'com.android.support', module: 'support-annotations'

android/viro_bridge/src/main/java/com/viromedia/bridge/component/node/VRTARScene.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,15 +128,30 @@ public void removeARNode(ARDeclarativeNode node) {
128128
}
129129

130130
public void setAnchorDetectionTypes(ReadableArray types) {
131+
// DEBUG LOGGING - START
132+
android.util.Log.d("ViroAR", "=== setAnchorDetectionTypes called ===");
133+
if (types != null) {
134+
for (int i = 0; i < types.size(); i++) {
135+
android.util.Log.d("ViroAR", " Prop value[" + i + "]: " + types.getString(i));
136+
}
137+
} else {
138+
android.util.Log.d("ViroAR", " types is NULL!");
139+
}
140+
// DEBUG LOGGING - END
141+
131142
EnumSet<ViroViewARCore.AnchorDetectionType> typesList = EnumSet.noneOf(ViroViewARCore.AnchorDetectionType.class);
132143
if (types != null) {
133144
for (int i = 0; i < types.size(); i++) {
134145
ViroViewARCore.AnchorDetectionType type = ViroViewARCore.AnchorDetectionType.valueFromString(types.getString(i));
135146
if (type != null) {
147+
android.util.Log.d("ViroAR", " Parsed type: " + type);
136148
typesList.add(type);
149+
} else {
150+
android.util.Log.e("ViroAR", " FAILED to parse: " + types.getString(i));
137151
}
138152
}
139153
}
154+
android.util.Log.d("ViroAR", " Final typesList size: " + typesList.size());
140155
((ARScene) mNativeScene).setAnchorDetectionTypes(typesList);
141156
}
142157

@@ -152,6 +167,9 @@ public void setCanARPointCloudUpdate(boolean canARPointCloudUpdate) {
152167

153168
@Override
154169
public void onTrackingUpdated(ARScene.TrackingState state, ARScene.TrackingStateReason reason) {
170+
// DEBUG LOGGING
171+
android.util.Log.d("ViroAR", "📍 Tracking updated: state=" + state + " (" + state.getId() + "), reason=" + reason + " (" + reason.getId() + ")");
172+
155173
WritableMap returnMap = Arguments.createMap();
156174
returnMap.putInt("state", state.getId());
157175
returnMap.putInt("reason", reason.getId());

android/viro_bridge/src/main/java/com/viromedia/bridge/utility/ARUtils.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public static WritableMap mapFromARAnchor(ARAnchor anchor) {
4848
returnMap.putDouble("width", plane.getExtent().x);
4949
returnMap.putDouble("height", plane.getExtent().z);
5050
returnMap.putString("alignment", plane.getAlignment().getStringValue());
51+
returnMap.putString("classification", plane.getClassification().getStringValue());
5152

5253
WritableArray polygonPointsArray = Arguments.createArray();
5354
for (Vector point : plane.getVertices()){
5.71 KB
Binary file not shown.

0 commit comments

Comments
 (0)