1
This commit is contained in:
29
Assets/Dreamteck/Splines/Editor/Primitives/CapsuleEditor.cs
Normal file
29
Assets/Dreamteck/Splines/Editor/Primitives/CapsuleEditor.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using UnityEditor;
|
||||
using Dreamteck.Splines.Editor;
|
||||
|
||||
namespace Dreamteck.Splines.Primitives
|
||||
{
|
||||
public class CapsuleEditor : PrimitiveEditor
|
||||
{
|
||||
public override string GetName()
|
||||
{
|
||||
return "Capsule";
|
||||
}
|
||||
|
||||
public override void Open(DreamteckSplinesEditor editor)
|
||||
{
|
||||
base.Open(editor);
|
||||
primitive = new Capsule();
|
||||
}
|
||||
|
||||
protected override void OnGUI()
|
||||
{
|
||||
base.OnGUI();
|
||||
Capsule capsule = (Capsule)primitive;
|
||||
capsule.radius = EditorGUILayout.FloatField("Radius", capsule.radius);
|
||||
capsule.height = EditorGUILayout.FloatField("Height", capsule.height);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 72fdbe7a4c526e048b71f939e9c0c73c
|
||||
timeCreated: 1455295805
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
32
Assets/Dreamteck/Splines/Editor/Primitives/EllipseEditor.cs
Normal file
32
Assets/Dreamteck/Splines/Editor/Primitives/EllipseEditor.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using UnityEditor;
|
||||
using Dreamteck.Splines.Editor;
|
||||
|
||||
namespace Dreamteck.Splines.Primitives
|
||||
{
|
||||
public class EllipseEditor : PrimitiveEditor
|
||||
{
|
||||
|
||||
|
||||
public override string GetName()
|
||||
{
|
||||
return "Ellipse";
|
||||
}
|
||||
|
||||
public override void Open(DreamteckSplinesEditor editor)
|
||||
{
|
||||
base.Open(editor);
|
||||
primitive = new Ellipse();
|
||||
primitive.offset = origin;
|
||||
}
|
||||
|
||||
protected override void OnGUI()
|
||||
{
|
||||
base.OnGUI();
|
||||
Ellipse ellipse = (Ellipse)primitive;
|
||||
ellipse.xRadius = EditorGUILayout.FloatField("X Radius", ellipse.xRadius);
|
||||
ellipse.yRadius = EditorGUILayout.FloatField("Y Radius", ellipse.yRadius);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dbd2c446b47926347b9b126f60e16ad8
|
||||
timeCreated: 1455295805
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
31
Assets/Dreamteck/Splines/Editor/Primitives/LineEditor.cs
Normal file
31
Assets/Dreamteck/Splines/Editor/Primitives/LineEditor.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using UnityEditor;
|
||||
using Dreamteck.Splines.Editor;
|
||||
|
||||
namespace Dreamteck.Splines.Primitives
|
||||
{
|
||||
public class LineEditor : PrimitiveEditor
|
||||
{
|
||||
public override string GetName()
|
||||
{
|
||||
return "Line";
|
||||
}
|
||||
|
||||
public override void Open(DreamteckSplinesEditor editor)
|
||||
{
|
||||
base.Open(editor);
|
||||
primitive = new Line();
|
||||
}
|
||||
|
||||
protected override void OnGUI()
|
||||
{
|
||||
base.OnGUI();
|
||||
Line line = (Line)primitive;
|
||||
line.length = EditorGUILayout.FloatField("Length", line.length);
|
||||
line.mirror = EditorGUILayout.Toggle("Mirror", line.mirror);
|
||||
line.rotation = EditorGUILayout.Vector3Field("Rotation", line.rotation);
|
||||
line.segments = EditorGUILayout.IntField("Segments", line.segments);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: db46236a6c24a02458ab53f69e482d9b
|
||||
timeCreated: 1455295805
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
30
Assets/Dreamteck/Splines/Editor/Primitives/NgonEditor.cs
Normal file
30
Assets/Dreamteck/Splines/Editor/Primitives/NgonEditor.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using UnityEditor;
|
||||
using Dreamteck.Splines.Editor;
|
||||
|
||||
namespace Dreamteck.Splines.Primitives
|
||||
{
|
||||
public class NgonEditor : PrimitiveEditor
|
||||
{
|
||||
public override string GetName()
|
||||
{
|
||||
return "Ngon";
|
||||
}
|
||||
|
||||
public override void Open(DreamteckSplinesEditor editor)
|
||||
{
|
||||
base.Open(editor);
|
||||
primitive = new Ngon();
|
||||
}
|
||||
|
||||
protected override void OnGUI()
|
||||
{
|
||||
base.OnGUI();
|
||||
Ngon ngon = (Ngon)primitive;
|
||||
ngon.radius = EditorGUILayout.FloatField("Radius", ngon.radius);
|
||||
ngon.sides = EditorGUILayout.IntField("Sides", ngon.sides);
|
||||
if (ngon.sides < 3) ngon.sides = 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 77c0bc8ac03c5ef49b19f61d6b0d5e63
|
||||
timeCreated: 1455295805
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,63 @@
|
||||
namespace Dreamteck.Splines.Primitives
|
||||
{
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System.Collections;
|
||||
using Dreamteck.Splines.Editor;
|
||||
|
||||
[System.Serializable]
|
||||
public class PrimitiveEditor
|
||||
{
|
||||
[System.NonSerialized]
|
||||
protected DreamteckSplinesEditor editor;
|
||||
[System.NonSerialized]
|
||||
public Vector3 origin = Vector3.zero;
|
||||
|
||||
protected SplinePrimitive primitive = new SplinePrimitive();
|
||||
|
||||
public virtual string GetName()
|
||||
{
|
||||
return "Primitive";
|
||||
}
|
||||
|
||||
public virtual void Open(DreamteckSplinesEditor editor)
|
||||
{
|
||||
this.editor = editor;
|
||||
primitive.is2D = editor.is2D;
|
||||
primitive.Calculate();
|
||||
}
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
EditorGUI.BeginChangeCheck();
|
||||
OnGUI();
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
Update();
|
||||
}
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
primitive.is2D = editor.is2D;
|
||||
primitive.Calculate();
|
||||
editor.SetPointsArray(primitive.GetPoints());
|
||||
editor.SetSplineType(primitive.GetSplineType());
|
||||
editor.SetSplineClosed(primitive.GetIsClosed());
|
||||
editor.ApplyModifiedProperties(true);
|
||||
}
|
||||
|
||||
protected virtual void OnGUI()
|
||||
{
|
||||
primitive.is2D = editor.is2D;
|
||||
primitive.offset = EditorGUILayout.Vector3Field("Offset", primitive.offset);
|
||||
if (editor.is2D)
|
||||
{
|
||||
float rot = primitive.rotation.z;
|
||||
rot = EditorGUILayout.FloatField("Rotation", rot);
|
||||
primitive.rotation = new Vector3(0f, 0f, rot);
|
||||
}
|
||||
else primitive.rotation = EditorGUILayout.Vector3Field("Rotation", primitive.rotation);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c64bf70078577534a9a2e5015c93459a
|
||||
timeCreated: 1455297834
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,29 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using UnityEditor;
|
||||
using Dreamteck.Splines.Editor;
|
||||
|
||||
namespace Dreamteck.Splines.Primitives
|
||||
{
|
||||
public class RectangleEditor : PrimitiveEditor
|
||||
{
|
||||
public override string GetName()
|
||||
{
|
||||
return "Rectangle";
|
||||
}
|
||||
|
||||
public override void Open(DreamteckSplinesEditor editor)
|
||||
{
|
||||
base.Open(editor);
|
||||
primitive = new Rectangle();
|
||||
primitive.offset = origin;
|
||||
}
|
||||
|
||||
protected override void OnGUI()
|
||||
{
|
||||
base.OnGUI();
|
||||
Rectangle rect = (Rectangle)primitive;
|
||||
rect.size = EditorGUILayout.Vector2Field("Size", rect.size);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0f93155830fd1d14d889c002374573e8
|
||||
timeCreated: 1455295805
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,31 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using UnityEditor;
|
||||
using Dreamteck.Splines.Editor;
|
||||
|
||||
namespace Dreamteck.Splines.Primitives
|
||||
{
|
||||
public class RoundedRectangleEditor : PrimitiveEditor
|
||||
{
|
||||
public override string GetName()
|
||||
{
|
||||
return "Rounded Rect";
|
||||
}
|
||||
|
||||
public override void Open(DreamteckSplinesEditor editor)
|
||||
{
|
||||
base.Open(editor);
|
||||
primitive = new RoundedRectangle();
|
||||
primitive.offset = origin;
|
||||
}
|
||||
|
||||
protected override void OnGUI()
|
||||
{
|
||||
base.OnGUI();
|
||||
RoundedRectangle rect = (RoundedRectangle)primitive;
|
||||
rect.size = EditorGUILayout.Vector2Field("Size", rect.size);
|
||||
rect.xRadius = EditorGUILayout.FloatField("X Radius", rect.xRadius);
|
||||
rect.yRadius = EditorGUILayout.FloatField("Y Radius", rect.yRadius);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 81b24eca83abc154581a3830334d1e26
|
||||
timeCreated: 1455295805
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
35
Assets/Dreamteck/Splines/Editor/Primitives/SpiralEditor.cs
Normal file
35
Assets/Dreamteck/Splines/Editor/Primitives/SpiralEditor.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using UnityEditor;
|
||||
using Dreamteck.Splines.Editor;
|
||||
|
||||
namespace Dreamteck.Splines.Primitives
|
||||
{
|
||||
public class SpiralEditor : PrimitiveEditor
|
||||
{
|
||||
|
||||
public override string GetName()
|
||||
{
|
||||
return "Spiral";
|
||||
}
|
||||
|
||||
public override void Open(DreamteckSplinesEditor editor)
|
||||
{
|
||||
base.Open(editor);
|
||||
primitive = new Spiral();
|
||||
}
|
||||
|
||||
protected override void OnGUI()
|
||||
{
|
||||
base.OnGUI();
|
||||
Spiral spiral = (Spiral)primitive;
|
||||
spiral.clockwise = EditorGUILayout.Toggle("Clockwise", spiral.clockwise);
|
||||
spiral.curve = EditorGUILayout.CurveField("Radius Interpolation", spiral.curve);
|
||||
spiral.startRadius = EditorGUILayout.FloatField("Start Radius", spiral.startRadius);
|
||||
spiral.endRadius = EditorGUILayout.FloatField("End Radius", spiral.endRadius);
|
||||
spiral.stretch = EditorGUILayout.FloatField("Stretch", spiral.stretch);
|
||||
spiral.iterations = EditorGUILayout.IntField("Iterations", spiral.iterations);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2c5f355b780664e408027fdc7ce5a8d4
|
||||
timeCreated: 1455295805
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
31
Assets/Dreamteck/Splines/Editor/Primitives/StarEditor.cs
Normal file
31
Assets/Dreamteck/Splines/Editor/Primitives/StarEditor.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using UnityEditor;
|
||||
using Dreamteck.Splines.Editor;
|
||||
|
||||
namespace Dreamteck.Splines.Primitives
|
||||
{
|
||||
public class StarEditor : PrimitiveEditor
|
||||
{
|
||||
public override string GetName()
|
||||
{
|
||||
return "Star";
|
||||
}
|
||||
|
||||
public override void Open(DreamteckSplinesEditor editor)
|
||||
{
|
||||
base.Open(editor);
|
||||
primitive = new Star();
|
||||
}
|
||||
|
||||
protected override void OnGUI()
|
||||
{
|
||||
base.OnGUI();
|
||||
Star star = (Star)primitive;
|
||||
star.radius = EditorGUILayout.FloatField("Radius", star.radius);
|
||||
star.depth = EditorGUILayout.FloatField("Depth", star.depth);
|
||||
star.sides = EditorGUILayout.IntField("Sides", star.sides);
|
||||
if (star.sides < 3) star.sides = 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4bb5e3d650b12b84a977fe5b175067b2
|
||||
timeCreated: 1455295805
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user