10
10
11
11
namespace Microsoft . MixedReality . Toolkit . Utilities . Editor
12
12
{
13
- public class MixedRealityProjectConfiguratorWindow : EditorWindow
13
+ public class MixedRealityProjectConfiguratorWindow
14
14
{
15
15
private readonly Dictionary < MRConfig , bool > trackToggles = new Dictionary < MRConfig , bool > ( )
16
16
{
@@ -56,25 +56,22 @@ public class MixedRealityProjectConfiguratorWindow : EditorWindow
56
56
private readonly GUIContent LaterButtonContent = new GUIContent ( "Later" , "Do not show this pop-up notification until next session" ) ;
57
57
private readonly GUIContent IgnoreButtonContent = new GUIContent ( "Ignore" , "Modify this preference under Edit > Project Settings > Mixed Reality Toolkit" ) ;
58
58
59
- private bool showConfigurations = true ;
59
+ // private bool showConfigurations = true;
60
60
61
61
/// <summary>
62
62
/// Show the MRTK Project Configurator utility window or focus if already opened
63
63
/// </summary>
64
- [ MenuItem ( "Mixed Reality Toolkit/Utilities/Configure Unity Project" , false , 499 ) ]
65
- public static void ShowWindow ( )
64
+ public static MixedRealityProjectConfiguratorWindow GetObj ( )
66
65
{
67
66
// There should be only one configurator window open as a "pop-up". If already open, then just force focus on our instance
68
67
if ( IsOpen )
69
68
{
70
- Instance . Focus ( ) ;
69
+ return Instance ;
71
70
}
72
71
else
73
72
{
74
- var window = CreateInstance < MixedRealityProjectConfiguratorWindow > ( ) ;
75
- window . titleContent = new GUIContent ( "MRTK Project Configurator" , EditorGUIUtility . IconContent ( "_Popup" ) . image ) ;
76
- window . position = new Rect ( Screen . width / 2.0f , Screen . height / 2.0f , Default_Window_Height , Default_Window_Width ) ;
77
- window . ShowUtility ( ) ;
73
+ Instance = new MixedRealityProjectConfiguratorWindow ( ) ;
74
+ return Instance ;
78
75
}
79
76
}
80
77
@@ -95,77 +92,14 @@ private void CompilationPipeline_assemblyCompilationStarted(string obj)
95
92
// There should be only one pop-up window which is generally tracked by IsOpen
96
93
// However, when recompiling, Unity will call OnDestroy for this window but not actually destroy the editor window
97
94
// This ensure we have a clean close on recompiles when this EditorWindow was open beforehand
98
- Close ( ) ;
95
+ // Close();
99
96
}
100
-
101
- private void OnGUI ( )
102
- {
103
- MixedRealityInspectorUtility . RenderMixedRealityToolkitLogo ( ) ;
104
-
105
- string foldoutHeader ;
106
-
107
- if ( ! MixedRealityProjectConfigurator . IsProjectConfigured ( ) )
108
- {
109
- foldoutHeader = "Modify Configurations" ;
110
- RenderChoiceDialog ( ) ;
111
- }
112
- else
113
- {
114
- foldoutHeader = "Configurations" ;
115
- RenderConfiguredConfirmation ( ) ;
116
- }
117
-
118
- EditorGUILayout . Space ( ) ;
119
-
120
- showConfigurations = EditorGUILayout . Foldout ( showConfigurations , foldoutHeader , true ) ;
121
- if ( showConfigurations )
122
- {
123
- RenderConfigurations ( ) ;
124
- }
125
- }
126
-
127
- private void RenderConfiguredConfirmation ( )
128
- {
129
- const string dialogTitle = "Project Configuration Complete" ;
130
- const string dialogContent = "This Unity project is properly configured for the Mixed Reality Toolkit." ;
131
- EditorGUILayout . LabelField ( dialogTitle , EditorStyles . boldLabel ) ;
132
- EditorGUILayout . LabelField ( dialogContent ) ;
133
- }
134
-
135
- private void RenderChoiceDialog ( )
136
- {
137
- const string dialogTitle = "Apply Default Settings?" ;
138
- const string dialogContent = "The Mixed Reality Toolkit would like to auto-apply useful settings to this Unity project" ;
139
- EditorGUILayout . LabelField ( dialogTitle , EditorStyles . boldLabel ) ;
140
- EditorGUILayout . LabelField ( dialogContent ) ;
141
-
142
- using ( new EditorGUILayout . HorizontalScope ( ) )
143
- {
144
- if ( GUILayout . Button ( ApplyButtonContent ) )
145
- {
146
- ApplyConfigurations ( ) ;
147
- Close ( ) ;
148
- }
149
-
150
- if ( GUILayout . Button ( LaterButtonContent ) )
151
- {
152
- MixedRealityEditorSettings . IgnoreProjectConfigForSession = true ;
153
- Close ( ) ;
154
- }
155
-
156
- if ( GUILayout . Button ( IgnoreButtonContent ) )
157
- {
158
- MixedRealityProjectPreferences . IgnoreSettingsPrompt = true ;
159
- Close ( ) ;
160
- }
161
- }
162
- }
163
-
97
+
164
98
private Vector2 scrollPosition = Vector2 . zero ;
165
99
166
- private void RenderConfigurations ( )
100
+ public void RenderConfigurations ( )
167
101
{
168
- EditorGUILayout . LabelField ( "Enabled options will be applied to the project. Disabled items are already properly configured." ) ;
102
+ EditorGUILayout . LabelField ( "Enabled options below will be applied to the project. Disabled items are already properly configured." ) ;
169
103
EditorGUILayout . Space ( ) ;
170
104
171
105
using ( var scrollView = new EditorGUILayout . ScrollViewScope ( scrollPosition ) )
@@ -174,14 +108,17 @@ private void RenderConfigurations()
174
108
EditorGUILayout . LabelField ( "Project Settings" , EditorStyles . boldLabel ) ;
175
109
RenderToggle ( MRConfig . ForceTextSerialization , "Force text asset serialization" ) ;
176
110
RenderToggle ( MRConfig . VisibleMetaFiles , "Enable visible meta files" ) ;
177
- if ( ! MixedRealityOptimizeUtils . IsBuildTargetAndroid ( ) && ! MixedRealityOptimizeUtils . IsBuildTargetIOS ( ) && XRSettingsUtilities . IsLegacyXRActive )
111
+ if ( ! MixedRealityOptimizeUtils . IsBuildTargetAndroid ( ) && ! MixedRealityOptimizeUtils . IsBuildTargetIOS ( ) && XRSettingsUtilities . XREnabled )
178
112
{
179
113
#if ! UNITY_2019_3_OR_NEWER
180
114
RenderToggle ( MRConfig . VirtualRealitySupported , "Enable VR supported" ) ;
181
115
#endif // !UNITY_2019_3_OR_NEWER
182
116
}
183
117
#if UNITY_2019_3_OR_NEWER
184
- RenderToggle ( MRConfig . OptimalRenderingPath , "Set Single Pass Instanced rendering path (legacy XR API)" ) ;
118
+ if ( XRSettingsUtilities . LegacyXREnabled )
119
+ {
120
+ RenderToggle ( MRConfig . OptimalRenderingPath , "Set Single Pass Instanced rendering path (legacy XR API)" ) ;
121
+ }
185
122
#else
186
123
#if UNITY_ANDROID
187
124
RenderToggle ( MRConfig . OptimalRenderingPath , "Set Single Pass Stereo rendering path" ) ;
@@ -237,7 +174,7 @@ private void RenderConfigurations()
237
174
}
238
175
}
239
176
240
- private void ApplyConfigurations ( )
177
+ public void ApplyConfigurations ( )
241
178
{
242
179
var configurationFilter = new HashSet < MRConfig > ( ) ;
243
180
foreach ( var item in trackToggles )
0 commit comments