Skip to content

Commit 33a4bd4

Browse files
committed
Lots of comments! yay
1 parent 5f3b594 commit 33a4bd4

File tree

5 files changed

+65
-7
lines changed

5 files changed

+65
-7
lines changed

Assets/MixedRealityToolkit/Definitions/SpatialAwareness/BaseSpatialAwarenessObserverProfile.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
namespace Microsoft.MixedReality.Toolkit.SpatialAwareness
99
{
10+
/// <summary>
11+
/// Abstract class that provides base profile information for Spatial Awareness Observers and their configuration
12+
/// </summary>
1013
[Serializable]
1114
public abstract class BaseSpatialAwarenessObserverProfile : BaseMixedRealityProfile
1215
{

Assets/MixedRealityToolkit/Inspectors/Profiles/DataProviderAccessServiceInspector.cs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,14 @@ namespace Microsoft.MixedReality.Toolkit.Editor
1111
{
1212
/// <summary>
1313
/// Abstract class providing base functionality for data provider management in inspector. Useful for core systems that follow dataprovider access model.
14+
/// Designed to target ScriptableObject profile classes that configure services who support data providers.
15+
/// These profile ScriptableObject classes should contain an array of IMixedRealityServiceConfigurations that configure a list of data providers for this service configuration
1416
/// </summary>
1517
public abstract class BaseDataProviderServiceInspector : BaseMixedRealityToolkitConfigurationProfileInspector
1618
{
19+
/// <summary>
20+
/// Container class used to store references to serialized properties on a <see cref="IMixedRealityServiceConfiguration"/> target
21+
/// </summary>
1722
protected class ServiceConfigurationProperties
1823
{
1924
internal SerializedProperty componentName;
@@ -22,8 +27,20 @@ protected class ServiceConfigurationProperties
2227
internal SerializedProperty runtimePlatform;
2328
}
2429

30+
/// <summary>
31+
/// Returns <see cref="SerializedProperty"/> object that wraps references to array of <see cref="IMixedRealityServiceConfiguration"/> stored on the inspected target object
32+
/// </summary>
2533
protected abstract SerializedProperty GetDataProviderConfigurationList();
34+
35+
/// <summary>
36+
/// Builds <see cref="ServiceConfigurationProperties"/> container object with <see cref="SerializedProperty"/> references to associated properties on the supplied <see cref="IMixedRealityServiceConfiguration"/> reference
37+
/// </summary>
38+
/// <param name="providerEntry"><see cref="SerializedProperty"/> reference pointing to <see cref="IMixedRealityServiceConfiguration"/> instance</param>
2639
protected abstract ServiceConfigurationProperties GetDataProviderConfigurationProperties(SerializedProperty providerEntry);
40+
41+
/// <summary>
42+
/// Returns direct <see cref="IMixedRealityServiceConfiguration"/> instance at provided index in target object's array of <see cref="IMixedRealityServiceConfiguration"/> configurations
43+
/// </summary>
2744
protected abstract IMixedRealityServiceConfiguration GetDataProviderConfiguration(int index);
2845

2946
private SerializedProperty providerConfigurations;
@@ -32,6 +49,7 @@ protected class ServiceConfigurationProperties
3249
private static readonly GUIContent ComponentTypeLabel = new GUIContent("Type");
3350
private static readonly GUIContent SupportedPlatformsLabel = new GUIContent("Supported Platform(s)");
3451

52+
/// <inheritdoc/>
3553
protected override void OnEnable()
3654
{
3755
base.OnEnable();
@@ -44,6 +62,10 @@ protected override void OnEnable()
4462
}
4563
}
4664

65+
/// <summary>
66+
/// Adds a new data provider profile entry (i.e <see cref="IMixedRealityServiceConfiguration"/>) to array list of target object
67+
/// Utilizes GetDataProviderConfigurationList() to get <see cref="SerializedProperty"/> object that represents array to insert against
68+
/// </summary>
4769
protected virtual void AddDataProvider()
4870
{
4971
providerConfigurations.InsertArrayElementAtIndex(providerConfigurations.arraySize);
@@ -62,6 +84,11 @@ protected virtual void AddDataProvider()
6284
providerFoldouts.Add(false);
6385
}
6486

87+
/// <summary>
88+
/// Removed given index item from <see cref="IMixedRealityServiceConfiguration"/> array list.
89+
/// Utilizes GetDataProviderConfigurationList() to get <see cref="SerializedProperty"/> object that represents array to delete against.
90+
/// </summary>
91+
/// <param name="index"></param>
6592
protected virtual void RemoveDataProvider(int index)
6693
{
6794
providerConfigurations.DeleteArrayElementAtIndex(index);
@@ -70,6 +97,11 @@ protected virtual void RemoveDataProvider(int index)
7097
providerFoldouts.RemoveAt(index);
7198
}
7299

100+
/// <summary>
101+
/// Applies the given concrete dataprovider type properties to the provided <see cref="IMixedRealityServiceConfiguration"/> instance (as represented by <see cref="ServiceConfigurationProperties"/>).
102+
/// Requires <see cref="MixedRealityDataProviderAttribute"/> on concrete type class to pull initial values
103+
/// that will be applied to the <see cref="ServiceConfigurationProperties"/> container SerializedProperties
104+
/// </summary>
73105
protected virtual void ApplyProviderConfiguration(Type dataProviderType, ServiceConfigurationProperties providerProperties)
74106
{
75107
if (dataProviderType != null)
@@ -90,6 +122,10 @@ protected virtual void ApplyProviderConfiguration(Type dataProviderType, Service
90122
}
91123
}
92124

125+
/// <summary>
126+
/// Render list of data provider configuration profiles in inspector. Use provided add and remove content labels for the insert/remove buttons
127+
/// Returns true if any property has changed in this render pass, false otherwise
128+
/// </summary>
93129
protected bool RenderDataProviderList(GUIContent addContentLabel, GUIContent removeContentLabel, string errorMsg, Type dataProviderProfileType = null)
94130
{
95131
bool changed = false;
@@ -116,6 +152,11 @@ protected bool RenderDataProviderList(GUIContent addContentLabel, GUIContent rem
116152
}
117153
}
118154

155+
/// <summary>
156+
/// Renders properties of <see cref="IMixedRealityServiceConfiguration"/> instance at provided index in inspector.
157+
/// Also renders inspector view of data provider's profile object and it's contents if applicable and foldout is expanded.
158+
/// </summary>
159+
/// <returns></returns>
119160
protected bool RenderDataProviderEntry(int index, GUIContent removeContent, System.Type dataProviderProfileType = null)
120161
{
121162
bool changed = false;

Assets/MixedRealityToolkit/Inspectors/Profiles/MixedRealityCameraProfileInspector.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22
// Licensed under the MIT License. See LICENSE in the project root for license information.
33

44
using Microsoft.MixedReality.Toolkit.CameraSystem;
5-
using Microsoft.MixedReality.Toolkit.Utilities.Editor;
65
using UnityEditor;
76
using UnityEngine;
87

98
namespace Microsoft.MixedReality.Toolkit.Editor
109
{
1110
[CustomEditor(typeof(MixedRealityCameraProfile))]
12-
public class MixedRealityCameraProfileInspector : BaseDataProviderServiceInspector
11+
internal class MixedRealityCameraProfileInspector : BaseDataProviderServiceInspector
1312
{
1413
private bool showProviders = false;
1514
private const string showProvidersPreferenceKey = "ShowCameraSystem_DataProviders_PreferenceKey";
@@ -41,6 +40,7 @@ public class MixedRealityCameraProfileInspector : BaseDataProviderServiceInspect
4140
private const string profileTitle = "Camera Settings";
4241
private const string profileDescription = "The Camera Profile helps configure cross platform camera settings.";
4342

43+
/// <inheritdoc/>
4444
protected override void OnEnable()
4545
{
4646
base.OnEnable();
@@ -58,6 +58,7 @@ protected override void OnEnable()
5858
transparentQualityLevel = serializedObject.FindProperty("transparentQualityLevel");
5959
}
6060

61+
/// <inheritdoc/>
6162
public override void OnInspectorGUI()
6263
{
6364
if (!RenderProfileHeader(profileTitle, profileDescription, target))
@@ -118,6 +119,7 @@ public override void OnInspectorGUI()
118119
}
119120
}
120121

122+
/// <inheritdoc/>
121123
protected override bool IsProfileInActiveInstance()
122124
{
123125
var profile = target as BaseMixedRealityProfile;
@@ -128,11 +130,13 @@ protected override bool IsProfileInActiveInstance()
128130

129131
#region DataProvider Inspector Utilities
130132

133+
/// <inheritdoc/>
131134
protected override SerializedProperty GetDataProviderConfigurationList()
132135
{
133136
return serializedObject.FindProperty("settingsConfigurations");
134137
}
135138

139+
/// <inheritdoc/>
136140
protected override ServiceConfigurationProperties GetDataProviderConfigurationProperties(SerializedProperty providerEntry)
137141
{
138142
return new ServiceConfigurationProperties()
@@ -144,6 +148,7 @@ protected override ServiceConfigurationProperties GetDataProviderConfigurationPr
144148
};
145149
}
146150

151+
/// <inheritdoc/>
147152
protected override IMixedRealityServiceConfiguration GetDataProviderConfiguration(int index)
148153
{
149154
var configurations = (target as MixedRealityCameraProfile)?.SettingsConfigurations;

Assets/MixedRealityToolkit/Inspectors/Profiles/MixedRealityInputSystemProfileInspector.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22
// Licensed under the MIT License. See LICENSE in the project root for license information.
33

44
using Microsoft.MixedReality.Toolkit.Editor;
5-
using Microsoft.MixedReality.Toolkit.Utilities.Editor;
65
using UnityEditor;
76
using UnityEngine;
87

98
namespace Microsoft.MixedReality.Toolkit.Input.Editor
109
{
1110
[CustomEditor(typeof(MixedRealityInputSystemProfile))]
12-
public class MixedRealityInputSystemProfileInspector : BaseDataProviderServiceInspector
11+
internal class MixedRealityInputSystemProfileInspector : BaseDataProviderServiceInspector
1312
{
1413
private const string DataProviderErrorMsg = "The Mixed Reality Input System requires one or more data providers.";
1514
private static readonly GUIContent AddProviderContent = new GUIContent("+ Add Data Provider", "Add Data Provider");
@@ -54,6 +53,7 @@ public class MixedRealityInputSystemProfileInspector : BaseDataProviderServiceIn
5453
private const string ProfileTitle = "Input System Settings";
5554
private const string ProfileDescription = "The Input System Profile helps developers configure input for cross-platform applications.";
5655

56+
/// <inheritdoc/>
5757
protected override void OnEnable()
5858
{
5959
base.OnEnable();
@@ -73,9 +73,10 @@ protected override void OnEnable()
7373
handTrackingProfile = serializedObject.FindProperty("handTrackingProfile");
7474
}
7575

76+
/// <inheritdoc/>
7677
public override void OnInspectorGUI()
7778
{
78-
if (!RenderProfileHeader(ProfileTitle, string.Empty, target))
79+
if (!RenderProfileHeader(ProfileTitle, ProfileDescription, target))
7980
{
8081
return;
8182
}
@@ -176,6 +177,7 @@ public override void OnInspectorGUI()
176177
}
177178
}
178179

180+
/// <inheritdoc/>
179181
protected override bool IsProfileInActiveInstance()
180182
{
181183
var profile = target as BaseMixedRealityProfile;
@@ -186,11 +188,13 @@ protected override bool IsProfileInActiveInstance()
186188

187189
#region DataProvider Inspector Utilities
188190

191+
/// <inheritdoc/>
189192
protected override SerializedProperty GetDataProviderConfigurationList()
190193
{
191194
return serializedObject.FindProperty("dataProviderConfigurations");
192195
}
193196

197+
/// <inheritdoc/>
194198
protected override ServiceConfigurationProperties GetDataProviderConfigurationProperties(SerializedProperty providerEntry)
195199
{
196200
return new ServiceConfigurationProperties()
@@ -202,6 +206,7 @@ protected override ServiceConfigurationProperties GetDataProviderConfigurationPr
202206
};
203207
}
204208

209+
/// <inheritdoc/>
205210
protected override IMixedRealityServiceConfiguration GetDataProviderConfiguration(int index)
206211
{
207212
var configurations = (target as MixedRealityInputSystemProfile)?.DataProviderConfigurations;

Assets/MixedRealityToolkit/Inspectors/Profiles/MixedRealitySpatialAwarenessSystemProfileInspector.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22
// Licensed under the MIT License. See LICENSE in the project root for license information.
33

44
using Microsoft.MixedReality.Toolkit.Editor;
5-
using Microsoft.MixedReality.Toolkit.Utilities.Editor;
65
using UnityEditor;
76
using UnityEngine;
87

98
namespace Microsoft.MixedReality.Toolkit.SpatialAwareness.Editor
109
{
1110
[CustomEditor(typeof(MixedRealitySpatialAwarenessSystemProfile))]
12-
public class MixedRealitySpatialAwarenessSystemProfileInspector : BaseDataProviderServiceInspector
11+
internal class MixedRealitySpatialAwarenessSystemProfileInspector : BaseDataProviderServiceInspector
1312
{
1413
private const string ObserverErrorMsg = "The Mixed Reality Spatial Awareness System requires one or more observers.";
1514
private static readonly GUIContent AddObserverContent = new GUIContent("+ Add Spatial Observer", "Add Spatial Observer");
@@ -18,6 +17,7 @@ public class MixedRealitySpatialAwarenessSystemProfileInspector : BaseDataProvid
1817
private const string ProfileTitle = "Spatial Awareness System Settings";
1918
private const string ProfileDescription = "The Spatial Awareness System profile allows developers to configure cross-platform environmental awareness.";
2019

20+
/// <inheritdoc/>
2121
public override void OnInspectorGUI()
2222
{
2323
if (!RenderProfileHeader(ProfileTitle, ProfileDescription, target))
@@ -38,6 +38,7 @@ public override void OnInspectorGUI()
3838
}
3939
}
4040

41+
/// <inheritdoc/>
4142
protected override bool IsProfileInActiveInstance()
4243
{
4344
var profile = target as BaseMixedRealityProfile;
@@ -48,11 +49,13 @@ protected override bool IsProfileInActiveInstance()
4849

4950
#region DataProvider Inspector Utilities
5051

52+
/// <inheritdoc/>
5153
protected override SerializedProperty GetDataProviderConfigurationList()
5254
{
5355
return serializedObject.FindProperty("observerConfigurations");
5456
}
5557

58+
/// <inheritdoc/>
5659
protected override ServiceConfigurationProperties GetDataProviderConfigurationProperties(SerializedProperty providerEntry)
5760
{
5861
return new ServiceConfigurationProperties()
@@ -64,6 +67,7 @@ protected override ServiceConfigurationProperties GetDataProviderConfigurationPr
6467
};
6568
}
6669

70+
/// <inheritdoc/>
6771
protected override IMixedRealityServiceConfiguration GetDataProviderConfiguration(int index)
6872
{
6973
var configurations = (target as MixedRealitySpatialAwarenessSystemProfile)?.ObserverConfigurations;

0 commit comments

Comments
 (0)