@@ -15,7 +15,9 @@ class TurnTable
15
15
{
16
16
const string MenuItemName = "FbxExporters/Turntable Review/Autoload Last Saved Prefab" ;
17
17
18
- const string ScenesPath = "Assets" ;
18
+ const string DefaultScenesPath = "Assets" ;
19
+ const string DefaultSceneName = "FbxExporters_TurnTableReview" ;
20
+
19
21
static string SceneName = "FbxExporters_TurnTableReview" ;
20
22
21
23
public const string TempSavePath = "_safe_to_delete" ;
@@ -53,7 +55,7 @@ private static System.IO.FileInfo GetLastSavedFile (string directoryPath, string
53
55
54
56
private static string GetSceneFilePath ( )
55
57
{
56
- return System . IO . Path . Combine ( ScenesPath , SceneName + ".unity" ) ;
58
+ return System . IO . Path . Combine ( DefaultScenesPath , DefaultSceneName + ".unity" ) ;
57
59
}
58
60
59
61
private static string GetLastSavedFilePath ( )
@@ -151,42 +153,31 @@ public static void LastSavedModel ()
151
153
System . Collections . Generic . List < UnityEngine . SceneManagement . Scene > scenes
152
154
= new System . Collections . Generic . List < UnityEngine . SceneManagement . Scene > ( ) ;
153
155
154
- var desiredScene = FbxExporters . EditorTools . ExportSettings . instance . turntableScene ;
155
- string desiredSceneName = null ;
156
- if ( desiredScene ) {
157
- desiredSceneName = desiredScene . name ;
156
+ string desiredSceneName = FbxExporters . EditorTools . ExportSettings . GetTurnTableSceneName ( ) ;
157
+ if ( string . IsNullOrEmpty ( desiredSceneName ) ) {
158
+ desiredSceneName = DefaultSceneName ;
158
159
}
159
160
160
- bool foundScene = false ;
161
161
for ( int i = 0 ; i < UnityEngine . SceneManagement . SceneManager . sceneCount ; i ++ ) {
162
162
UnityEngine . SceneManagement . Scene toAdd = UnityEngine . SceneManagement . SceneManager . GetSceneAt ( i ) ;
163
163
164
164
// skip Untitled scene.
165
165
// The Untitled scene cannot be unloaded, if modified, and we don't want to force the user to save it.
166
166
if ( toAdd . name == "" ) continue ;
167
167
168
- if ( desiredSceneName != null && toAdd . name == desiredSceneName ) {
168
+ if ( toAdd . name == desiredSceneName ) {
169
169
scene = toAdd ;
170
- foundScene = true ;
171
170
continue ;
172
171
}
173
172
174
- if ( ! foundScene && toAdd . name == SceneName )
175
- {
176
- scene = toAdd ;
177
- continue ;
178
- }
179
173
scenes . Add ( toAdd ) ;
180
174
}
181
175
182
176
// if turntable scene not added to list of scenes
183
- if ( ! scene . IsValid ( ) )
177
+ if ( ! scene . IsValid ( ) || ! scene . isLoaded )
184
178
{
185
- string scenePath = null ;
186
- if ( desiredScene ) {
187
- scenePath = UnityEditor . AssetDatabase . GetAssetPath ( desiredScene ) ;
188
- } else {
189
-
179
+ string scenePath = FbxExporters . EditorTools . ExportSettings . GetTurnTableScenePath ( ) ;
180
+ if ( string . IsNullOrEmpty ( scenePath ) ) {
190
181
// and if for some reason the turntable scene is missing create an empty scene
191
182
// NOTE: we cannot use NewScene because it will force me to save the modified Untitled scene
192
183
if ( ! System . IO . File . Exists ( GetSceneFilePath ( ) ) ) {
0 commit comments