Skip to content

Commit 3e8f961

Browse files
authored
Disable buildingsWithUniqueIds setting for MapboxStreets data source. (#655)
* Added workaround to prevent users from accidentally turning on filtering for MapboxStreets building. * Update changelog
1 parent 2d9d667 commit 3e8f961

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

documentation/docs/05-changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- Add camera script with zoom & pan support for TabletopAR scene.
1010

1111
##### Bug Fixes
12+
- Remove `buildingsWithUniqueIds` setting for `Mapbox Streets` data source.
1213
- Change `Style Name` to `Data Source`
1314
- Fix to make filter values case insensitive.
1415
- Fix issue where position vector features was not being set.

sdkproject/Assets/Mapbox/Unity/Editor/PropertyDrawers/VectorLayerPropertiesDrawer.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten
218218
var layerProperty = subLayerArray.GetArrayElementAtIndex(SelectionIndex);
219219

220220
layerProperty.isExpanded = true;
221-
DrawLayerVisualizerProperties(layerProperty);
221+
DrawLayerVisualizerProperties(sourceTypeValue,layerProperty);
222222
}
223223
else
224224
{
@@ -228,7 +228,7 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten
228228
EditorGUI.EndProperty();
229229
}
230230

231-
void DrawLayerVisualizerProperties(SerializedProperty layerProperty)
231+
void DrawLayerVisualizerProperties(VectorSourceType sourceType, SerializedProperty layerProperty)
232232
{
233233
EditorGUI.indentLevel++;
234234
GUILayout.Label("Vector Layer Visualizer Properties");
@@ -252,12 +252,17 @@ void DrawLayerVisualizerProperties(SerializedProperty layerProperty)
252252
EditorGUI.indentLevel++;
253253
if (ShowOthers)
254254
{
255-
if (primitiveTypeProp == VectorPrimitiveType.Polygon)
255+
if (primitiveTypeProp == VectorPrimitiveType.Polygon && sourceType != VectorSourceType.MapboxStreets)
256256
{
257257
EditorGUI.indentLevel--;
258+
layerProperty.FindPropertyRelative("honorBuildingIdSetting").boolValue = true;
258259
EditorGUILayout.PropertyField(layerProperty.FindPropertyRelative("buildingsWithUniqueIds"), new GUIContent { text = "Buildings With Unique Ids", tooltip = "Turn on this setting only when rendering 3D buildings from the Mapbox Streets with Building Ids tileset. Using this setting with any other polygon layers or source will result in visual artifacts. " });
259260
EditorGUI.indentLevel++;
260261
}
262+
else
263+
{
264+
layerProperty.FindPropertyRelative("honorBuildingIdSetting").boolValue = false;
265+
}
261266
EditorGUILayout.PropertyField(layerProperty.FindPropertyRelative("filterOptions"), new GUIContent("Filters"));
262267
//EditorGUILayout.PropertyField(layerProperty.FindPropertyRelative("modifierOptions"), new GUIContent("Modifiers"));
263268
DrawModifiers(layerProperty, new GUIContent { text = "Modifier Options", tooltip = "Additional Feature modifiers to apply to the visualizer. " });

sdkproject/Assets/Mapbox/Unity/LayerProperties/VectorSubLayerProperties.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ public class VectorSubLayerProperties : LayerProperties
2222
colliderType = ColliderType.None,
2323
};
2424
public GeometryMaterialOptions materialOptions = new GeometryMaterialOptions();
25-
25+
//HACK : workaround to avoid users accidentaly leaving the buildingsWithUniqueIds settign on and have missing buildings.
26+
public bool honorBuildingIdSetting = true;
2627
public bool buildingsWithUniqueIds = false;
2728
public PositionTargetType moveFeaturePositionTo;
2829
[NodeEditorElement("Mesh Modifiers")]

sdkproject/Assets/Mapbox/Unity/MeshGeneration/LayerVisualizers/VectorLayerVisualizer.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,10 +214,13 @@ private IEnumerator ProcessLayer(VectorTileLayer layer, UnityTile tile, Action c
214214
for (int i = 0; i < fc; i++)
215215
{
216216

217-
var feature = new VectorFeatureUnity(layer.GetFeature(i), tile, layer.Extent, _layerProperties.buildingsWithUniqueIds);
217+
var buildingsWithUniqueIds =
218+
(_layerProperties.honorBuildingIdSetting) && _layerProperties.buildingsWithUniqueIds;
219+
220+
var feature = new VectorFeatureUnity(layer.GetFeature(i), tile, layer.Extent, buildingsWithUniqueIds);
218221

219222
//skip existing features, only works on tilesets with unique ids
220-
if (_layerProperties.buildingsWithUniqueIds && _activeIds.Contains(feature.Data.Id))
223+
if (buildingsWithUniqueIds && _activeIds.Contains(feature.Data.Id))
221224
{
222225
continue;
223226
}

0 commit comments

Comments
 (0)