Skip to content

Commit c374d34

Browse files
Updated Capability window and Auto Configure window.
Removed Redundant force text serialization script.
1 parent cf6310e commit c374d34

File tree

3 files changed

+51
-36
lines changed

3 files changed

+51
-36
lines changed

Assets/HoloToolkit/Utilities/Scripts/Editor/AutoConfigureWindow.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ private void SettingToggle(TSetting setting)
6161
/// </summary>
6262
protected virtual void Awake()
6363
{
64-
wrapStyle = new GUIStyle() { wordWrap = true };
64+
wrapStyle = new GUIStyle("label") { wordWrap = true };
6565
}
6666
protected virtual void OnEnable()
6767
{
@@ -112,7 +112,7 @@ protected virtual void OnGUI()
112112
/// <summary>
113113
/// Gets the descriptions of the settings.
114114
/// </summary>
115-
public Dictionary<TSetting, string> Descriptions
115+
protected Dictionary<TSetting, string> Descriptions
116116
{
117117
get
118118
{
@@ -128,7 +128,7 @@ public Dictionary<TSetting, string> Descriptions
128128
/// <summary>
129129
/// Gets the names of the settings.
130130
/// </summary>
131-
public Dictionary<TSetting, string> Names
131+
protected Dictionary<TSetting, string> Names
132132
{
133133
get
134134
{
@@ -144,7 +144,7 @@ public Dictionary<TSetting, string> Names
144144
/// <summary>
145145
/// Gets the values of the settings.
146146
/// </summary>
147-
public Dictionary<TSetting, bool> Values
147+
protected Dictionary<TSetting, bool> Values
148148
{
149149
get
150150
{
@@ -160,7 +160,7 @@ public Dictionary<TSetting, bool> Values
160160
/// <summary>
161161
/// Gets or sets the status message displayed at the bottom of the window.
162162
/// </summary>
163-
public string StatusMessage { get { return statusMessage; } set { statusMessage = value; } }
163+
private string StatusMessage { get { return statusMessage; } set { statusMessage = value; } }
164164
#endregion // Public Properties
165165
}
166166
}

Assets/HoloToolkit/Utilities/Scripts/Editor/CapabilitySettingsWindow.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ namespace HoloToolkit.Unity
1212
public class CapabilitySettingsWindow : AutoConfigureWindow<PlayerSettings.WSACapability>
1313
{
1414
#region Internal Methods
15+
1516
private void ApplySetting(PlayerSettings.WSACapability setting)
1617
{
1718
PlayerSettings.WSA.SetCapability(setting, Values[setting]);
@@ -30,6 +31,8 @@ protected override void ApplySettings()
3031
ApplySetting(PlayerSettings.WSACapability.SpatialPerception);
3132
ApplySetting(PlayerSettings.WSACapability.WebCam);
3233
ApplySetting(PlayerSettings.WSACapability.InternetClient);
34+
ApplySetting(PlayerSettings.WSACapability.InternetClientServer);
35+
ApplySetting(PlayerSettings.WSACapability.PrivateNetworkClientServer);
3336
}
3437

3538
protected override void LoadSettings()
@@ -38,6 +41,8 @@ protected override void LoadSettings()
3841
LoadSetting(PlayerSettings.WSACapability.SpatialPerception);
3942
LoadSetting(PlayerSettings.WSACapability.WebCam);
4043
LoadSetting(PlayerSettings.WSACapability.InternetClient);
44+
LoadSetting(PlayerSettings.WSACapability.InternetClientServer);
45+
LoadSetting(PlayerSettings.WSACapability.PrivateNetworkClientServer);
4146
}
4247

4348
protected override void LoadStrings()
@@ -53,6 +58,12 @@ protected override void LoadStrings()
5358

5459
Names[PlayerSettings.WSACapability.InternetClient] = "Internet Client";
5560
Descriptions[PlayerSettings.WSACapability.InternetClient] = "Required if your application needs to access the Internet.\n\nRecommendation: Leave unchecked unless your application uses online services.";
61+
62+
Names[PlayerSettings.WSACapability.InternetClientServer] = "Internet Client Server";
63+
Descriptions[PlayerSettings.WSACapability.InternetClientServer] = "Required if your application uses the Sharing Services.";
64+
65+
Names[PlayerSettings.WSACapability.PrivateNetworkClientServer] = "Private Network Client Server";
66+
Descriptions[PlayerSettings.WSACapability.PrivateNetworkClientServer] = "Required if your application uses the Sharing Services.";
5667
}
5768

5869
protected override void OnEnable()
@@ -61,7 +72,7 @@ protected override void OnEnable()
6172
base.OnEnable();
6273

6374
// Set size
64-
minSize = new Vector2(350, 255);
75+
minSize = new Vector2(350, 350);
6576
maxSize = minSize;
6677
}
6778
#endregion // Overrides / Event Handlers

Assets/HoloToolkit/Utilities/Scripts/Editor/ProjectSettingsWindow.cs

Lines changed: 34 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,16 @@ public enum ProjectSetting
2121
BuildWsaUwp,
2222
WsaUwpBuildToD3D,
2323
WsaFastestQuality,
24-
WsaEnableVR
24+
WsaEnableVR,
25+
SharingServices
2526
}
2627
#endregion // Nested Types
2728

2829
#region Internal Methods
2930
/// <summary>
3031
/// Enables virtual reality for WSA and ensures HoloLens is in the supported SDKs.
3132
/// </summary>
32-
private void EnableVirtualReality()
33+
private static void EnableVirtualReality()
3334
{
3435
try
3536
{
@@ -77,7 +78,7 @@ private void EnableVirtualReality()
7778
}
7879
else
7980
{
80-
// The target VR settngs were found but the others
81+
// The target VR settings were found but the others
8182
// still need to be searched for.
8283
foundBuildTargetVRSettings = true;
8384
}
@@ -119,12 +120,12 @@ private void EnableVirtualReality()
119120
// If this isn't an element in the device list
120121
if (!line.Contains("-"))
121122
{
122-
// add the hololens element, and mark it found
123+
// add the HoloLens element, and mark it found
123124
builder.Append(" - HoloLens\n");
124125
foundHoloLens = true;
125126
}
126127

127-
// Otherwise test if this is the hololens device
128+
// Otherwise test if this is the HoloLens device
128129
else if (line.Contains("HoloLens"))
129130
{
130131
foundHoloLens = true;
@@ -155,7 +156,7 @@ private void EnableVirtualReality()
155156
/// <summary>
156157
/// Modifies the WSA default quality setting to the fastest
157158
/// </summary>
158-
private void SetFastestDefaultQuality()
159+
private static void SetFastestDefaultQuality()
159160
{
160161
try
161162
{
@@ -179,46 +180,44 @@ private void SetFastestDefaultQuality()
179180
#region Overrides / Event Handlers
180181
protected override void ApplySettings()
181182
{
182-
// See the blow notes for why text asset serialization is required
183-
if (EditorSettings.serializationMode != SerializationMode.ForceText)
184-
{
185-
// NOTE: PlayerSettings.virtualRealitySupported would be ideal, except that it only reports/affects whatever platform tab
186-
// is currently selected in the Player settings window. As we don't have code control over what view is selected there
187-
// this property is fairly useless from script.
188-
189-
// NOTE: There is no current way to change the default quality setting from script
190-
191-
string dialogTitle = "Updates require text serialization of assets";
192-
string message = "Unity doesn't provide apis for updating the default quality or enabling VR support.\n\n" +
193-
"Is it ok if we force text serialization of assets so that we can modify the properties directly?";
194-
195-
bool forceText = EditorUtility.DisplayDialog(dialogTitle, message, "Yes", "No");
196-
if (!forceText)
197-
{
198-
return;
199-
}
200-
201-
EditorSettings.serializationMode = SerializationMode.ForceText;
202-
}
203-
204183
// Apply individual settings
205184
if (Values[ProjectSetting.BuildWsaUwp])
206185
{
207186
EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.WSA, BuildTarget.WSAPlayer);
208187
}
188+
209189
if (Values[ProjectSetting.WsaUwpBuildToD3D])
210190
{
211191
EditorUserBuildSettings.wsaUWPBuildType = WSAUWPBuildType.D3D;
212192
}
193+
213194
if (Values[ProjectSetting.WsaFastestQuality])
214195
{
215196
SetFastestDefaultQuality();
216197
}
198+
217199
if (Values[ProjectSetting.WsaEnableVR])
218200
{
219201
EnableVirtualReality();
220202
}
221203

204+
if (Values[ProjectSetting.SharingServices])
205+
{
206+
PlayerSettings.WSA.SetCapability(PlayerSettings.WSACapability.Microphone, true);
207+
PlayerSettings.WSA.SetCapability(PlayerSettings.WSACapability.InternetClient, true);
208+
PlayerSettings.WSA.SetCapability(PlayerSettings.WSACapability.SpatialPerception, true);
209+
PlayerSettings.WSA.SetCapability(PlayerSettings.WSACapability.InternetClientServer, true);
210+
PlayerSettings.WSA.SetCapability(PlayerSettings.WSACapability.PrivateNetworkClientServer, true);
211+
}
212+
else
213+
{
214+
PlayerSettings.WSA.SetCapability(PlayerSettings.WSACapability.Microphone, false);
215+
PlayerSettings.WSA.SetCapability(PlayerSettings.WSACapability.InternetClient, false);
216+
PlayerSettings.WSA.SetCapability(PlayerSettings.WSACapability.SpatialPerception, false);
217+
PlayerSettings.WSA.SetCapability(PlayerSettings.WSACapability.InternetClientServer, false);
218+
PlayerSettings.WSA.SetCapability(PlayerSettings.WSACapability.PrivateNetworkClientServer, false);
219+
}
220+
222221
// Since we went behind Unity's back to tweak some settings we
223222
// need to reload the project to have them take effect
224223
bool canReload = EditorUtility.DisplayDialog(
@@ -235,7 +234,7 @@ protected override void ApplySettings()
235234

236235
protected override void LoadSettings()
237236
{
238-
for (int i = (int)ProjectSetting.BuildWsaUwp; i <= (int)ProjectSetting.WsaEnableVR; i++)
237+
for (int i = (int)ProjectSetting.BuildWsaUwp; i <= (int)ProjectSetting.SharingServices; i++)
239238
{
240239
Values[(ProjectSetting)i] = true;
241240
}
@@ -254,6 +253,11 @@ protected override void LoadStrings()
254253

255254
Names[ProjectSetting.WsaEnableVR] = "Enable VR";
256255
Descriptions[ProjectSetting.WsaEnableVR] = "Required\n\nEnables VR for Windows Store apps and adds the HoloLens as a target VR device.\n\nThe application will not compile for HoloLens and tools like Holographic Remoting will not function without this enabled. Therefore this option should remain checked unless you plan to manually perform these steps later.";
256+
257+
Names[ProjectSetting.SharingServices] = "Enable Sharing Services";
258+
Descriptions[ProjectSetting.SharingServices] = "Enables the use of the Sharing Services in your project.\n\n" +
259+
"Requires the SpatialPerception, InternetClient, InternetClientServer, PrivateNetworkClientServer, and Microphone Capabilities.\n\n" +
260+
"Start the Sharing Server though HoloToolkit->Sharing Service->Launch Sharing Service.";
257261
}
258262

259263
protected override void OnEnable()
@@ -262,7 +266,7 @@ protected override void OnEnable()
262266
base.OnEnable();
263267

264268
// Set size
265-
minSize = new Vector2(350, 260);
269+
minSize = new Vector2(350, 350);
266270
maxSize = minSize;
267271
}
268272
#endregion // Overrides / Event Handlers

0 commit comments

Comments
 (0)