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,28 @@
using UnityEngine;
namespace UnityEditor.U2D.Animation
{
internal class CircleVertexSelector : ICircleSelector<int>
{
public ISelection<int> selection { get; set; }
public ISpriteMeshData spriteMeshData { get; set; }
public Vector2 position { get; set; }
public float radius { get; set; }
public void Select()
{
if(spriteMeshData == null)
return;
var sqrRadius = radius * radius;
for (int i = 0; i < spriteMeshData.vertexCount; i++)
{
if ((spriteMeshData.GetPosition(i) - position).sqrMagnitude <= sqrRadius)
{
selection.Select(i, true);
}
}
}
}
}

View file

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

View file

@ -0,0 +1,22 @@
using System;
using UnityEngine;
namespace UnityEditor.U2D.Animation
{
internal class GenericVertexSelector : ISelector<int>
{
public ISelection<int> selection { get; set; }
public ISpriteMeshData spriteMeshData { get; set; }
public Func<int, bool> SelectionCallback;
public void Select()
{
Debug.Assert(selection != null);
Debug.Assert(spriteMeshData != null);
Debug.Assert(SelectionCallback != null);
for (var i = 0; i < spriteMeshData.vertexCount; i++)
selection.Select(i, SelectionCallback(i));
}
}
}

View file

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

View file

@ -0,0 +1,9 @@
using UnityEngine;
namespace UnityEditor.U2D.Animation
{
internal interface ICircleSelector<T> : ISelector<T>
{
float radius { get; set; }
}
}

View file

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

View file

@ -0,0 +1,9 @@
using UnityEngine;
namespace UnityEditor.U2D.Animation
{
internal interface IRectSelector<T> : ISelector<T>
{
Rect rect { get; set; }
}
}

View file

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

View file

@ -0,0 +1,11 @@
using System.Collections.Generic;
namespace UnityEditor.U2D.Animation
{
internal interface ISelector<T>
{
ISelection<T> selection { get; set; }
void Select();
}
}

View file

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

View file

@ -0,0 +1,35 @@
using UnityEngine;
using System.Collections.Generic;
namespace UnityEditor.U2D.Animation
{
internal class RectBoneSelector : IRectSelector<BoneCache>
{
public ISelection<BoneCache> selection { get; set; }
public BoneCache[] bones { get; set; }
public Rect rect { get; set; }
public void Select()
{
if (bones == null)
return;
foreach (var bone in bones)
{
if (!bone.isVisible)
continue;
Vector2 p1 = bone.position;
Vector2 p2 = bone.endPosition;
Vector2 point = Vector2.zero;
if (rect.Contains(p1, true) || rect.Contains(p2, true) ||
MathUtility.SegmentIntersection(new Vector2(rect.xMin, rect.yMin), new Vector2(rect.xMax, rect.yMin), p1, p2, ref point) ||
MathUtility.SegmentIntersection(new Vector2(rect.xMax, rect.yMin), new Vector2(rect.xMax, rect.yMax), p1, p2, ref point) ||
MathUtility.SegmentIntersection(new Vector2(rect.xMax, rect.yMax), new Vector2(rect.xMin, rect.yMax), p1, p2, ref point) ||
MathUtility.SegmentIntersection(new Vector2(rect.xMin, rect.yMax), new Vector2(rect.xMin, rect.yMin), p1, p2, ref point)
)
selection.Select(bone.ToCharacterIfNeeded(), true);
}
}
}
}

View file

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

View file

@ -0,0 +1,21 @@
using UnityEngine;
using System.Collections.Generic;
namespace UnityEditor.U2D.Animation
{
internal class RectVertexSelector : IRectSelector<int>
{
public ISelection<int> selection { get; set; }
public ISpriteMeshData spriteMeshData { get; set; }
public Rect rect { get; set; }
public void Select()
{
for (int i = 0; i < spriteMeshData.vertexCount; i++)
{
if (rect.Contains(spriteMeshData.GetPosition(i), true))
selection.Select(i, true);
}
}
}
}

View file

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

View file

@ -0,0 +1,14 @@
using UnityEngine;
namespace UnityEditor.U2D.Animation
{
internal class Unselector<T> : ISelector<T>
{
public ISelection<T> selection { get; set; }
public void Select()
{
selection.Clear();
}
}
}

View file

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