Skip to content

Commit

Permalink
feat: check scene is dirty
Browse files Browse the repository at this point in the history
  • Loading branch information
L1247 committed Mar 26, 2023
1 parent b019b2f commit f5f485e
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 96 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,9 @@
using System.Linq;
using System.Reflection;
using System.Text;
using JD.AssetizerEditor;
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEditor.UIElements;
using UnityEngine;
using UnityEngine.SceneManagement;
using Object = UnityEngine.Object;

#endregion
Expand Down Expand Up @@ -558,19 +555,18 @@ private void DrawInnerSettings()

label = "OpenAsProperties";
_controlOpenAsProperties = _openAsProperties;
_openAsProperties = EditorGUILayout.Toggle(label , _openAsProperties);
// _openAsProperties = EditorGUILayout.Toggle(label , _openAsProperties);

// if (_controlOpenAsProperties != _openAsProperties)
// {
// _visualModeChanged = true;
// }

Debug.Log($"{_openAsProperties}");
if (_controlOpenAsProperties != _openAsProperties)
{
_currentSettings.OpenAsProperties = _openAsProperties;
_currentSettings.Save();
}
// if (_controlOpenAsProperties != _openAsProperties)
// {
// _currentSettings.OpenAsProperties = _openAsProperties;
// _currentSettings.Save();
// }

// label = "Visual Mode(Experimental!) : ";
// _controlVisualMode = _visualMode;
Expand Down Expand Up @@ -687,15 +683,12 @@ private void DrawProjectFinderEntries(string category)
Selection.activeObject = asset;
if (_openAsProperties)
{
OpenPropertiesEditorWindowDoubleClickListener.OpenInPropertyEditor(asset);
}
else
{
var entryIsScene = asset is SceneAsset;
var prefabType = PrefabUtility.GetPrefabType(asset);
if (entryIsScene) SaveSceneDialog(path);
else if (prefabType == PrefabType.Prefab) AssetDatabase.OpenAsset(asset);
// OpenPropertiesEditorWindowDoubleClickListener.OpenInPropertyEditor(asset);
}
var entryIsScene = asset is SceneAsset;
var prefabType = PrefabUtility.GetPrefabType(asset);
if (entryIsScene) SaveSceneDialog(path);
else if (prefabType == PrefabType.Prefab) AssetDatabase.OpenAsset(asset);
}
else OpenDir(path);
}
Expand Down Expand Up @@ -750,6 +743,12 @@ private void DrawProjectFinderEntries(string category)

private static void SaveSceneDialog(string scenePath)
{
var sceneIsDirty = EditorSceneManager.GetActiveScene().isDirty;
if (sceneIsDirty == false)
{
EditorSceneManager.OpenScene(scenePath , OpenSceneMode.Single);
return;
}
var option = EditorUtility.DisplayDialogComplex(
"Unsaved scene Changes" ,
"Do you want to save the changes you made before load new scene?" ,
Expand Down

This file was deleted.

This file was deleted.

3 changes: 3 additions & 0 deletions BookmarkEverything/Assets/Samples.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions BookmarkEverything/Assets/Samples/SO.asset
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 66fa9eb72cb841498e13510e0ec7ab87, type: 3}
m_Name: SO
m_EditorClassIdentifier:
8 changes: 8 additions & 0 deletions BookmarkEverything/Assets/Samples/SO.asset.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions BookmarkEverything/Assets/Samples/SO.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using UnityEngine;

namespace Samples
{
[UnityEngine.CreateAssetMenu(fileName = "SO" , menuName = "SO" , order = 0)]
public class SO : ScriptableObject
{

}
}
3 changes: 3 additions & 0 deletions BookmarkEverything/Assets/Samples/SO.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f5f485e

Please sign in to comment.