Initial commit

This commit is contained in:
AbstractConcept 2022-09-13 00:36:34 -05:00
commit 3c7cc0c973
8391 changed files with 704313 additions and 0 deletions

View file

@ -0,0 +1,39 @@
using System;
using UnityEngine;
namespace UnityEditor.U2D.Animation
{
internal class DisableUndoScope : IDisposable
{
private bool m_Disposed;
private ICacheUndo m_CacheUndo;
private IUndo m_UndoOverride;
public DisableUndoScope(ICacheUndo cacheUndo)
{
Debug.Assert(cacheUndo != null);
m_CacheUndo = cacheUndo;
m_UndoOverride = m_CacheUndo.undoOverride;
m_CacheUndo.undoOverride = new DisabledUndo();
}
~DisableUndoScope()
{
if (!m_Disposed)
Debug.LogError("Scope was not disposed! You should use the 'using' keyword or manually call Dispose.");
}
public void Dispose()
{
if (m_Disposed)
return;
m_Disposed = true;
if (m_CacheUndo != null)
m_CacheUndo.undoOverride = m_UndoOverride;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: bf06445e471002b42ad1039aee488229
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,19 @@
using UnityEngine;
namespace UnityEditor.U2D.Animation
{
internal class DisabledUndo : IUndo
{
public void RecordObject(object o, string name) {}
public void RegisterCompleteObjectUndo(object o, string name) {}
public void RegisterCompleteObjectUndo(object[] o, string name) {}
public void RegisterCreatedObjectUndo(object o, string name) {}
public void DestroyObjectImmediate(object o)
{
BaseObject.DestroyImmediate(o);
}
public void ClearUndo(object o) {}
public void IncrementCurrentGroup() {}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ccdfa7b650f4fb642b56fe417d650188
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,11 @@
namespace UnityEditor.U2D.Animation
{
internal interface ICacheUndo
{
IUndo undoOverride { get; set; }
bool isUndoOperationSet { get; }
void IncrementCurrentGroup();
void BeginUndoOperation(string name);
void EndUndoOperation();
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8cf26b17030744f44b4984670864cede
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,13 @@
namespace UnityEditor.U2D.Animation
{
internal interface IUndo
{
void RecordObject(object o, string name);
void RegisterCompleteObjectUndo(object o, string name);
void RegisterCompleteObjectUndo(object[] o, string name);
void RegisterCreatedObjectUndo(object o, string name);
void DestroyObjectImmediate(object o);
void ClearUndo(object o);
void IncrementCurrentGroup();
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ee97fb199f5d4c248b3a02ae9e3e39d5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,44 @@
using System;
using UnityEngine;
namespace UnityEditor.U2D.Animation
{
internal class UndoScope : IDisposable
{
private bool m_Disposed;
private ICacheUndo m_CacheUndo;
public UndoScope(ICacheUndo cacheUndo, string operationName, bool incrementGroup)
{
Debug.Assert(cacheUndo != null);
if(cacheUndo.isUndoOperationSet == false)
{
m_CacheUndo = cacheUndo;
if(incrementGroup)
m_CacheUndo.IncrementCurrentGroup();
m_CacheUndo.BeginUndoOperation(operationName);
}
}
~UndoScope()
{
if (!m_Disposed)
Debug.LogError("Scope was not disposed! You should use the 'using' keyword or manually call Dispose.");
}
public void Dispose()
{
if (m_Disposed)
return;
m_Disposed = true;
if (m_CacheUndo != null)
m_CacheUndo.EndUndoOperation();
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: eb14a3e61fe4b114ebd94c7d27a6a110
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,55 @@
using UnityEngine;
using Object = UnityEngine.Object;
namespace UnityEditor.U2D.Animation
{
internal class UnityEngineUndo : IUndo
{
public void RecordObject(object o, string name)
{
var obj = o as Object;
if (obj != null)
Undo.RecordObject(obj, name);
}
public void RegisterCompleteObjectUndo(object o, string name)
{
var obj = o as Object;
if (obj != null)
Undo.RegisterCompleteObjectUndo(obj, name);
}
public void RegisterCompleteObjectUndo(object[] o, string name)
{
var obj = o as Object[];
if (obj != null)
Undo.RegisterCompleteObjectUndo(obj, name);
}
public void RegisterCreatedObjectUndo(object o, string name)
{
var obj = o as Object;
if (obj != null)
Undo.RegisterCreatedObjectUndo(obj, name);
}
public void DestroyObjectImmediate(object o)
{
var obj = o as Object;
if (obj != null)
Undo.DestroyObjectImmediate(obj);
}
public void ClearUndo(object o)
{
var obj = o as Object;
if (obj != null)
Undo.ClearUndo(obj);
}
public void IncrementCurrentGroup()
{
Undo.IncrementCurrentGroup();
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 609d69ce95fbbe148aac9ed99bf92679
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: