├── Editor.meta ├── Editor ├── CurveHandle.cs ├── CurveHandle.cs.meta ├── CustomHandle.cs ├── CustomHandle.cs.meta ├── CustomHandleUtility.cs ├── CustomHandleUtility.cs.meta ├── DrawPerformances.cs ├── DrawPerformances.cs.meta ├── Free2DMoveHandle.cs ├── Free2DMoveHandle.cs.meta ├── HandlesExtended.cs ├── HandlesExtended.cs.meta ├── HandlesMaterials.cs ├── HandlesMaterials.cs.meta ├── KeyframeExtension.cs ├── KeyframeExtension.cs.meta ├── KeyframeHandle.cs ├── KeyframeHandle.cs.meta ├── MeshPreviewHandle.cs └── MeshPreviewHandle.cs.meta ├── ExamplesScenes.meta ├── ExamplesScenes ├── BasicHandles.unity ├── BasicHandles.unity.meta ├── CurveScriptableObject.cs ├── CurveScriptableObject.cs.meta ├── Editor.meta ├── Editor │ ├── CurveScriptableObjectEditor.cs │ ├── CurveScriptableObjectEditor.cs.meta │ ├── HandlesExampleWindow.cs │ ├── HandlesExampleWindow.cs.meta │ ├── SnapHandleEditor.cs │ └── SnapHandleEditor.cs.meta ├── curves.meta └── curves │ ├── curve1.asset │ ├── curve1.asset.meta │ ├── curve2.asset │ ├── curve2.asset.meta │ ├── curve3.asset │ ├── curve3.asset.meta │ ├── curve4.asset │ ├── curve4.asset.meta │ ├── curve5.asset │ └── curve5.asset.meta ├── LICENSE ├── LICENSE.meta ├── README.md ├── README.md.meta ├── Resources.meta ├── Resources ├── Materials.meta ├── Materials │ ├── None.mat │ ├── None.mat.meta │ ├── defaultMat.mat │ └── defaultMat.mat.meta ├── OverlayColorHandle.mat ├── OverlayColorHandle.mat.meta ├── SnapToolArrow.obj ├── SnapToolArrow.obj.meta ├── cylinder.mtl ├── cylinder.mtl.meta ├── cylinder.obj ├── cylinder.obj.meta ├── default.prefab ├── default.prefab.meta ├── normal.png ├── normal.png.meta ├── selected.png ├── selected.png.meta ├── snapToolHandle.mtl ├── snapToolHandle.mtl.meta ├── snapToolHandle.obj ├── snapToolHandle.obj.meta ├── texturedMaterial.mat ├── texturedMaterial.mat.meta ├── vertexColorMaterial.mat └── vertexColorMaterial.mat.meta ├── Shaders.meta └── Shaders ├── OverlayColorHandle.shader ├── OverlayColorHandle.shader.meta ├── TexturedHandle.shader ├── TexturedHandle.shader.meta ├── VertexColorHandle.shader └── VertexColorHandle.shader.meta /Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dc5cb69c52bcc42fb913af908789ffd4 3 | folderAsset: yes 4 | timeCreated: 1510262899 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Editor/CurveHandle.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEditor; 5 | 6 | namespace BetterHandles 7 | { 8 | public class CurveHandle : CustomHandle 9 | { 10 | public Gradient curveGradient; 11 | public float width; 12 | public float height; 13 | 14 | public int curveSamples = 100; 15 | 16 | public int selectedKeyframeIndex { get; private set; } 17 | 18 | KeyframeHandle keyframeHandle = new KeyframeHandle(); 19 | bool mouseOverCurveEdge = false; 20 | float mouseCurveEdgeDst; 21 | const float mouseOverEdgeDstThreshold = .05f; 22 | 23 | Vector3 currentMouseWorld; 24 | 25 | public CurveHandle() 26 | { 27 | selectedKeyframeIndex = -1; 28 | } 29 | 30 | public AnimationCurve DrawHandle(AnimationCurve curve) 31 | { 32 | AnimationCurve ret; 33 | 34 | //Update the mouse world position: 35 | Ray r = HandleUtility.GUIPointToWorldRay(e.mousePosition); 36 | if (CustomHandleUtility.GetPointOnPlane(matrix, r, out currentMouseWorld)) 37 | currentMouseWorld = matrix.inverse.MultiplyPoint3x4(currentMouseWorld); 38 | 39 | if (e.type == EventType.Repaint) 40 | { 41 | PushGLContext(); 42 | DrawBorders(); 43 | DrawCurve(curve); 44 | DrawLabels(curve); 45 | PopGLContext(); 46 | } 47 | 48 | //draw curve handles: 49 | ret = DrawCurvePointsHandle(curve); 50 | 51 | if (e.type == EventType.MouseDown && e.button == 0 && mouseOverCurveEdge) 52 | { 53 | ret = AddCurveKeyframe(curve); 54 | e.Use(); 55 | } 56 | 57 | return ret; 58 | } 59 | 60 | void PushGLContext() 61 | { 62 | GL.PushMatrix(); 63 | GL.MultMatrix(matrix); 64 | HandlesMaterials.vertexColor.SetPass(0); 65 | } 66 | 67 | void PopGLContext() 68 | { 69 | GL.PopMatrix(); 70 | } 71 | 72 | void DrawBorders() 73 | { 74 | //hummm good (or not so) legacy OpenGL ... 75 | 76 | Vector3 bottomLeft = Vector3.zero; 77 | Vector3 bottomRight = new Vector3(width, 0, 0); 78 | Vector3 topLeft = new Vector3(0, height, 0); 79 | Vector3 topRight = new Vector3(width, height, 0); 80 | 81 | GL.Begin(GL.LINE_STRIP); 82 | { 83 | HandlesMaterials.vertexColor.SetPass(0); 84 | GL.Color(Color.black); 85 | GL.Vertex(bottomLeft); 86 | GL.Vertex(bottomRight); 87 | GL.Vertex(topRight); 88 | GL.Vertex(topLeft); 89 | GL.Vertex(bottomLeft); 90 | } 91 | GL.End(); 92 | } 93 | 94 | void DrawCurveQuad(AnimationCurve curve, float f0, float f1) 95 | { 96 | Vector3 bottomLeft = new Vector3(f0 * width, 0, 0); 97 | Vector3 topLeft = new Vector3(f0 * width, curve.Evaluate(f0) * height, 0); 98 | Vector3 topRight = new Vector3(f1 * width, curve.Evaluate(f1) * height, 0); 99 | Vector3 bottomRight = new Vector3(f1 * width, 0, 0); 100 | 101 | //check if the mouse is near frmo the curve edge: 102 | float dst = HandleUtility.DistancePointToLineSegment(currentMouseWorld, topLeft, topRight); 103 | 104 | if (dst < mouseCurveEdgeDst) 105 | mouseCurveEdgeDst = dst; 106 | 107 | if (dst < mouseOverEdgeDstThreshold) 108 | mouseOverCurveEdge = true; 109 | 110 | GL.Color(curveGradient.Evaluate(f0)); 111 | GL.Vertex(bottomLeft); 112 | GL.Vertex(topLeft); 113 | GL.Color(curveGradient.Evaluate(f1)); 114 | GL.Vertex(topRight); 115 | GL.Vertex(bottomRight); 116 | } 117 | 118 | void DrawCurveEdge(AnimationCurve curve, float f0, float f1) 119 | { 120 | Vector3 topLeft = new Vector3(f0 * width, curve.Evaluate(f0) * height, 0); 121 | Vector3 topRight = new Vector3(f1 * width, curve.Evaluate(f1) * height, 0); 122 | Color c1 = curveGradient.Evaluate(f0); 123 | Color c2 = curveGradient.Evaluate(f1); 124 | 125 | c1.a = 1; 126 | c2.a = 1; 127 | GL.Color(c1); 128 | GL.Vertex(topLeft); 129 | GL.Color(c2); 130 | GL.Vertex(topRight); 131 | } 132 | 133 | void DrawLabels(AnimationCurve curve) 134 | { 135 | Handles.Label(matrix.MultiplyPoint3x4(Vector3.zero), "0"); 136 | 137 | foreach (var key in curve.keys) 138 | { 139 | //draw key time: 140 | Vector3 timePosition = matrix.MultiplyPoint3x4(Vector3.right * key.time * width); 141 | Handles.Label(timePosition, key.time.ToString("F2")); 142 | 143 | //draw key value: 144 | Vector3 valuePosition = matrix.MultiplyPoint3x4(Vector3.up * key.value * height + Vector3.left * .1f); 145 | Handles.Label(valuePosition, key.value.ToString("F2")); 146 | } 147 | } 148 | 149 | AnimationCurve AddCurveKeyframe(AnimationCurve curve) 150 | { 151 | AnimationCurve ret = new AnimationCurve(curve.keys); 152 | Vector2 point = currentMouseWorld; 153 | 154 | float time = point.x / width; 155 | float value = point.y / height; 156 | 157 | Keyframe newKey = new Keyframe(time, value); 158 | 159 | GUI.changed = true; 160 | 161 | selectedKeyframeIndex = ret.AddKey(newKey); 162 | 163 | return ret; 164 | } 165 | 166 | AnimationCurve DrawCurvePointsHandle(AnimationCurve curve) 167 | { 168 | AnimationCurve ret = curve; 169 | 170 | if (curve == null) 171 | return null; 172 | 173 | keyframeHandle.SetTransform(this); 174 | keyframeHandle.SetCurve(curve); 175 | 176 | for (int i = 0; i < curve.length; i++) 177 | { 178 | Keyframe keyframe = curve.keys[i]; 179 | Keyframe movedKeyframe; 180 | 181 | movedKeyframe = keyframeHandle.DrawHandle(new Vector2(width, height), keyframe, .03f, i != 0, i != curve.length - 1); 182 | 183 | if (selectedKeyframeIndex == i) 184 | { 185 | EditorGUIUtility.keyboardControl = keyframeHandle.pointHandle.controlId; 186 | EditorGUIUtility.hotControl = keyframeHandle.pointHandle.controlId; 187 | selectedKeyframeIndex = -1; 188 | } 189 | 190 | //it the key have been moved 191 | if (!keyframe.Equal(movedKeyframe)) 192 | { 193 | //we duplicate the curve to return another modified one: 194 | ret = new AnimationCurve(curve.keys); 195 | ret.MoveKey(i, movedKeyframe); 196 | } 197 | } 198 | 199 | return ret; 200 | } 201 | 202 | void DrawCurve(AnimationCurve curve) 203 | { 204 | if (curveSamples < 0 || curveSamples > 10000) 205 | return ; 206 | 207 | //We use this function to calcul if the mouse is over the curve edge too 208 | mouseCurveEdgeDst = 1e20f; 209 | mouseOverCurveEdge = false; 210 | 211 | //draw curve 212 | GL.Begin(GL.QUADS); 213 | { 214 | 215 | for (int i = 0; i < curveSamples; i++) 216 | { 217 | float f0 = (float)i / (float)curveSamples; 218 | float f1 = (float)(i + 1) / (float)curveSamples; 219 | 220 | DrawCurveQuad(curve, f0, f1); 221 | } 222 | } 223 | GL.End(); 224 | 225 | //if mouse is near the curve edge, we draw it 226 | if (mouseOverCurveEdge) 227 | { 228 | GL.Begin(GL.LINES); 229 | { 230 | for (int i = 0; i < curveSamples; i++) 231 | { 232 | float f0 = (float)i / (float)curveSamples; 233 | float f1 = (float)(i + 1) / (float)curveSamples; 234 | 235 | DrawCurveEdge(curve, f0, f1); 236 | } 237 | } 238 | GL.End(); 239 | } 240 | } 241 | 242 | public void SetColors(Color startColor, Color endColor) 243 | { 244 | curveGradient = new Gradient(); 245 | GradientColorKey[] colorKeys = new GradientColorKey[2]{new GradientColorKey(startColor, 0), new GradientColorKey(endColor, 1)}; 246 | GradientAlphaKey[] alphaKeys = new GradientAlphaKey[2]{new GradientAlphaKey(startColor.a, 0), new GradientAlphaKey(endColor.a, 1)}; 247 | 248 | curveGradient.SetKeys(colorKeys, alphaKeys); 249 | } 250 | 251 | public void SetColors(Gradient gradient) 252 | { 253 | if (gradient != null) 254 | curveGradient = gradient; 255 | } 256 | 257 | public void Set2DSize(Vector2 size) { Set2DSize(size.x, size.y); } 258 | public void Set2DSize(float width, float height) 259 | { 260 | this.width = width; 261 | this.height = height; 262 | } 263 | } 264 | } -------------------------------------------------------------------------------- /Editor/CurveHandle.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 975b17e80645b4329a7f346f4ed06f7b 3 | timeCreated: 1510324617 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/CustomHandle.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | namespace BetterHandles 6 | { 7 | public class CustomHandle 8 | { 9 | Quaternion rotation = Quaternion.identity; 10 | Vector3 scale = Vector3.one; 11 | Vector3 position; 12 | 13 | public Matrix4x4 matrix = Matrix4x4.identity; 14 | public Event e { get { return Event.current; } } 15 | 16 | public void SetTransform(Transform transform) 17 | { 18 | rotation = transform.rotation; 19 | position = transform.position; 20 | scale = transform.localScale; 21 | matrix = Matrix4x4.TRS(position, rotation, scale); 22 | } 23 | 24 | public void SetTransform(Vector3 position, Quaternion rotation, Vector3 scale) 25 | { 26 | this.rotation = rotation; 27 | this.position = position; 28 | this.scale = scale; 29 | matrix = Matrix4x4.TRS(position, rotation, scale); 30 | } 31 | 32 | public void SetTransform(CustomHandle handle) 33 | { 34 | this.rotation = Quaternion.LookRotation( 35 | handle.matrix.GetColumn(2), 36 | handle.matrix.GetColumn(1) 37 | ); 38 | this.position = handle.matrix.GetColumn(3); 39 | this.scale = new Vector3( 40 | handle.matrix.GetColumn(0).magnitude, 41 | handle.matrix.GetColumn(1).magnitude, 42 | handle.matrix.GetColumn(2).magnitude 43 | ); 44 | 45 | matrix = Matrix4x4.TRS(position, rotation, scale); 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /Editor/CustomHandle.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0a5e8c34d73d144138d604007bb9b2b5 3 | timeCreated: 1510329205 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/CustomHandleUtility.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEditor; 5 | 6 | public static class CustomHandleUtility 7 | { 8 | public static bool GetPointOnPlane(Matrix4x4 planeTransform, Ray ray, out Vector3 position) 9 | { 10 | float dist; 11 | position = Vector3.zero; 12 | Plane p = new Plane(planeTransform * Vector3.forward, planeTransform.MultiplyPoint3x4(position)); 13 | 14 | p.Raycast(ray, out dist); 15 | 16 | if (dist < 0) 17 | return false; 18 | 19 | position = ray.GetPoint(dist); 20 | 21 | return true; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Editor/CustomHandleUtility.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ca5f52b2499d94b1c9531fa913017863 3 | timeCreated: 1510529163 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/DrawPerformances.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using BetterHandles; 5 | using UnityEngine.Profiling; 6 | using UnityEditor; 7 | 8 | public class DrawPerformances : CustomHandle 9 | { 10 | List< Vector3 > vertices; 11 | 12 | public void Init() 13 | { 14 | vertices = new List< Vector3 >(); 15 | 16 | for (int i = 0; i < 3 * 10000; i++) 17 | vertices.Add(new Vector3(Random.value * 20, Random.value * 20, Random.value * 20)); 18 | } 19 | 20 | public void Test() 21 | { 22 | DrawHandle(true, vertices, MeshTopology.Triangles); 23 | DrawHandle(false, vertices, MeshTopology.Triangles); 24 | } 25 | 26 | public void DrawHandle(bool useMesh, List< Vector3 > vertices, MeshTopology topology) 27 | { 28 | if (e.type != EventType.Repaint) 29 | return ; 30 | 31 | if (useMesh) 32 | DrawMesh(vertices, topology); 33 | else 34 | DrawGL(vertices, topology); 35 | 36 | SceneView.RepaintAll(); 37 | } 38 | 39 | void DrawMesh(List< Vector3 > vertices, MeshTopology topology) 40 | { 41 | Profiler.BeginSample("Mesh draw"); 42 | Mesh m = new Mesh(); 43 | int[] indices = new int[vertices.Count]; 44 | 45 | for (int i = 0; i < vertices.Count; i++) 46 | { 47 | indices[i] = i; 48 | } 49 | 50 | m.SetVertices(vertices); 51 | m.SetIndices(indices, topology, 0); 52 | 53 | HandlesMaterials.vertexColor.SetPass(0); 54 | Graphics.DrawMeshNow(m, Vector3.right * 30, Quaternion.identity); 55 | Profiler.EndSample(); 56 | } 57 | 58 | void DrawGL(List< Vector3 > vertices, MeshTopology topology) 59 | { 60 | HandlesMaterials.vertexColor.SetPass(0); 61 | Profiler.BeginSample("GL draw"); 62 | GL.Begin(GL.TRIANGLES); 63 | { 64 | foreach (var vert in vertices) 65 | GL.Vertex(vert); 66 | } 67 | GL.End(); 68 | Profiler.EndSample(); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /Editor/DrawPerformances.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 842173e0848414a5f999edf1dc72acb5 3 | timeCreated: 1511357672 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Free2DMoveHandle.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEditor; 5 | 6 | namespace BetterHandles 7 | { 8 | public class Free2DMoveHandle : CustomHandle 9 | { 10 | public Texture2D texture = EditorGUIUtility.whiteTexture; 11 | public Texture2D hoveredTexture = null; 12 | public Texture2D selectedTexture = null; 13 | public Color color = Handles.color; 14 | public Color hoveredColor = Handles.preselectionColor; 15 | public Color selectedColor = Handles.selectedColor; 16 | public bool faceCamera = true; 17 | 18 | public float distance { get; private set; } 19 | public int controlId { get; private set; } 20 | 21 | int free2DMoveHandleHash = "Free2DMoveHandle".GetHashCode(); 22 | bool hovered = false; 23 | bool selected = false; 24 | 25 | public Vector2 DrawHandle(Vector2 position, float size) 26 | { 27 | return DrawHandle(EditorGUIUtility.GetControlID(free2DMoveHandleHash, FocusType.Keyboard), position, size); 28 | } 29 | 30 | public Vector2 DrawHandle(int controlId, Vector2 position, float size) 31 | { 32 | this.controlId = controlId; 33 | selected = GUIUtility.hotControl == controlId || GUIUtility.keyboardControl == controlId; 34 | hovered = HandleUtility.nearestControl == controlId; 35 | 36 | switch (e.type) 37 | { 38 | case EventType.MouseDown: 39 | if (HandleUtility.nearestControl == controlId && e.button == 0) 40 | { 41 | GUIUtility.hotControl = controlId; 42 | GUIUtility.keyboardControl = controlId; 43 | e.Use(); 44 | } 45 | break ; 46 | case EventType.MouseUp: 47 | if (GUIUtility.hotControl == controlId && (e.button == 0 || e.button == 2)) 48 | { 49 | GUIUtility.hotControl = 0; 50 | e.Use(); 51 | } 52 | break ; 53 | case EventType.MouseDrag: 54 | if (selected) 55 | Move2DHandle(ref position); 56 | break ; 57 | case EventType.Repaint: 58 | DrawDot(position, size); 59 | break ; 60 | case EventType.Layout: 61 | if (e.type == EventType.Layout) 62 | SceneView.RepaintAll(); 63 | Vector3 pointWorldPos = matrix.MultiplyPoint3x4(position); 64 | distance = HandleUtility.DistanceToRectangle(pointWorldPos, Camera.current.transform.rotation, size); 65 | HandleUtility.AddControl(controlId, distance); 66 | break ; 67 | } 68 | 69 | return position; 70 | } 71 | 72 | void DrawDot(Vector2 position, float size) 73 | { 74 | Vector3 worldPos = matrix.MultiplyPoint3x4(position); 75 | Vector3 camRight; 76 | Vector3 camUp; 77 | 78 | if (faceCamera) 79 | { 80 | camRight = Camera.current.transform.right * size; 81 | camUp = Camera.current.transform.up * size; 82 | } 83 | else 84 | { 85 | camRight = matrix.MultiplyPoint3x4(Vector3.right) * size; 86 | camUp = matrix.MultiplyPoint3x4(Vector3.up) * size; 87 | } 88 | 89 | Texture2D t = texture; 90 | Color c = (t == null) ? color : Color.white; 91 | 92 | if (selected && selectedTexture == null) 93 | c = selectedColor; 94 | else if (hovered && hoveredTexture == null) 95 | c = hoveredColor; 96 | 97 | if (selected && selectedTexture != null) 98 | t = selectedTexture; 99 | else if (hovered && hoveredTexture != null) 100 | t = hoveredTexture; 101 | 102 | HandlesMaterials.textured.SetColor("_Color", c); 103 | HandlesMaterials.textured.SetTexture("_MainTex", t); 104 | HandlesMaterials.textured.SetPass(0); 105 | GL.Begin(GL.QUADS); 106 | { 107 | GL.TexCoord2(1, 1); 108 | GL.Vertex(worldPos + camRight + camUp); 109 | GL.TexCoord2(1, 0); 110 | GL.Vertex(worldPos + camRight - camUp); 111 | GL.TexCoord2(0, 0); 112 | GL.Vertex(worldPos - camRight - camUp); 113 | GL.TexCoord2(0, 1); 114 | GL.Vertex(worldPos - camRight + camUp); 115 | } 116 | GL.End(); 117 | } 118 | 119 | bool GetMousePositionInWorld(out Vector3 position) 120 | { 121 | Ray r = HandleUtility.GUIPointToWorldRay(e.mousePosition); 122 | return CustomHandleUtility.GetPointOnPlane(matrix, r, out position); 123 | } 124 | 125 | void Move2DHandle(ref Vector2 position) 126 | { 127 | Vector3 mouseWorldPos; 128 | if (GetMousePositionInWorld(out mouseWorldPos)) 129 | { 130 | Vector3 pointOnPlane = matrix.inverse.MultiplyPoint3x4(mouseWorldPos); 131 | 132 | if (e.delta != Vector2.zero) 133 | GUI.changed = true; 134 | 135 | position = pointOnPlane; 136 | } 137 | } 138 | 139 | } 140 | } -------------------------------------------------------------------------------- /Editor/Free2DMoveHandle.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 707bd723125d04966b34b341afadb190 3 | timeCreated: 1510441629 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/HandlesExtended.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEditor; 5 | using UnityEditor.IMGUI.Controls; 6 | using BetterHandles; 7 | 8 | public static class HandlesExtended 9 | { 10 | 11 | #region Handes Draw Functions 12 | 13 | public static void DrawScaledCap(Handles.CapFunction capFunction, Vector3 center, Quaternion rotation, Vector3 size, Color color) 14 | { 15 | Handles.color = color; 16 | 17 | Matrix4x4 scaleMatrix = Matrix4x4.Scale(size); 18 | 19 | using (new Handles.DrawingScope(scaleMatrix)) 20 | { 21 | capFunction(0, center, rotation, 1, EventType.Repaint); 22 | } 23 | } 24 | 25 | public static void DrawWireCube(Vector3 center, Quaternion rotation, Vector3 size) { DrawWireCube(center, rotation, size, Handles.color); } 26 | public static void DrawWireCube(Vector3 center, Quaternion rotation, Vector3 size, Color color) 27 | { 28 | Matrix4x4 rotationMatrix = Matrix4x4.Rotate(rotation); 29 | 30 | Handles.color = color; 31 | 32 | using (new Handles.DrawingScope(rotationMatrix)) 33 | { 34 | Handles.DrawWireCube(center, size); 35 | } 36 | } 37 | 38 | public static void DrawSolidCube(Vector3 center, Quaternion rotation, Vector3 size) { DrawSolidCube(center, rotation, size, Handles.color); } 39 | public static void DrawSolidCube(Vector3 center, Quaternion rotation, Vector3 size, Color color) 40 | { 41 | DrawScaledCap(Handles.CubeHandleCap, center, rotation, size, color); 42 | } 43 | 44 | public static void DrawCylinder(Vector3 center, Quaternion rotation, Vector3 size) { DrawCylinder(center, rotation, size, Handles.color); } 45 | public static void DrawCylinder(Vector3 center, Quaternion rotation, Vector3 size, Color color) 46 | { 47 | DrawScaledCap(Handles.CylinderHandleCap, center, rotation, size, color); 48 | } 49 | 50 | public static void DrawCone(Vector3 center, Quaternion rotation, Vector3 size) { DrawCone(center, rotation, size, Handles.color); } 51 | public static void DrawCone(Vector3 center, Quaternion rotation, Vector3 size, Color color) 52 | { 53 | DrawScaledCap(Handles.ConeHandleCap, center, rotation, size, color); 54 | } 55 | 56 | public static void DrawCircle(Vector3 center, Quaternion rotation, Vector3 size) { DrawCircle(center, rotation, size, Handles.color); } 57 | public static void DrawCircle(Vector3 center, Quaternion rotation, Vector3 size, Color color) 58 | { 59 | DrawScaledCap(Handles.CircleHandleCap, center, rotation, size, color); 60 | } 61 | 62 | public static void DrawArrow(Vector3 center, Quaternion rotation, Vector3 size) { DrawArrow(center, rotation, size, Handles.color); } 63 | public static void DrawArrow(Vector3 center, Quaternion rotation, Vector3 size, Color color) 64 | { 65 | DrawScaledCap(Handles.ArrowHandleCap, center, rotation, size, color); 66 | } 67 | 68 | public static void DrawRectange(Vector3 center, Quaternion rotation, Vector3 size) { DrawRectange(center, rotation, size, Handles.color); } 69 | public static void DrawRectange(Vector3 center, Quaternion rotation, Vector3 size, Color color) 70 | { 71 | DrawScaledCap(Handles.RectangleHandleCap, center, rotation, size, color); 72 | } 73 | 74 | public static void DrawSphere(Vector3 center, Quaternion rotation, Vector3 size) { DrawSphere(center, rotation, size, Handles.color); } 75 | public static void DrawSphere(Vector3 center, Quaternion rotation, Vector3 size, Color color) 76 | { 77 | DrawScaledCap(Handles.SphereHandleCap, center, rotation, size, color); 78 | } 79 | 80 | #endregion 81 | 82 | #region Handles controls Functions 83 | 84 | static ArcHandle arcHandle = new ArcHandle(); 85 | static BoxBoundsHandle boxBoundsHandle = new BoxBoundsHandle(); 86 | static CapsuleBoundsHandle capsuleBoundsHandle = new CapsuleBoundsHandle(); 87 | static JointAngularLimitHandle jointAngularLimitHandle = new JointAngularLimitHandle(); 88 | static SphereBoundsHandle sphereBoundsHandle = new SphereBoundsHandle(); 89 | 90 | public static void ArcHandle(Vector3 center, Quaternion rotation, Vector3 size, ref float angle, ref float radius) { ArcHandle(center, rotation, size, ref angle, ref radius, arcHandle.fillColor, arcHandle.wireframeColor); } 91 | public static void ArcHandle(Vector3 center, Quaternion rotation, Vector3 size, ref float angle, ref float radius, Color fillColor, Color wireframeColor) 92 | { 93 | Matrix4x4 trs = Matrix4x4.TRS(center, rotation, size); 94 | 95 | using (new Handles.DrawingScope(trs)) 96 | { 97 | arcHandle.angle = angle; 98 | arcHandle.radius = radius; 99 | arcHandle.radiusHandleColor = Color.white; 100 | arcHandle.fillColor = fillColor; 101 | arcHandle.wireframeColor = wireframeColor; 102 | arcHandle.DrawHandle(); 103 | angle = arcHandle.angle; 104 | radius = arcHandle.radius; 105 | } 106 | } 107 | 108 | public static void BoxBoundsHandle(Vector3 center, Quaternion rotation, Vector3 size, ref Vector3 boxSize) { BoxBoundsHandle(center, rotation, size, ref boxSize, PrimitiveBoundsHandle.Axes.All); } 109 | public static void BoxBoundsHandle(Vector3 center, Quaternion rotation, Vector3 size, ref Vector3 boxSize, PrimitiveBoundsHandle.Axes handleAxes) { BoxBoundsHandle(center, rotation, size, ref boxSize, handleAxes, boxBoundsHandle.wireframeColor, boxBoundsHandle.handleColor); } 110 | public static void BoxBoundsHandle(Vector3 center, Quaternion rotation, Vector3 size, ref Vector3 boxSize, PrimitiveBoundsHandle.Axes handleAxes, Color wireframeColor, Color handleColor) 111 | { 112 | Matrix4x4 trs = Matrix4x4.TRS(center, rotation, size); 113 | 114 | using (new Handles.DrawingScope(trs)) 115 | { 116 | boxBoundsHandle.axes = handleAxes; 117 | boxBoundsHandle.size = boxSize; 118 | boxBoundsHandle.handleColor = handleColor; 119 | boxBoundsHandle.wireframeColor = wireframeColor; 120 | boxBoundsHandle.DrawHandle(); 121 | boxSize = boxBoundsHandle.size; 122 | } 123 | } 124 | 125 | public static void CapsuleBoundsHandle(Vector3 center, Quaternion rotation, Vector3 size, ref float height, ref float radius) { CapsuleBoundsHandle(center, rotation, size, ref height, ref radius, capsuleBoundsHandle.heightAxis, PrimitiveBoundsHandle.Axes.All); } 126 | public static void CapsuleBoundsHandle(Vector3 center, Quaternion rotation, Vector3 size, ref float height, ref float radius,CapsuleBoundsHandle.HeightAxis heightAxis, PrimitiveBoundsHandle.Axes handleAxes) { CapsuleBoundsHandle(center, rotation, size, ref height, ref radius, heightAxis, handleAxes, capsuleBoundsHandle.handleColor, capsuleBoundsHandle.wireframeColor); } 127 | public static void CapsuleBoundsHandle(Vector3 center, Quaternion rotation, Vector3 size, ref float height, ref float radius, CapsuleBoundsHandle.HeightAxis heightAxis, PrimitiveBoundsHandle.Axes handleAxes, Color handleColor, Color wireframeColor) 128 | { 129 | Matrix4x4 trs = Matrix4x4.TRS(center, rotation, size); 130 | 131 | using (new Handles.DrawingScope(trs)) 132 | { 133 | capsuleBoundsHandle.heightAxis = heightAxis; 134 | capsuleBoundsHandle.axes = handleAxes; 135 | capsuleBoundsHandle.radius = radius; 136 | capsuleBoundsHandle.height = height; 137 | capsuleBoundsHandle.handleColor = handleColor; 138 | capsuleBoundsHandle.wireframeColor = wireframeColor; 139 | capsuleBoundsHandle.DrawHandle(); 140 | radius = capsuleBoundsHandle.radius; 141 | height = capsuleBoundsHandle.height; 142 | } 143 | } 144 | 145 | public static void JointAngularLimitHandle(Vector3 center, Quaternion rotation, Vector3 size, ref Vector3 minAngles, ref Vector3 maxAngles) { JointAngularLimitHandle(center, rotation, size, ref minAngles, ref maxAngles, jointAngularLimitHandle.xHandleColor, jointAngularLimitHandle.yHandleColor, jointAngularLimitHandle.zHandleColor); } 146 | public static void JointAngularLimitHandle(Vector3 center, Quaternion rotation, Vector3 size, ref Vector3 minAngles, ref Vector3 maxAngles, Color xHandleColor, Color yHandleColor, Color zHandleColor) 147 | { 148 | Matrix4x4 trs = Matrix4x4.TRS(center, rotation, size); 149 | 150 | using (new Handles.DrawingScope(trs)) 151 | { 152 | jointAngularLimitHandle.xHandleColor = xHandleColor; 153 | jointAngularLimitHandle.yHandleColor = yHandleColor; 154 | jointAngularLimitHandle.zHandleColor = zHandleColor; 155 | 156 | jointAngularLimitHandle.xMin = minAngles.x; 157 | jointAngularLimitHandle.yMin = minAngles.y; 158 | jointAngularLimitHandle.zMin = minAngles.z; 159 | jointAngularLimitHandle.xMax = maxAngles.x; 160 | jointAngularLimitHandle.yMax = maxAngles.y; 161 | jointAngularLimitHandle.zMax = maxAngles.z; 162 | 163 | jointAngularLimitHandle.DrawHandle(); 164 | 165 | minAngles.x = jointAngularLimitHandle.xMin; 166 | minAngles.y = jointAngularLimitHandle.yMin; 167 | minAngles.z = jointAngularLimitHandle.zMin; 168 | maxAngles.x = jointAngularLimitHandle.xMax; 169 | maxAngles.y = jointAngularLimitHandle.yMax; 170 | maxAngles.z = jointAngularLimitHandle.zMax; 171 | } 172 | } 173 | 174 | public static void SphereBoundsHandle(Vector3 center, Quaternion rotation, Vector3 size, ref float radius) { SphereBoundsHandle(center, rotation, size, ref radius, PrimitiveBoundsHandle.Axes.All); } 175 | public static void SphereBoundsHandle(Vector3 center, Quaternion rotation, Vector3 size, ref float radius, PrimitiveBoundsHandle.Axes handleAxes) { SphereBoundsHandle(center, rotation, size, ref radius, handleAxes, sphereBoundsHandle.handleColor, sphereBoundsHandle.wireframeColor); } 176 | public static void SphereBoundsHandle(Vector3 center, Quaternion rotation, Vector3 size, ref float radius, PrimitiveBoundsHandle.Axes handleAxes, Color handleColor, Color wireframeColor) 177 | { 178 | Matrix4x4 trs = Matrix4x4.TRS(center, rotation, size); 179 | 180 | using (new Handles.DrawingScope(trs)) 181 | { 182 | sphereBoundsHandle.radius = radius; 183 | 184 | sphereBoundsHandle.axes = handleAxes; 185 | sphereBoundsHandle.wireframeColor = wireframeColor; 186 | sphereBoundsHandle.handleColor = handleColor; 187 | 188 | sphereBoundsHandle.DrawHandle(); 189 | 190 | radius = sphereBoundsHandle.radius; 191 | } 192 | } 193 | 194 | #endregion 195 | 196 | #region Full custom handles (sources included) 197 | 198 | static CurveHandle curveHandle = new CurveHandle(); 199 | static KeyframeHandle keyframeHandle = new KeyframeHandle(); 200 | static Free2DMoveHandle free2DMoveHandle = new Free2DMoveHandle(); 201 | 202 | public static void CurveHandle(float width, float height, AnimationCurve curve, Vector3 position, Quaternion rotation, Color startColor, Color endColor) 203 | { 204 | curveHandle.matrix = Matrix4x4.TRS(position, rotation, Vector3.one); 205 | curveHandle.SetColors(startColor, endColor); 206 | curveHandle.Set2DSize(width, height); 207 | curveHandle.DrawHandle(curve); 208 | } 209 | 210 | public static void KeyframeHandle(float width, float height, ref Keyframe keyframe, Vector3 position, Quaternion rotation, Color pointColor, Color tangentColor) 211 | { 212 | keyframeHandle.matrix = Matrix4x4.TRS(position, rotation, Vector3.one); 213 | keyframeHandle.pointColor = pointColor; 214 | keyframeHandle.tangentColor = tangentColor; 215 | 216 | keyframe = keyframeHandle.DrawHandle(new Vector2(width, height), keyframe, .03f); 217 | } 218 | 219 | public static void Free2DMoveHandle(ref Vector2 position, float size, Quaternion rotation, Color color, Color selectedColor) 220 | { 221 | free2DMoveHandle.matrix = Matrix4x4.TRS(Vector3.zero, rotation, Vector3.one); 222 | free2DMoveHandle.color = color; 223 | free2DMoveHandle.selectedColor = selectedColor; 224 | free2DMoveHandle.faceCamera = true; 225 | free2DMoveHandle.texture = null; 226 | free2DMoveHandle.selectedTexture = null; 227 | free2DMoveHandle.hoveredTexture = null; 228 | position = free2DMoveHandle.DrawHandle(position, size); 229 | } 230 | 231 | public static void Free2DMoveHandle(ref Vector2 position, float size, Quaternion rotation, Texture2D texture = null, Texture2D selectedTexture = null, Texture2D hoverTexture = null) 232 | { 233 | free2DMoveHandle.matrix = Matrix4x4.TRS(Vector3.zero, rotation, Vector3.one); 234 | free2DMoveHandle.texture = texture; 235 | free2DMoveHandle.selectedTexture = selectedTexture; 236 | free2DMoveHandle.hoveredTexture = hoverTexture; 237 | free2DMoveHandle.faceCamera = false; 238 | position = free2DMoveHandle.DrawHandle(position, size); 239 | } 240 | 241 | #endregion 242 | 243 | } 244 | -------------------------------------------------------------------------------- /Editor/HandlesExtended.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 43b233df82ea74264a66141c99a58db9 3 | timeCreated: 1510269532 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/HandlesMaterials.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | namespace BetterHandles 6 | { 7 | public static class HandlesMaterials 8 | { 9 | public static Material vertexColor; 10 | public static Material textured; 11 | public static Material overlayColor; 12 | 13 | static HandlesMaterials() 14 | { 15 | vertexColor = Resources.Load< Material >("VertexColorMaterial"); 16 | textured = Resources.Load< Material >("TexturedMaterial"); 17 | overlayColor = Resources.Load< Material >("OverlayColorHandle"); 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /Editor/HandlesMaterials.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 84828fad20316494b8d68c473ef553bd 3 | timeCreated: 1510327206 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/KeyframeExtension.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public static class KeyframeExtension 6 | { 7 | public static bool Equal(this Keyframe k1, Keyframe k2) 8 | { 9 | return (k1.time == k2.time && k1.value == k2.value && k1.inTangent == k2.inTangent && k1.outTangent == k2.outTangent); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Editor/KeyframeExtension.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 90f52b0825e6b44578c387c0804ab194 3 | timeCreated: 1511472874 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/KeyframeHandle.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEditor; 5 | using System.Linq; 6 | using System; 7 | 8 | namespace BetterHandles 9 | { 10 | public class KeyframeHandle : CustomHandle 11 | { 12 | public Color pointColor; 13 | public Color tangentColor; 14 | public Color wireColor = Color.green; 15 | public float tangentHandleSpacing = .3f; 16 | public float tangentHandleScale = .75f; 17 | 18 | public Free2DMoveHandle pointHandle = new Free2DMoveHandle(); 19 | public Free2DMoveHandle tangentHandle = new Free2DMoveHandle(); 20 | 21 | readonly int mainHandleHash = "mainCurve2Dhandle".GetHashCode(); 22 | readonly int tangentHandleHash = "tangentCurve2Dhandle".GetHashCode(); 23 | 24 | AnimationCurve curve = null; 25 | 26 | public enum TangentDirection 27 | { 28 | In, 29 | Out, 30 | } 31 | 32 | public Keyframe DrawHandle(Vector2 zone, Keyframe keyframe, float size, bool rightEditable = true, bool leftEditable = true) 33 | { 34 | if (e.type == EventType.MouseDown) 35 | { 36 | //we add the context menu when right clicking on the point Handle: 37 | if (HandleUtility.nearestControl == pointHandle.controlId && e.button == 1) 38 | KeyframeContextMenu(keyframe); 39 | } 40 | 41 | return DrawKeyframeHandle(zone, keyframe, size, rightEditable, leftEditable); 42 | } 43 | 44 | public void SetCurve(AnimationCurve curve) 45 | { 46 | this.curve = curve; 47 | } 48 | 49 | Vector2 TangentToDirection(float radTangent) 50 | { 51 | if (float.IsInfinity(radTangent)) 52 | return new Vector2(0, -tangentHandleSpacing); 53 | return (new Vector2(1f, radTangent)).normalized * tangentHandleSpacing; 54 | } 55 | 56 | float DirectionToTangent(Vector2 direction, TangentDirection tangentDirection) 57 | { 58 | if (tangentDirection == TangentDirection.In && direction.x > 0.0001f) 59 | return float.PositiveInfinity; 60 | if (tangentDirection == TangentDirection.Out && direction.x < -0.0001f) 61 | return float.PositiveInfinity; 62 | 63 | return direction.y / direction.x; 64 | } 65 | 66 | bool IsSelected(int controlId) 67 | { 68 | return (EditorGUIUtility.hotControl == controlId || EditorGUIUtility.keyboardControl == controlId); 69 | } 70 | 71 | Keyframe DrawKeyframeHandle(Vector2 zone, Keyframe keyframe, float size, bool rightEditable, bool leftEditable) 72 | { 73 | pointHandle.SetTransform(this); 74 | tangentHandle.SetTransform(this); 75 | 76 | int pointControlId = EditorGUIUtility.GetControlID(mainHandleHash, FocusType.Keyboard); 77 | int inTangentControlId = EditorGUIUtility.GetControlID(tangentHandleHash, FocusType.Keyboard); 78 | int outTangentControlId = EditorGUIUtility.GetControlID(tangentHandleHash, FocusType.Keyboard); 79 | 80 | // Debug.Log("hotContorl: " + EditorGUIUtility.keyboardControl + ", " + outTangentControlId + ", " + inTangentControlId + ", selected: " + selected); 81 | 82 | //point position 83 | Vector2 keyframePosition = new Vector2(zone.x * keyframe.time, zone.y * keyframe.value); 84 | 85 | //tangent positions: 86 | Vector2 inTangentPosition = -TangentToDirection(keyframe.inTangent); 87 | Vector2 outTangentPosition = TangentToDirection(keyframe.outTangent); 88 | 89 | if (e.type == EventType.Repaint) 90 | { 91 | //tangent Wires: 92 | HandlesMaterials.vertexColor.SetPass(0); 93 | GL.Begin(GL.LINES); 94 | { 95 | GL.Color(wireColor); 96 | if (rightEditable) 97 | { 98 | GL.Vertex(matrix.MultiplyPoint3x4(keyframePosition)); 99 | GL.Vertex(matrix.MultiplyPoint3x4(inTangentPosition + keyframePosition)); 100 | } 101 | if (leftEditable) 102 | { 103 | GL.Vertex(matrix.MultiplyPoint3x4(keyframePosition)); 104 | GL.Vertex(matrix.MultiplyPoint3x4(outTangentPosition + keyframePosition)); 105 | } 106 | } 107 | GL.End(); 108 | } 109 | 110 | //draw main point Handle 111 | keyframePosition = pointHandle.DrawHandle(pointControlId, keyframePosition, size); 112 | 113 | //draw tangents Handles 114 | inTangentPosition += keyframePosition; 115 | outTangentPosition += keyframePosition; 116 | 117 | if (rightEditable) 118 | { 119 | inTangentPosition = tangentHandle.DrawHandle(inTangentControlId, inTangentPosition, size * tangentHandleScale); 120 | keyframe.inTangent = DirectionToTangent(inTangentPosition - keyframePosition, TangentDirection.In); 121 | } 122 | if (leftEditable) 123 | { 124 | outTangentPosition = tangentHandle.DrawHandle(outTangentControlId, outTangentPosition, size * tangentHandleScale); 125 | keyframe.outTangent = DirectionToTangent(outTangentPosition - keyframePosition, TangentDirection.Out); 126 | } 127 | 128 | //set back keyframe values 129 | keyframe.time = keyframePosition.x / zone.x; 130 | keyframe.value = keyframePosition.y / zone.y; 131 | 132 | return keyframe; 133 | } 134 | 135 | void KeyframeContextMenu(Keyframe keyframe) 136 | { 137 | GenericMenu menu = new GenericMenu(); 138 | 139 | if (curve != null) 140 | { 141 | int keyframeIndex = curve.keys.ToList().FindIndex(k => k.Equal(keyframe)) - 1; 142 | 143 | Action< bool, string, AnimationUtility.TangentMode > SetTangentModeMenu = (right, text, tangentMode) => { 144 | menu.AddItem(new GUIContent(text), false, () => { 145 | if (right) 146 | AnimationUtility.SetKeyRightTangentMode(curve, keyframeIndex, tangentMode); 147 | else 148 | AnimationUtility.SetKeyLeftTangentMode(curve, keyframeIndex, tangentMode); 149 | GUI.changed = true; 150 | }); 151 | }; 152 | SetTangentModeMenu(false, "Left Tangent/Auto", AnimationUtility.TangentMode.Auto); 153 | SetTangentModeMenu(false, "Left Tangent/ClampedAuto", AnimationUtility.TangentMode.ClampedAuto); 154 | SetTangentModeMenu(false, "Left Tangent/Constant", AnimationUtility.TangentMode.Constant); 155 | SetTangentModeMenu(false, "Left Tangent/Free", AnimationUtility.TangentMode.Free); 156 | SetTangentModeMenu(false, "Left Tangent/Linear", AnimationUtility.TangentMode.Linear); 157 | SetTangentModeMenu(true, "Right Tangent/Auto", AnimationUtility.TangentMode.Auto); 158 | SetTangentModeMenu(true, "Right Tangent/ClampedAuto", AnimationUtility.TangentMode.ClampedAuto); 159 | SetTangentModeMenu(true, "Right Tangent/Constant", AnimationUtility.TangentMode.Constant); 160 | SetTangentModeMenu(true, "Right Tangent/Free", AnimationUtility.TangentMode.Free); 161 | SetTangentModeMenu(true, "Right Tangent/Linear", AnimationUtility.TangentMode.Linear); 162 | 163 | menu.AddItem(new GUIContent("remove"), false, () => { 164 | GUI.changed = true; 165 | if (keyframeIndex == -1) 166 | keyframeIndex = curve.keys.Length - 1; 167 | curve.RemoveKey(keyframeIndex); 168 | }); 169 | } 170 | else 171 | menu.AddDisabledItem(new GUIContent("Curve not set for keyframe !")); 172 | menu.ShowAsContext(); 173 | } 174 | } 175 | } -------------------------------------------------------------------------------- /Editor/KeyframeHandle.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 600ffc26153804debb0bc98380d02f2e 3 | timeCreated: 1510399615 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/MeshPreviewHandle.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEditor; 5 | using BetterHandles; 6 | 7 | public class MeshPreviewHandle : CustomHandle 8 | { 9 | int meshPreviewHash = "MeshPreviewHandle".GetHashCode(); 10 | 11 | struct MeshInfo 12 | { 13 | public Mesh mesh; 14 | public Matrix4x4 trs; 15 | public Material material; 16 | 17 | public MeshInfo(Mesh mesh, Matrix4x4 trs, Material material) 18 | { 19 | this.mesh = mesh; 20 | this.material = material; 21 | this.trs = trs; 22 | } 23 | } 24 | 25 | Dictionary< int, MeshInfo > meshInfos = new Dictionary< int, MeshInfo >(); 26 | 27 | Mesh currentMesh; 28 | Matrix4x4 currentTRS; 29 | 30 | public void DrawHandle(Mesh mesh, Material material, Vector3 position, Quaternion rotation, Vector3 scale) 31 | { 32 | int controlId = EditorGUIUtility.GetControlID(meshPreviewHash, FocusType.Passive); 33 | Matrix4x4 trs = Matrix4x4.TRS(position, rotation, scale); 34 | meshInfos[controlId] = new MeshInfo(mesh, trs, material); 35 | 36 | Handles.FreeMoveHandle(controlId, position, rotation, 0f, Vector3.zero, MeshHandleCap); 37 | } 38 | 39 | public void MeshHandleCap(int controlId, Vector3 position, Quaternion rotation, float size, EventType eventType) 40 | { 41 | MeshInfo meshInfo = meshInfos[controlId]; 42 | 43 | if (eventType == EventType.Repaint) 44 | { 45 | meshInfo.material.SetPass(0); 46 | Graphics.DrawMeshNow(meshInfo.mesh, meshInfo.trs); 47 | } 48 | else if (eventType == EventType.Layout) 49 | { 50 | Ray mouseRay = HandleUtility.GUIPointToWorldRay(e.mousePosition); 51 | bool intersect = meshInfo.mesh.bounds.IntersectRay(mouseRay); 52 | if (intersect) 53 | HandleUtility.AddControl(controlId, 0); 54 | else 55 | HandleUtility.AddControl(controlId, 1e20f); 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Editor/MeshPreviewHandle.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a38c2c8ee751f474db70ae9fe4a512b8 3 | timeCreated: 1511221635 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /ExamplesScenes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: be1edd24e8eb4489f94ad5af232d3716 3 | folderAsset: yes 4 | timeCreated: 1510263819 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /ExamplesScenes/BasicHandles.unity: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!29 &1 4 | OcclusionCullingSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_OcclusionBakeSettings: 8 | smallestOccluder: 5 9 | smallestHole: 0.25 10 | backfaceThreshold: 100 11 | m_SceneGUID: 00000000000000000000000000000000 12 | m_OcclusionCullingData: {fileID: 0} 13 | --- !u!104 &2 14 | RenderSettings: 15 | m_ObjectHideFlags: 0 16 | serializedVersion: 8 17 | m_Fog: 0 18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.01 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} 24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} 25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 0 28 | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} 29 | m_SkyboxMaterial: {fileID: 2100000, guid: 860a66ca4259b384f9ec01b687f71c3c, type: 2} 30 | m_HaloStrength: 0.5 31 | m_FlareStrength: 1 32 | m_FlareFadeSpeed: 3 33 | m_HaloTexture: {fileID: 0} 34 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} 35 | m_DefaultReflectionMode: 0 36 | m_DefaultReflectionResolution: 128 37 | m_ReflectionBounces: 1 38 | m_ReflectionIntensity: 1 39 | m_CustomReflection: {fileID: 0} 40 | m_Sun: {fileID: 0} 41 | m_IndirectSpecularColor: {r: 0.043447554, g: 0.041848034, b: 0.04488241, a: 1} 42 | --- !u!157 &3 43 | LightmapSettings: 44 | m_ObjectHideFlags: 0 45 | serializedVersion: 11 46 | m_GIWorkflowMode: 0 47 | m_GISettings: 48 | serializedVersion: 2 49 | m_BounceScale: 1 50 | m_IndirectOutputScale: 1 51 | m_AlbedoBoost: 1 52 | m_TemporalCoherenceThreshold: 1 53 | m_EnvironmentLightingMode: 0 54 | m_EnableBakedLightmaps: 1 55 | m_EnableRealtimeLightmaps: 1 56 | m_LightmapEditorSettings: 57 | serializedVersion: 9 58 | m_Resolution: 2 59 | m_BakeResolution: 40 60 | m_TextureWidth: 1024 61 | m_TextureHeight: 1024 62 | m_AO: 0 63 | m_AOMaxDistance: 1 64 | m_CompAOExponent: 1 65 | m_CompAOExponentDirect: 0 66 | m_Padding: 2 67 | m_LightmapParameters: {fileID: 0} 68 | m_LightmapsBakeMode: 1 69 | m_TextureCompression: 1 70 | m_FinalGather: 0 71 | m_FinalGatherFiltering: 1 72 | m_FinalGatherRayCount: 256 73 | m_ReflectionCompression: 2 74 | m_MixedBakeMode: 2 75 | m_BakeBackend: 0 76 | m_PVRSampling: 1 77 | m_PVRDirectSampleCount: 32 78 | m_PVRSampleCount: 500 79 | m_PVRBounces: 2 80 | m_PVRFilterTypeDirect: 0 81 | m_PVRFilterTypeIndirect: 0 82 | m_PVRFilterTypeAO: 0 83 | m_PVRFilteringMode: 1 84 | m_PVRCulling: 1 85 | m_PVRFilteringGaussRadiusDirect: 1 86 | m_PVRFilteringGaussRadiusIndirect: 5 87 | m_PVRFilteringGaussRadiusAO: 2 88 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 89 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 90 | m_PVRFilteringAtrousPositionSigmaAO: 1 91 | m_LightingDataAsset: {fileID: 0} 92 | m_UseShadowmask: 1 93 | --- !u!196 &4 94 | NavMeshSettings: 95 | serializedVersion: 2 96 | m_ObjectHideFlags: 0 97 | m_BuildSettings: 98 | serializedVersion: 2 99 | agentTypeID: 0 100 | agentRadius: 0.5 101 | agentHeight: 2 102 | agentSlope: 45 103 | agentClimb: 0.4 104 | ledgeDropHeight: 0 105 | maxJumpAcrossDistance: 0 106 | minRegionArea: 2 107 | manualCellSize: 0 108 | cellSize: 0.16666667 109 | manualTileSize: 0 110 | tileSize: 256 111 | accuratePlacement: 0 112 | debug: 113 | m_Flags: 0 114 | m_NavMeshData: {fileID: 0} 115 | --- !u!1 &56076083 116 | GameObject: 117 | m_ObjectHideFlags: 0 118 | m_PrefabParentObject: {fileID: 0} 119 | m_PrefabInternal: {fileID: 0} 120 | serializedVersion: 5 121 | m_Component: 122 | - component: {fileID: 56076087} 123 | - component: {fileID: 56076086} 124 | - component: {fileID: 56076085} 125 | - component: {fileID: 56076084} 126 | - component: {fileID: 56076088} 127 | m_Layer: 0 128 | m_Name: Main Camera 129 | m_TagString: MainCamera 130 | m_Icon: {fileID: 0} 131 | m_NavMeshLayer: 0 132 | m_StaticEditorFlags: 0 133 | m_IsActive: 1 134 | --- !u!81 &56076084 135 | AudioListener: 136 | m_ObjectHideFlags: 0 137 | m_PrefabParentObject: {fileID: 0} 138 | m_PrefabInternal: {fileID: 0} 139 | m_GameObject: {fileID: 56076083} 140 | m_Enabled: 1 141 | --- !u!124 &56076085 142 | Behaviour: 143 | m_ObjectHideFlags: 0 144 | m_PrefabParentObject: {fileID: 0} 145 | m_PrefabInternal: {fileID: 0} 146 | m_GameObject: {fileID: 56076083} 147 | m_Enabled: 1 148 | --- !u!20 &56076086 149 | Camera: 150 | m_ObjectHideFlags: 0 151 | m_PrefabParentObject: {fileID: 0} 152 | m_PrefabInternal: {fileID: 0} 153 | m_GameObject: {fileID: 56076083} 154 | m_Enabled: 1 155 | serializedVersion: 2 156 | m_ClearFlags: 1 157 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} 158 | m_NormalizedViewPortRect: 159 | serializedVersion: 2 160 | x: 0 161 | y: 0 162 | width: 1 163 | height: 1 164 | near clip plane: 0.3 165 | far clip plane: 1000 166 | field of view: 60 167 | orthographic: 0 168 | orthographic size: 5 169 | m_Depth: -1 170 | m_CullingMask: 171 | serializedVersion: 2 172 | m_Bits: 4294967295 173 | m_RenderingPath: -1 174 | m_TargetTexture: {fileID: 0} 175 | m_TargetDisplay: 0 176 | m_TargetEye: 3 177 | m_HDR: 1 178 | m_AllowMSAA: 1 179 | m_ForceIntoRT: 0 180 | m_OcclusionCulling: 1 181 | m_StereoConvergence: 10 182 | m_StereoSeparation: 0.022 183 | --- !u!4 &56076087 184 | Transform: 185 | m_ObjectHideFlags: 0 186 | m_PrefabParentObject: {fileID: 0} 187 | m_PrefabInternal: {fileID: 0} 188 | m_GameObject: {fileID: 56076083} 189 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 190 | m_LocalPosition: {x: -11.2, y: 1, z: -10} 191 | m_LocalScale: {x: 1, y: 1, z: 1} 192 | m_Children: [] 193 | m_Father: {fileID: 0} 194 | m_RootOrder: 0 195 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 196 | --- !u!45 &56076088 197 | Skybox: 198 | m_ObjectHideFlags: 0 199 | m_PrefabParentObject: {fileID: 0} 200 | m_PrefabInternal: {fileID: 0} 201 | m_GameObject: {fileID: 56076083} 202 | m_Enabled: 1 203 | m_CustomSkybox: {fileID: 2100000, guid: 860a66ca4259b384f9ec01b687f71c3c, type: 2} 204 | --- !u!1 &68830444 205 | GameObject: 206 | m_ObjectHideFlags: 0 207 | m_PrefabParentObject: {fileID: 0} 208 | m_PrefabInternal: {fileID: 0} 209 | serializedVersion: 5 210 | m_Component: 211 | - component: {fileID: 68830448} 212 | - component: {fileID: 68830447} 213 | - component: {fileID: 68830445} 214 | m_Layer: 0 215 | m_Name: Cube 216 | m_TagString: Untagged 217 | m_Icon: {fileID: 0} 218 | m_NavMeshLayer: 0 219 | m_StaticEditorFlags: 0 220 | m_IsActive: 1 221 | --- !u!23 &68830445 222 | MeshRenderer: 223 | m_ObjectHideFlags: 0 224 | m_PrefabParentObject: {fileID: 0} 225 | m_PrefabInternal: {fileID: 0} 226 | m_GameObject: {fileID: 68830444} 227 | m_Enabled: 1 228 | m_CastShadows: 1 229 | m_ReceiveShadows: 1 230 | m_DynamicOccludee: 1 231 | m_MotionVectors: 1 232 | m_LightProbeUsage: 1 233 | m_ReflectionProbeUsage: 1 234 | m_Materials: 235 | - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} 236 | m_StaticBatchInfo: 237 | firstSubMesh: 0 238 | subMeshCount: 0 239 | m_StaticBatchRoot: {fileID: 0} 240 | m_ProbeAnchor: {fileID: 0} 241 | m_LightProbeVolumeOverride: {fileID: 0} 242 | m_ScaleInLightmap: 1 243 | m_PreserveUVs: 1 244 | m_IgnoreNormalsForChartDetection: 0 245 | m_ImportantGI: 0 246 | m_StitchLightmapSeams: 0 247 | m_SelectedEditorRenderState: 3 248 | m_MinimumChartSize: 4 249 | m_AutoUVMaxDistance: 0.5 250 | m_AutoUVMaxAngle: 89 251 | m_LightmapParameters: {fileID: 0} 252 | m_SortingLayerID: 0 253 | m_SortingLayer: 0 254 | m_SortingOrder: 0 255 | --- !u!33 &68830447 256 | MeshFilter: 257 | m_ObjectHideFlags: 0 258 | m_PrefabParentObject: {fileID: 0} 259 | m_PrefabInternal: {fileID: 0} 260 | m_GameObject: {fileID: 68830444} 261 | m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} 262 | --- !u!4 &68830448 263 | Transform: 264 | m_ObjectHideFlags: 0 265 | m_PrefabParentObject: {fileID: 0} 266 | m_PrefabInternal: {fileID: 0} 267 | m_GameObject: {fileID: 68830444} 268 | m_LocalRotation: {x: 0.38268343, y: 0, z: 0, w: 0.92387956} 269 | m_LocalPosition: {x: 3.6786275, y: 0.009540021, z: -1.0655398} 270 | m_LocalScale: {x: 1, y: 1, z: 1} 271 | m_Children: [] 272 | m_Father: {fileID: 0} 273 | m_RootOrder: 2 274 | m_LocalEulerAnglesHint: {x: 45, y: 0, z: 0} 275 | --- !u!1 &1248301270 276 | GameObject: 277 | m_ObjectHideFlags: 0 278 | m_PrefabParentObject: {fileID: 0} 279 | m_PrefabInternal: {fileID: 0} 280 | serializedVersion: 5 281 | m_Component: 282 | - component: {fileID: 1248301271} 283 | m_Layer: 0 284 | m_Name: showHandles 285 | m_TagString: Untagged 286 | m_Icon: {fileID: 0} 287 | m_NavMeshLayer: 0 288 | m_StaticEditorFlags: 0 289 | m_IsActive: 1 290 | --- !u!4 &1248301271 291 | Transform: 292 | m_ObjectHideFlags: 0 293 | m_PrefabParentObject: {fileID: 0} 294 | m_PrefabInternal: {fileID: 0} 295 | m_GameObject: {fileID: 1248301270} 296 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 297 | m_LocalPosition: {x: 0, y: 0, z: 0} 298 | m_LocalScale: {x: 1, y: 1, z: 1} 299 | m_Children: [] 300 | m_Father: {fileID: 0} 301 | m_RootOrder: 1 302 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 303 | --- !u!1 &1586994006 304 | GameObject: 305 | m_ObjectHideFlags: 0 306 | m_PrefabParentObject: {fileID: 0} 307 | m_PrefabInternal: {fileID: 0} 308 | serializedVersion: 5 309 | m_Component: 310 | - component: {fileID: 1586994008} 311 | - component: {fileID: 1586994007} 312 | m_Layer: 0 313 | m_Name: Directional light 314 | m_TagString: Untagged 315 | m_Icon: {fileID: 0} 316 | m_NavMeshLayer: 0 317 | m_StaticEditorFlags: 0 318 | m_IsActive: 1 319 | --- !u!108 &1586994007 320 | Light: 321 | m_ObjectHideFlags: 0 322 | m_PrefabParentObject: {fileID: 0} 323 | m_PrefabInternal: {fileID: 0} 324 | m_GameObject: {fileID: 1586994006} 325 | m_Enabled: 1 326 | serializedVersion: 8 327 | m_Type: 1 328 | m_Color: {r: 1, g: 1, b: 1, a: 1} 329 | m_Intensity: 1 330 | m_Range: 10 331 | m_SpotAngle: 30 332 | m_CookieSize: 10 333 | m_Shadows: 334 | m_Type: 0 335 | m_Resolution: -1 336 | m_CustomResolution: -1 337 | m_Strength: 1 338 | m_Bias: 0.05 339 | m_NormalBias: 0.4 340 | m_NearPlane: 0.2 341 | m_Cookie: {fileID: 0} 342 | m_DrawHalo: 0 343 | m_Flare: {fileID: 0} 344 | m_RenderMode: 0 345 | m_CullingMask: 346 | serializedVersion: 2 347 | m_Bits: 4294967295 348 | m_Lightmapping: 4 349 | m_AreaSize: {x: 1, y: 1} 350 | m_BounceIntensity: 1 351 | m_ColorTemperature: 6570 352 | m_UseColorTemperature: 0 353 | m_ShadowRadius: 0 354 | m_ShadowAngle: 0 355 | --- !u!4 &1586994008 356 | Transform: 357 | m_ObjectHideFlags: 0 358 | m_PrefabParentObject: {fileID: 0} 359 | m_PrefabInternal: {fileID: 0} 360 | m_GameObject: {fileID: 1586994006} 361 | m_LocalRotation: {x: 0.5045439, y: -0.23069301, z: 0.50454736, w: 0.6615499} 362 | m_LocalPosition: {x: 13.78, y: -0.63, z: -9.9} 363 | m_LocalScale: {x: 1, y: 1, z: 1} 364 | m_Children: [] 365 | m_Father: {fileID: 0} 366 | m_RootOrder: 3 367 | m_LocalEulerAnglesHint: {x: 64.205, y: 27.941002, z: 92.406006} 368 | -------------------------------------------------------------------------------- /ExamplesScenes/BasicHandles.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f1a3a83a334a34b668297109ca2c5e99 3 | timeCreated: 1510263846 4 | licenseType: Free 5 | DefaultImporter: 6 | externalObjects: {} 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /ExamplesScenes/CurveScriptableObject.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class CurveScriptableObject : ScriptableObject 6 | { 7 | public AnimationCurve curve = new AnimationCurve(); 8 | public Gradient curveGradient = new Gradient(); 9 | public Vector2 curveSize = new Vector2(5, 3); 10 | public int sampleCount = 100; 11 | } 12 | -------------------------------------------------------------------------------- /ExamplesScenes/CurveScriptableObject.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 82246cbcf41424417a209489f3849766 3 | timeCreated: 1511399195 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /ExamplesScenes/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bdf862d4f4b0749ddb96ee2c648d7e9c 3 | folderAsset: yes 4 | timeCreated: 1510263902 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /ExamplesScenes/Editor/CurveScriptableObjectEditor.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEditor; 5 | using System.IO; 6 | using System; 7 | using BetterHandles; 8 | 9 | [CustomEditor(typeof(CurveScriptableObject))] 10 | public class CurveScriptableObjectEditor : Editor 11 | { 12 | CurveHandle curveHandle; 13 | 14 | [MenuItem("Assets/Create/Curve scriptable object")] 15 | public static void CreateCurveObject() 16 | { 17 | var cso = ScriptableObject.CreateInstance< CurveScriptableObject >(); 18 | 19 | string path = AssetDatabase.GetAssetPath(Selection.activeObject); 20 | 21 | if (String.IsNullOrEmpty(path)) 22 | path = "Assets"; 23 | else if (!String.IsNullOrEmpty(Path.GetExtension(path))) 24 | path = path.Replace(Path.GetFileName(AssetDatabase.GetAssetPath(Selection.activeObject)), ""); 25 | 26 | path = AssetDatabase.GenerateUniqueAssetPath(path + "/Curve.asset"); 27 | 28 | ProjectWindowUtil.CreateAsset(cso, path); 29 | } 30 | 31 | void OnEnable() 32 | { 33 | curveHandle = new CurveHandle(); 34 | 35 | SceneView.onSceneGUIDelegate += OnSceneGUI; 36 | } 37 | 38 | void OnDisable() 39 | { 40 | SceneView.onSceneGUIDelegate -= OnSceneGUI; 41 | } 42 | 43 | public void OnSceneGUI(SceneView sv) 44 | { 45 | var cso = target as CurveScriptableObject; 46 | 47 | curveHandle.Set2DSize(cso.curveSize); 48 | curveHandle.SetColors(cso.curveGradient); 49 | curveHandle.curveSamples = cso.sampleCount; 50 | 51 | AnimationCurve modifiedCurve = curveHandle.DrawHandle(cso.curve); 52 | if (GUI.changed) 53 | { 54 | Undo.RecordObject(target, "Changed curve"); 55 | cso.curve = modifiedCurve; 56 | } 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /ExamplesScenes/Editor/CurveScriptableObjectEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f558e8a6378434b2abfa0158eccacb8a 3 | timeCreated: 1511399230 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /ExamplesScenes/Editor/HandlesExampleWindow.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEditor; 5 | using System.Linq; 6 | using System; 7 | using UnityEditor.IMGUI.Controls; 8 | using BetterHandles; 9 | 10 | public class HandlesExampleWindow : EditorWindow 11 | { 12 | [NonSerialized] 13 | bool focus = false; 14 | [SerializeField] 15 | string currentKey = null; 16 | 17 | static float angle = 42, radius = 2, capsRadius = .5f, height = 2; 18 | static Vector3 boxSize = new Vector3(2, 1, 2); 19 | static Vector3 minAngles = new Vector3(0, 0, 0), maxAngles = new Vector3(45, 45, 45); 20 | static AnimationCurve curve = new AnimationCurve(new Keyframe(0, 1), new Keyframe(.5f, .7f), new Keyframe(1, 0)); 21 | static Keyframe keyframe = new Keyframe(0, 0); 22 | static Vector2 pos; 23 | static Vector2 point1, point2, point3, point4, point5, point6, point7; 24 | new static Vector3 position; 25 | 26 | static Texture2D normaltexture, selectedTexture; 27 | // static AnimationCurve curve = new AnimationCurve(new Keyframe(0, 1)); 28 | 29 | static Mesh cylinderMesh; 30 | 31 | static DrawPerformances perfsTest = new DrawPerformances(); 32 | 33 | Dictionary< string, Action > handlesActions = new Dictionary< string, Action >() 34 | { 35 | {"Simple custom Handles (using existing Handles)", null}, 36 | {"Solid scaled cube", () => HandlesExtended.DrawSolidCube(Vector3.zero, Quaternion.identity, new Vector3(5, 1, 3), new Color(1f, 0, .2f, .2f))}, 37 | {"Wire rotated cube", () => HandlesExtended.DrawWireCube(Vector3.zero, Quaternion.Euler(45, 45, 0), new Vector3(2, 1, 2), new Color(1f, 0, .2f, 1f))}, 38 | {"Solid scaled cylinder", () => HandlesExtended.DrawCylinder(Vector3.zero, Quaternion.Euler(90, 0, 90), new Vector3(1, 3, 2), new Color(0, 1, 0, .3f))}, 39 | {"Solid scaled cone", () => HandlesExtended.DrawCone(Vector3.zero, Quaternion.Euler(-90, 0, 0), new Vector3(1, 3, 2), new Color(0, 0, 1, .3f))}, 40 | {"Solid scaled circle", () => HandlesExtended.DrawCircle(Vector3.zero, Quaternion.Euler(45, 0, 45), new Vector3(1, 3, 2), new Color(0, 1, 0, 1f))}, 41 | {"Solid scaled arrow", () => HandlesExtended.DrawArrow(Vector3.zero, Quaternion.Euler(-90, 0, 0), new Vector3(1, 3, 1), new Color(0, 0, 1, .3f))}, 42 | {"Solid scaled rectangle", () => HandlesExtended.DrawRectange(Vector3.zero, Quaternion.Euler(90, 0, 90), new Vector3(1, 3, 2), new Color(0, 0, 1, 1f))}, 43 | {"Solid scaled sphere", () => HandlesExtended.DrawSphere(Vector3.zero, Quaternion.Euler(90, 0, 90), new Vector3(1, 3, 2), new Color(0, 0, 1, .3f))}, 44 | {"Full custom Handles", null}, 45 | {"Keyframe Handle", () => HandlesExtended.KeyframeHandle(3, 2, ref keyframe, Vector3.zero, Quaternion.Euler(45, 45, 0), Color.white, Color.yellow)}, 46 | {"Curve Handle", () => HandlesExtended.CurveHandle(3, 2, curve, Vector3.one, Quaternion.Euler(0, 0, 0), new Color(1, 0, 0, .6f), new Color(0, 0, 1, .6f))}, 47 | {"2D Move Handle", () => HandlesExtended.Free2DMoveHandle(ref point1, .1f, Quaternion.Euler(45, 0, 45), new Color(1, 0, 0, .3f), new Color(0, 0, 1, .3f))}, 48 | {"2D Textured Move Handle", () => { 49 | HandlesExtended.Free2DMoveHandle(ref point2, .1f, Quaternion.identity, normaltexture , selectedTexture, selectedTexture); 50 | HandlesExtended.Free2DMoveHandle(ref point3, .1f, Quaternion.identity, normaltexture , selectedTexture, selectedTexture); 51 | HandlesExtended.Free2DMoveHandle(ref point4, .1f, Quaternion.identity, normaltexture , selectedTexture, selectedTexture); 52 | HandlesExtended.Free2DMoveHandle(ref point5, .1f, Quaternion.identity, normaltexture , selectedTexture, selectedTexture); 53 | HandlesExtended.Free2DMoveHandle(ref point6, .1f, Quaternion.identity, normaltexture , selectedTexture, selectedTexture); 54 | HandlesExtended.Free2DMoveHandle(ref point7, .1f, Quaternion.identity, normaltexture , selectedTexture, selectedTexture); 55 | }}, 56 | {"IMGUI Handles", null}, 57 | {"Arc Handle", () => HandlesExtended.ArcHandle(Vector3.zero, Quaternion.identity, Vector3.one, ref angle, ref radius, new Color(1, 0, 0, .1f), new Color(0, 0, 1, 1f))}, 58 | {"Box Bounds Handle", () => HandlesExtended.BoxBoundsHandle(Vector3.zero, Quaternion.identity, Vector3.one, ref boxSize, PrimitiveBoundsHandle.Axes.All, new Color(1, 0, 0, 1f), new Color(0, 0, 1, 1f))}, 59 | {"Capsule Bounds Handle", () => HandlesExtended.CapsuleBoundsHandle(Vector3.zero, Quaternion.identity, Vector3.one, ref height, ref capsRadius)}, 60 | {"Joint Angular Limit Handle", () => HandlesExtended.JointAngularLimitHandle(Vector3.zero, Quaternion.identity, Vector3.one, ref minAngles, ref maxAngles)}, 61 | {"Sphere Bounds Handle", () => HandlesExtended.SphereBoundsHandle(Vector3.zero, Quaternion.identity, Vector3.one, ref radius)}, 62 | {"Others", null}, 63 | {"Perfs ('Mesh draw' and 'GL draw' in profiler)", () => perfsTest.Test()}, 64 | {"Cylinder cap function", () => position = Handles.FreeMoveHandle(position, Quaternion.identity, 1f, Vector3.zero, CylinderHandleCap)} 65 | }; 66 | 67 | Vector2 scrollbar; 68 | 69 | [MenuItem("Window/Handles Examples")] 70 | public static void ShowWindow() 71 | { 72 | EditorWindow.GetWindow< HandlesExampleWindow >().Show(); 73 | } 74 | 75 | void OnEnable() 76 | { 77 | SceneView.onSceneGUIDelegate += OnSceneGUI; 78 | 79 | normaltexture = Resources.Load< Texture2D >("normal"); 80 | selectedTexture = Resources.Load< Texture2D >("selected"); 81 | 82 | cylinderMesh = Resources.Load< Mesh >("cylinder"); 83 | 84 | perfsTest.Init(); 85 | } 86 | 87 | void OnGUI() 88 | { 89 | scrollbar = EditorGUILayout.BeginScrollView(scrollbar); 90 | if (GUILayout.Button("Focus preview")) 91 | { 92 | focus = true; 93 | SceneView.RepaintAll(); 94 | } 95 | 96 | EditorGUILayout.Space(); 97 | 98 | EditorGUILayout.BeginVertical(new GUIStyle("box")); 99 | { 100 | foreach (var kp in handlesActions) 101 | { 102 | if (kp.Value == null) 103 | { 104 | EditorGUILayout.LabelField(kp.Key, EditorStyles.boldLabel); 105 | continue ; 106 | } 107 | 108 | EditorGUILayout.BeginHorizontal(); 109 | { 110 | EditorGUILayout.LabelField(kp.Key); 111 | if (GUILayout.Button("Show")) 112 | { 113 | currentKey = kp.Key; 114 | SceneView.RepaintAll(); 115 | } 116 | } 117 | EditorGUILayout.EndHorizontal(); 118 | } 119 | if (GUILayout.Button("Hide")) 120 | currentKey = ""; 121 | } 122 | EditorGUILayout.EndVertical(); 123 | 124 | EditorGUILayout.BeginVertical(new GUIStyle("box")); 125 | { 126 | EditorGUILayout.CurveField(curve); 127 | } 128 | EditorGUILayout.EndVertical(); 129 | 130 | EditorGUILayout.EndScrollView(); 131 | } 132 | 133 | void OnSceneGUI(SceneView sv) 134 | { 135 | //draw the current shown handles 136 | if (handlesActions.ContainsKey(currentKey) && handlesActions[currentKey] != null) 137 | handlesActions[currentKey](); 138 | 139 | if (focus) 140 | { 141 | sv.LookAt(Vector3.zero, Quaternion.Euler(45, -45, 0), 8); 142 | focus = false; 143 | } 144 | } 145 | 146 | void OnDisable() 147 | { 148 | SceneView.onSceneGUIDelegate -= OnSceneGUI; 149 | } 150 | 151 | #region Cap functions 152 | 153 | static void CylinderHandleCap(int controlId, Vector3 position, Quaternion rotation, float size, EventType eventType) 154 | { 155 | if (eventType == EventType.Repaint) 156 | { 157 | HandlesMaterials.vertexColor.SetPass(0); 158 | Graphics.DrawMeshNow(cylinderMesh, position, Quaternion.identity); 159 | } 160 | else if (eventType == EventType.Layout) 161 | { 162 | float cylinderHeight = 3.5f; 163 | Vector3 startPosition = position + Vector3.up * (cylinderHeight / 2); 164 | float distance = 1e20f; 165 | 166 | for (int i = 0; i < 9; i++) 167 | { 168 | distance = Mathf.Min(distance, HandleUtility.DistanceToCircle(startPosition, size / 2)); 169 | startPosition -= Vector3.up * cylinderHeight / 8; 170 | } 171 | 172 | HandleUtility.AddControl(controlId, distance); 173 | } 174 | } 175 | 176 | #endregion 177 | } 178 | -------------------------------------------------------------------------------- /ExamplesScenes/Editor/HandlesExampleWindow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bb7de1155763f463f933d1823541444d 3 | timeCreated: 1510264009 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /ExamplesScenes/Editor/SnapHandleEditor.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEditor; 5 | using BetterHandles; 6 | 7 | [InitializeOnLoad] 8 | public class SnapHandleEditor 9 | { 10 | static float snapHandleDistance = 3.5f; 11 | static float snapHandleSize = .15f; 12 | static float shiftSnapUnit = .1f; 13 | static float commandSnapUnit = .25f; 14 | 15 | static Mesh snapToolMesh; 16 | static Transform transform; 17 | static Material handleMat; 18 | 19 | static Quaternion currentRotation; 20 | static Color currentColor; 21 | 22 | static SnapHandleEditor() 23 | { 24 | snapToolMesh = Resources.Load< Mesh >("snapToolHandle"); 25 | SceneView.onSceneGUIDelegate += OnSceneGUI; 26 | } 27 | 28 | static void OnSceneGUI(SceneView sv) 29 | { 30 | if (Tools.current != Tool.Move) 31 | return ; 32 | 33 | if (Selection.activeGameObject == null) 34 | return ; 35 | 36 | transform = Selection.activeGameObject.transform; 37 | 38 | //x axis 39 | DrawAxisHandle(Quaternion.Euler(0, 0, 90), transform.right, Handles.xAxisColor); 40 | //y axis 41 | DrawAxisHandle(Quaternion.Euler(0, 0, 0), transform.up, Handles.yAxisColor); 42 | //z axis 43 | DrawAxisHandle(Quaternion.Euler(90, 0, 0), transform.forward, Handles.zAxisColor); 44 | } 45 | 46 | static void DrawAxisHandle(Quaternion rotation, Vector3 direction, Color color) 47 | { 48 | var e = Event.current; 49 | 50 | float snapUnit = 0; 51 | float size = HandleUtility.GetHandleSize(transform.position) * snapHandleSize; 52 | float dist = size * snapHandleDistance; 53 | 54 | if (EditorGUI.actionKey) 55 | snapUnit = (e.shift) ? shiftSnapUnit : commandSnapUnit; 56 | 57 | currentRotation = rotation; 58 | currentColor = color; 59 | 60 | Vector3 addPos = direction * dist; 61 | Vector3 newPosition = Handles.Slider(transform.position + addPos, direction, size, SnapHandleCap, snapUnit) - addPos; 62 | 63 | transform.position = newPosition; 64 | } 65 | 66 | static void SnapHandleCap(int controlId, Vector3 position, Quaternion rotation, float size, EventType eventType) 67 | { 68 | if (eventType == EventType.Repaint) 69 | { 70 | //we set the material color or preselected color if mouse is near from our handle 71 | Color color = (HandleUtility.nearestControl == controlId || GUIUtility.hotControl == controlId) ? Handles.preselectionColor : currentColor; 72 | HandlesMaterials.overlayColor.SetColor("_Color", color); 73 | 74 | //we draw the cylinder with overlay material 75 | HandlesMaterials.overlayColor.SetPass(0); 76 | Matrix4x4 trs = Matrix4x4.TRS(position, transform.rotation * currentRotation, Vector3.one * size); 77 | Graphics.DrawMeshNow(snapToolMesh, trs); 78 | } 79 | else if (eventType == EventType.Layout) 80 | { 81 | float distance = HandleUtility.DistanceToCircle(position, size); 82 | HandleUtility.AddControl(controlId, distance); 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /ExamplesScenes/Editor/SnapHandleEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8dfae3fb6fe6f41a1ab7f08fb297afb2 3 | timeCreated: 1511489192 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /ExamplesScenes/curves.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 120704bb0e2fc4592a7e33173b7cfdbd 3 | folderAsset: yes 4 | timeCreated: 1511399536 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /ExamplesScenes/curves/curve1.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_PrefabParentObject: {fileID: 0} 7 | m_PrefabInternal: {fileID: 0} 8 | m_GameObject: {fileID: 0} 9 | m_Enabled: 1 10 | m_EditorHideFlags: 0 11 | m_Script: {fileID: 11500000, guid: 82246cbcf41424417a209489f3849766, type: 3} 12 | m_Name: curve1 13 | m_EditorClassIdentifier: 14 | curve: 15 | serializedVersion: 2 16 | m_Curve: 17 | - serializedVersion: 2 18 | time: 0.03431487 19 | value: 0.06478103 20 | inSlope: 0 21 | outSlope: -0.43902412 22 | tangentMode: 0 23 | - serializedVersion: 2 24 | time: 0.39867842 25 | value: 0.59218144 26 | inSlope: 0.009258586 27 | outSlope: -2.3779247 28 | tangentMode: 0 29 | - serializedVersion: 2 30 | time: 0.8825537 31 | value: 0.64343977 32 | inSlope: -1.198538 33 | outSlope: 0 34 | tangentMode: 0 35 | m_PreInfinity: 2 36 | m_PostInfinity: 2 37 | m_RotationOrder: 4 38 | curveGradient: 39 | serializedVersion: 2 40 | key0: {r: 1, g: 0, b: 0, a: 0.5882353} 41 | key1: {r: 1, g: 0.47586203, b: 0, a: 0.5882353} 42 | key2: {r: 0.9862069, g: 1, b: 0, a: 1} 43 | key3: {r: 0.30057865, g: 0.98990375, b: 0.24399216, a: 0} 44 | key4: {r: 0, g: 1, b: 0.987113, a: 0} 45 | key5: {r: 0, g: 0.7083663, b: 0.98998237, a: 0} 46 | key6: {r: 0, g: 0.089014046, b: 0.99285173, a: 0} 47 | key7: {r: 0, g: 0.089014046, b: 0.99285173, a: 0} 48 | ctime0: 0 49 | ctime1: 7710 50 | ctime2: 17540 51 | ctime3: 30262 52 | ctime4: 40863 53 | ctime5: 56283 54 | ctime6: 65535 55 | ctime7: 65535 56 | atime0: 0 57 | atime1: 65535 58 | atime2: 58211 59 | atime3: 65535 60 | atime4: 0 61 | atime5: 0 62 | atime6: 0 63 | atime7: 0 64 | m_Mode: 0 65 | m_NumColorKeys: 7 66 | m_NumAlphaKeys: 2 67 | curveSize: {x: 5, y: 3} 68 | sampleCount: 100 69 | -------------------------------------------------------------------------------- /ExamplesScenes/curves/curve1.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0013493efdc3348b7a1f68e4ed36d9e6 3 | timeCreated: 1511399622 4 | licenseType: Free 5 | NativeFormatImporter: 6 | externalObjects: {} 7 | mainObjectFileID: 11400000 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /ExamplesScenes/curves/curve2.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_PrefabParentObject: {fileID: 0} 7 | m_PrefabInternal: {fileID: 0} 8 | m_GameObject: {fileID: 0} 9 | m_Enabled: 1 10 | m_EditorHideFlags: 0 11 | m_Script: {fileID: 11500000, guid: 82246cbcf41424417a209489f3849766, type: 3} 12 | m_Name: curve2 13 | m_EditorClassIdentifier: 14 | curve: 15 | serializedVersion: 2 16 | m_Curve: 17 | - serializedVersion: 2 18 | time: 0.028888244 19 | value: 0.26107615 20 | inSlope: 0 21 | outSlope: -4.900711 22 | tangentMode: 0 23 | - serializedVersion: 2 24 | time: 0.19182333 25 | value: 0.64063895 26 | inSlope: -0 27 | outSlope: 0 28 | tangentMode: 0 29 | - serializedVersion: 2 30 | time: 0.32446584 31 | value: 0.8608058 32 | inSlope: -0.20371673 33 | outSlope: -0.20371689 34 | tangentMode: 0 35 | - serializedVersion: 2 36 | time: 0.5049595 37 | value: 0.7209722 38 | inSlope: -0 39 | outSlope: 0 40 | tangentMode: 0 41 | - serializedVersion: 2 42 | time: 0.5987755 43 | value: 0.3658438 44 | inSlope: -2.406125 45 | outSlope: -2.406125 46 | tangentMode: 0 47 | - serializedVersion: 2 48 | time: 0.8715085 49 | value: 0.1906176 50 | inSlope: -20.82106 51 | outSlope: -20.82107 52 | tangentMode: 0 53 | m_PreInfinity: 2 54 | m_PostInfinity: 2 55 | m_RotationOrder: 0 56 | curveGradient: 57 | serializedVersion: 2 58 | key0: {r: 0.65517235, g: 0, b: 1, a: 1} 59 | key1: {r: 0, g: 0.95862055, b: 1, a: 1} 60 | key2: {r: 0, g: 0, b: 0, a: 0} 61 | key3: {r: 0, g: 0, b: 0, a: 0} 62 | key4: {r: 0, g: 0, b: 0, a: 0} 63 | key5: {r: 0, g: 0, b: 0, a: 0} 64 | key6: {r: 0, g: 0, b: 0, a: 0} 65 | key7: {r: 0, g: 0, b: 0, a: 0} 66 | ctime0: 0 67 | ctime1: 65535 68 | ctime2: 0 69 | ctime3: 0 70 | ctime4: 0 71 | ctime5: 0 72 | ctime6: 0 73 | ctime7: 0 74 | atime0: 0 75 | atime1: 65535 76 | atime2: 0 77 | atime3: 0 78 | atime4: 0 79 | atime5: 0 80 | atime6: 0 81 | atime7: 0 82 | m_Mode: 0 83 | m_NumColorKeys: 2 84 | m_NumAlphaKeys: 2 85 | curveSize: {x: 12.5, y: 8.77} 86 | sampleCount: 200 87 | -------------------------------------------------------------------------------- /ExamplesScenes/curves/curve2.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cb87042787bee4a96a47a2eca94dd83f 3 | timeCreated: 1511402042 4 | licenseType: Free 5 | NativeFormatImporter: 6 | externalObjects: {} 7 | mainObjectFileID: 11400000 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /ExamplesScenes/curves/curve3.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_PrefabParentObject: {fileID: 0} 7 | m_PrefabInternal: {fileID: 0} 8 | m_GameObject: {fileID: 0} 9 | m_Enabled: 1 10 | m_EditorHideFlags: 0 11 | m_Script: {fileID: 11500000, guid: 82246cbcf41424417a209489f3849766, type: 3} 12 | m_Name: curve3 13 | m_EditorClassIdentifier: 14 | curve: 15 | serializedVersion: 2 16 | m_Curve: 17 | - serializedVersion: 2 18 | time: 0.048531346 19 | value: 0.57438064 20 | inSlope: 0 21 | outSlope: 1.3528966 22 | tangentMode: 136 23 | - serializedVersion: 2 24 | time: 0.34006125 25 | value: 0.7504334 26 | inSlope: -1.2153289 27 | outSlope: 0 28 | tangentMode: 0 29 | - serializedVersion: 2 30 | time: 0.55609125 31 | value: 0.35655966 32 | inSlope: Infinity 33 | outSlope: 0 34 | tangentMode: 0 35 | - serializedVersion: 2 36 | time: 0.7383972 37 | value: 0.16735776 38 | inSlope: Infinity 39 | outSlope: 0 40 | tangentMode: 0 41 | - serializedVersion: 2 42 | time: 0.92874324 43 | value: 0.05512948 44 | inSlope: Infinity 45 | outSlope: 0 46 | tangentMode: 0 47 | m_PreInfinity: 2 48 | m_PostInfinity: 2 49 | m_RotationOrder: 0 50 | curveGradient: 51 | serializedVersion: 2 52 | key0: {r: 1, g: 0, b: 0, a: 1} 53 | key1: {r: 1, g: 0.31436878, b: 0, a: 1} 54 | key2: {r: 1, g: 0.9724138, b: 0, a: 0} 55 | key3: {r: 1, g: 0.9724138, b: 0, a: 0} 56 | key4: {r: 0, g: 0, b: 0, a: 0} 57 | key5: {r: 0, g: 0, b: 0, a: 0} 58 | key6: {r: 0, g: 0, b: 0, a: 0} 59 | key7: {r: 0, g: 0, b: 0, a: 0} 60 | ctime0: 0 61 | ctime1: 13107 62 | ctime2: 65535 63 | ctime3: 65535 64 | ctime4: 0 65 | ctime5: 0 66 | ctime6: 0 67 | ctime7: 0 68 | atime0: 0 69 | atime1: 65535 70 | atime2: 0 71 | atime3: 0 72 | atime4: 0 73 | atime5: 0 74 | atime6: 0 75 | atime7: 0 76 | m_Mode: 0 77 | m_NumColorKeys: 3 78 | m_NumAlphaKeys: 2 79 | curveSize: {x: 5.27, y: 5.74} 80 | sampleCount: 500 81 | -------------------------------------------------------------------------------- /ExamplesScenes/curves/curve3.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dbc35bd5e1ceb40719fbb90b4d231214 3 | timeCreated: 1511402504 4 | licenseType: Free 5 | NativeFormatImporter: 6 | externalObjects: {} 7 | mainObjectFileID: 11400000 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /ExamplesScenes/curves/curve4.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_PrefabParentObject: {fileID: 0} 7 | m_PrefabInternal: {fileID: 0} 8 | m_GameObject: {fileID: 0} 9 | m_Enabled: 1 10 | m_EditorHideFlags: 0 11 | m_Script: {fileID: 11500000, guid: 82246cbcf41424417a209489f3849766, type: 3} 12 | m_Name: curve4 13 | m_EditorClassIdentifier: 14 | curve: 15 | serializedVersion: 2 16 | m_Curve: 17 | - serializedVersion: 2 18 | time: -0.11434826 19 | value: 0.16383158 20 | inSlope: 0 21 | outSlope: 1.5864593 22 | tangentMode: 0 23 | - serializedVersion: 2 24 | time: 0.27321187 25 | value: 0.3126211 26 | inSlope: -1.2153295 27 | outSlope: 3.5231953 28 | tangentMode: 0 29 | - serializedVersion: 2 30 | time: 0.55609125 31 | value: 0.35655966 32 | inSlope: 4.078121 33 | outSlope: 4.0781198 34 | tangentMode: 0 35 | - serializedVersion: 2 36 | time: 0.64203465 37 | value: 0.77208215 38 | inSlope: -0 39 | outSlope: 1.3680071 40 | tangentMode: 136 41 | - serializedVersion: 2 42 | time: 0.787725 43 | value: 0.15342547 44 | inSlope: -0.1427853 45 | outSlope: -0.14278518 46 | tangentMode: 0 47 | - serializedVersion: 2 48 | time: 1.1339365 49 | value: 0.5897809 50 | inSlope: 2.0529506 51 | outSlope: -0 52 | tangentMode: 0 53 | m_PreInfinity: 2 54 | m_PostInfinity: 2 55 | m_RotationOrder: 4 56 | curveGradient: 57 | serializedVersion: 2 58 | key0: {r: 0, g: 0, b: 0, a: 1} 59 | key1: {r: 1, g: 1, b: 1, a: 0} 60 | key2: {r: 1, g: 0.9724138, b: 0, a: 1} 61 | key3: {r: 1, g: 0.9724138, b: 0, a: 1} 62 | key4: {r: 0, g: 0, b: 0, a: 1} 63 | key5: {r: 0, g: 0, b: 0, a: 0} 64 | key6: {r: 0, g: 0, b: 0, a: 0} 65 | key7: {r: 0, g: 0, b: 0, a: 0} 66 | ctime0: 0 67 | ctime1: 65535 68 | ctime2: 65535 69 | ctime3: 65535 70 | ctime4: 0 71 | ctime5: 0 72 | ctime6: 0 73 | ctime7: 0 74 | atime0: 0 75 | atime1: 65535 76 | atime2: 65535 77 | atime3: 65535 78 | atime4: 65535 79 | atime5: 0 80 | atime6: 0 81 | atime7: 0 82 | m_Mode: 0 83 | m_NumColorKeys: 2 84 | m_NumAlphaKeys: 2 85 | curveSize: {x: 5.53, y: 5.74} 86 | sampleCount: 500 87 | -------------------------------------------------------------------------------- /ExamplesScenes/curves/curve4.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 466695b96989d412796c2d1e2ed1ff5a 3 | timeCreated: 1511402504 4 | licenseType: Free 5 | NativeFormatImporter: 6 | externalObjects: {} 7 | mainObjectFileID: 11400000 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /ExamplesScenes/curves/curve5.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_PrefabParentObject: {fileID: 0} 7 | m_PrefabInternal: {fileID: 0} 8 | m_GameObject: {fileID: 0} 9 | m_Enabled: 1 10 | m_EditorHideFlags: 0 11 | m_Script: {fileID: 11500000, guid: 82246cbcf41424417a209489f3849766, type: 3} 12 | m_Name: curve5 13 | m_EditorClassIdentifier: 14 | curve: 15 | serializedVersion: 2 16 | m_Curve: 17 | - serializedVersion: 2 18 | time: 0 19 | value: 0 20 | inSlope: 0 21 | outSlope: 0 22 | tangentMode: 0 23 | - serializedVersion: 2 24 | time: 0.27762038 25 | value: 0.27083328 26 | inSlope: -0 27 | outSlope: 1.0454428 28 | tangentMode: 0 29 | - serializedVersion: 2 30 | time: 0.5002223 31 | value: 0.574647 32 | inSlope: -0 33 | outSlope: 0 34 | tangentMode: 0 35 | - serializedVersion: 2 36 | time: 0.70179176 37 | value: 0.26791283 38 | inSlope: -5.165652 39 | outSlope: 0 40 | tangentMode: 0 41 | - serializedVersion: 2 42 | time: 1 43 | value: 1 44 | inSlope: 0 45 | outSlope: 0 46 | tangentMode: 0 47 | m_PreInfinity: 2 48 | m_PostInfinity: 2 49 | m_RotationOrder: 4 50 | curveGradient: 51 | serializedVersion: 2 52 | key0: {r: 0.65517235, g: 0, b: 1, a: 1} 53 | key1: {r: 0, g: 0.95862055, b: 1, a: 1} 54 | key2: {r: 0.9862069, g: 1, b: 0, a: 0} 55 | key3: {r: 0.30057865, g: 0.98990375, b: 0.24399216, a: 0} 56 | key4: {r: 0, g: 1, b: 0.987113, a: 0} 57 | key5: {r: 0, g: 0.7083663, b: 0.98998237, a: 0} 58 | key6: {r: 0, g: 0.089014046, b: 0.99285173, a: 0} 59 | key7: {r: 0, g: 0, b: 0, a: 0} 60 | ctime0: 0 61 | ctime1: 65535 62 | ctime2: 17540 63 | ctime3: 30262 64 | ctime4: 40863 65 | ctime5: 56283 66 | ctime6: 65535 67 | ctime7: 0 68 | atime0: 0 69 | atime1: 65535 70 | atime2: 0 71 | atime3: 0 72 | atime4: 0 73 | atime5: 0 74 | atime6: 0 75 | atime7: 0 76 | m_Mode: 0 77 | m_NumColorKeys: 2 78 | m_NumAlphaKeys: 2 79 | curveSize: {x: 5, y: 3} 80 | sampleCount: 500 81 | -------------------------------------------------------------------------------- /ExamplesScenes/curves/curve5.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f68379b674a2441ef9b1bea469d04f7b 3 | timeCreated: 1511469970 4 | licenseType: Free 5 | NativeFormatImporter: 6 | externalObjects: {} 7 | mainObjectFileID: 11400000 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Antoine Lelievre 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /LICENSE.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f95f4ef2324ee4774bd01c7a89361445 3 | timeCreated: 1510262879 4 | licenseType: Free 5 | DefaultImporter: 6 | externalObjects: {} 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MasterUnityHandles 2 | Unity custom handles examples, more information here: [Mastering UnityEditor Handles 3 | ](https://github.com/alelievr/MasterUnityHandles/wiki) 4 | 5 | ### Curve Handle 6 | A Handle for [AnmationCurve](https://docs.unity3d.com/ScriptReference/AnimationCurve.html) 7 | ![](https://github.com/alelievr/MasterUnityHandles/wiki/images/header.png) 8 | ![](https://image.noelshack.com/fichiers/2017/47/4/1511467440-screen-shot-2017-11-23-at-9-03-20-pm.png) 9 | ![](https://image.noelshack.com/fichiers/2017/47/4/1511469894-r2.png) 10 | 11 | ## Keyframe Handle 12 | A Handle for [AnmationCurve](https://docs.unity3d.com/ScriptReference/AnimationCurve.html)'s [keyframes](https://docs.unity3d.com/ScriptReference/Keyframe.html) 13 | ![](https://image.noelshack.com/fichiers/2017/47/4/1511467662-screen-shot-2017-11-23-at-9-04-16-pm.png) 14 | 15 | 16 | ## Free 2D Move Handle 17 | A handle that can be moved on a rotated plane 18 | ![](https://image.noelshack.com/fichiers/2017/47/4/1511467662-screen-shot-2017-11-23-at-9-05-54-pm.png) 19 | 20 | ## Custom Snap handle tool 21 | Add a snap option (cylinders on each axis) to the default move tool 22 | ![](https://github.com/alelievr/MasterUnityHandles/wiki/images/SnapTool.webp) 23 | -------------------------------------------------------------------------------- /README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bb2586a2bf2bc4e49a4d5211fe60d1fb 3 | timeCreated: 1510262879 4 | licenseType: Free 5 | DefaultImporter: 6 | externalObjects: {} 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Resources.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ead82bbd73c5b447ca5494fd05279901 3 | folderAsset: yes 4 | timeCreated: 1510324425 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Resources/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 93f0167730b394b17810270eac740f52 3 | folderAsset: yes 4 | timeCreated: 1511363229 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Resources/Materials/None.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: None 10 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: 12 | m_LightmapFlags: 4 13 | m_EnableInstancingVariants: 0 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: -1 16 | stringTagMap: {} 17 | disabledShaderPasses: [] 18 | m_SavedProperties: 19 | serializedVersion: 3 20 | m_TexEnvs: 21 | - _BumpMap: 22 | m_Texture: {fileID: 0} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | - _DetailAlbedoMap: 26 | m_Texture: {fileID: 0} 27 | m_Scale: {x: 1, y: 1} 28 | m_Offset: {x: 0, y: 0} 29 | - _DetailMask: 30 | m_Texture: {fileID: 0} 31 | m_Scale: {x: 1, y: 1} 32 | m_Offset: {x: 0, y: 0} 33 | - _DetailNormalMap: 34 | m_Texture: {fileID: 0} 35 | m_Scale: {x: 1, y: 1} 36 | m_Offset: {x: 0, y: 0} 37 | - _EmissionMap: 38 | m_Texture: {fileID: 0} 39 | m_Scale: {x: 1, y: 1} 40 | m_Offset: {x: 0, y: 0} 41 | - _MainTex: 42 | m_Texture: {fileID: 0} 43 | m_Scale: {x: 1, y: 1} 44 | m_Offset: {x: 0, y: 0} 45 | - _MetallicGlossMap: 46 | m_Texture: {fileID: 0} 47 | m_Scale: {x: 1, y: 1} 48 | m_Offset: {x: 0, y: 0} 49 | - _OcclusionMap: 50 | m_Texture: {fileID: 0} 51 | m_Scale: {x: 1, y: 1} 52 | m_Offset: {x: 0, y: 0} 53 | - _ParallaxMap: 54 | m_Texture: {fileID: 0} 55 | m_Scale: {x: 1, y: 1} 56 | m_Offset: {x: 0, y: 0} 57 | m_Floats: 58 | - _BumpScale: 1 59 | - _Cutoff: 0.5 60 | - _DetailNormalMapScale: 1 61 | - _DstBlend: 0 62 | - _GlossMapScale: 1 63 | - _Glossiness: 0 64 | - _GlossyReflections: 1 65 | - _Metallic: 0 66 | - _Mode: 0 67 | - _OcclusionStrength: 1 68 | - _Parallax: 0.02 69 | - _SmoothnessTextureChannel: 0 70 | - _SpecularHighlights: 1 71 | - _SrcBlend: 1 72 | - _UVSec: 0 73 | - _ZWrite: 1 74 | m_Colors: 75 | - _Color: {r: 0.8, g: 0.8, b: 0.8, a: 1} 76 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 0} 77 | -------------------------------------------------------------------------------- /Resources/Materials/None.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9a6259ea2af4a4c11845a939c87ed614 3 | timeCreated: 1511372598 4 | licenseType: Free 5 | NativeFormatImporter: 6 | externalObjects: {} 7 | mainObjectFileID: 2100000 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Resources/Materials/defaultMat.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: defaultMat 10 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: 12 | m_LightmapFlags: 4 13 | m_EnableInstancingVariants: 0 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: -1 16 | stringTagMap: {} 17 | disabledShaderPasses: [] 18 | m_SavedProperties: 19 | serializedVersion: 3 20 | m_TexEnvs: 21 | - _BumpMap: 22 | m_Texture: {fileID: 0} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | - _DetailAlbedoMap: 26 | m_Texture: {fileID: 0} 27 | m_Scale: {x: 1, y: 1} 28 | m_Offset: {x: 0, y: 0} 29 | - _DetailMask: 30 | m_Texture: {fileID: 0} 31 | m_Scale: {x: 1, y: 1} 32 | m_Offset: {x: 0, y: 0} 33 | - _DetailNormalMap: 34 | m_Texture: {fileID: 0} 35 | m_Scale: {x: 1, y: 1} 36 | m_Offset: {x: 0, y: 0} 37 | - _EmissionMap: 38 | m_Texture: {fileID: 0} 39 | m_Scale: {x: 1, y: 1} 40 | m_Offset: {x: 0, y: 0} 41 | - _MainTex: 42 | m_Texture: {fileID: 0} 43 | m_Scale: {x: 1, y: 1} 44 | m_Offset: {x: 0, y: 0} 45 | - _MetallicGlossMap: 46 | m_Texture: {fileID: 0} 47 | m_Scale: {x: 1, y: 1} 48 | m_Offset: {x: 0, y: 0} 49 | - _OcclusionMap: 50 | m_Texture: {fileID: 0} 51 | m_Scale: {x: 1, y: 1} 52 | m_Offset: {x: 0, y: 0} 53 | - _ParallaxMap: 54 | m_Texture: {fileID: 0} 55 | m_Scale: {x: 1, y: 1} 56 | m_Offset: {x: 0, y: 0} 57 | m_Floats: 58 | - _BumpScale: 1 59 | - _Cutoff: 0.5 60 | - _DetailNormalMapScale: 1 61 | - _DstBlend: 0 62 | - _GlossMapScale: 1 63 | - _Glossiness: 0 64 | - _GlossyReflections: 1 65 | - _Metallic: 0 66 | - _Mode: 0 67 | - _OcclusionStrength: 1 68 | - _Parallax: 0.02 69 | - _SmoothnessTextureChannel: 0 70 | - _SpecularHighlights: 1 71 | - _SrcBlend: 1 72 | - _UVSec: 0 73 | - _ZWrite: 1 74 | m_Colors: 75 | - _Color: {r: 0.8, g: 0.8, b: 0.8, a: 1} 76 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 0} 77 | -------------------------------------------------------------------------------- /Resources/Materials/defaultMat.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e30f55b4056a646a685b13b96974984a 3 | timeCreated: 1511363229 4 | licenseType: Free 5 | NativeFormatImporter: 6 | externalObjects: {} 7 | mainObjectFileID: 2100000 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Resources/OverlayColorHandle.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: OverlayColorHandle 10 | m_Shader: {fileID: 4800000, guid: 01e9f68f8b863406893a2dc8ee9a4340, type: 3} 11 | m_ShaderKeywords: 12 | m_LightmapFlags: 4 13 | m_EnableInstancingVariants: 0 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: -1 16 | stringTagMap: {} 17 | disabledShaderPasses: [] 18 | m_SavedProperties: 19 | serializedVersion: 3 20 | m_TexEnvs: 21 | - _BumpMap: 22 | m_Texture: {fileID: 0} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | - _DetailAlbedoMap: 26 | m_Texture: {fileID: 0} 27 | m_Scale: {x: 1, y: 1} 28 | m_Offset: {x: 0, y: 0} 29 | - _DetailMask: 30 | m_Texture: {fileID: 0} 31 | m_Scale: {x: 1, y: 1} 32 | m_Offset: {x: 0, y: 0} 33 | - _DetailNormalMap: 34 | m_Texture: {fileID: 0} 35 | m_Scale: {x: 1, y: 1} 36 | m_Offset: {x: 0, y: 0} 37 | - _EmissionMap: 38 | m_Texture: {fileID: 0} 39 | m_Scale: {x: 1, y: 1} 40 | m_Offset: {x: 0, y: 0} 41 | - _MainTex: 42 | m_Texture: {fileID: 0} 43 | m_Scale: {x: 1, y: 1} 44 | m_Offset: {x: 0, y: 0} 45 | - _MetallicGlossMap: 46 | m_Texture: {fileID: 0} 47 | m_Scale: {x: 1, y: 1} 48 | m_Offset: {x: 0, y: 0} 49 | - _OcclusionMap: 50 | m_Texture: {fileID: 0} 51 | m_Scale: {x: 1, y: 1} 52 | m_Offset: {x: 0, y: 0} 53 | - _ParallaxMap: 54 | m_Texture: {fileID: 0} 55 | m_Scale: {x: 1, y: 1} 56 | m_Offset: {x: 0, y: 0} 57 | m_Floats: 58 | - _BumpScale: 1 59 | - _Cutoff: 0.5 60 | - _DetailNormalMapScale: 1 61 | - _DstBlend: 0 62 | - _GlossMapScale: 1 63 | - _Glossiness: 0.5 64 | - _GlossyReflections: 1 65 | - _Metallic: 0 66 | - _Mode: 0 67 | - _OcclusionStrength: 1 68 | - _Parallax: 0.02 69 | - _SmoothnessTextureChannel: 0 70 | - _SpecularHighlights: 1 71 | - _SrcBlend: 1 72 | - _UVSec: 0 73 | - _ZWrite: 1 74 | m_Colors: 75 | - _Color: {r: 0.227451, g: 0.4784314, b: 0.972549, a: 0.93} 76 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 77 | -------------------------------------------------------------------------------- /Resources/OverlayColorHandle.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fa56132811acd4de0ae610d6776ccab5 3 | timeCreated: 1511536784 4 | licenseType: Free 5 | NativeFormatImporter: 6 | externalObjects: {} 7 | mainObjectFileID: 2100000 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Resources/SnapToolArrow.obj: -------------------------------------------------------------------------------- 1 | # Blender v2.78 (sub 0) OBJ File: '' 2 | # www.blender.org 3 | mtllib SnapToolArrow.mtl 4 | o Cylinder 5 | v 0.000000 0.016800 -0.082837 6 | v 0.000000 4.004359 -0.082837 7 | v 0.016161 0.016800 -0.081245 8 | v 0.016161 4.004359 -0.081245 9 | v 0.031700 0.016800 -0.076532 10 | v 0.031700 4.004359 -0.076532 11 | v 0.046022 0.016800 -0.068877 12 | v 0.046022 4.004359 -0.068877 13 | v 0.058575 0.016800 -0.058575 14 | v 0.058575 4.004359 -0.058575 15 | v 0.068877 0.016800 -0.046022 16 | v 0.068877 4.004359 -0.046022 17 | v 0.076532 0.016800 -0.031700 18 | v 0.076532 4.004359 -0.031700 19 | v 0.081245 0.016800 -0.016161 20 | v 0.081245 4.004359 -0.016161 21 | v 0.082837 0.016800 -0.000000 22 | v 0.082837 4.004359 -0.000000 23 | v 0.081245 0.016800 0.016161 24 | v 0.081245 4.004359 0.016161 25 | v 0.076532 0.016800 0.031700 26 | v 0.076532 4.004359 0.031700 27 | v 0.068877 0.016800 0.046022 28 | v 0.068877 4.004359 0.046022 29 | v 0.058575 0.016800 0.058575 30 | v 0.058575 4.004359 0.058575 31 | v 0.046022 0.016800 0.068877 32 | v 0.046022 4.004359 0.068877 33 | v 0.031700 0.016800 0.076532 34 | v 0.031700 4.004359 0.076532 35 | v 0.016161 0.016800 0.081245 36 | v 0.016161 4.004359 0.081245 37 | v -0.000000 0.016800 0.082837 38 | v -0.000000 4.004359 0.082837 39 | v -0.016161 0.016800 0.081245 40 | v -0.016161 4.004359 0.081245 41 | v -0.031700 0.016800 0.076532 42 | v -0.031700 4.004359 0.076532 43 | v -0.046022 0.016800 0.068877 44 | v -0.046022 4.004359 0.068877 45 | v -0.058575 0.016800 0.058575 46 | v -0.058575 4.004359 0.058575 47 | v -0.068877 0.016800 0.046022 48 | v -0.068877 4.004359 0.046022 49 | v -0.076532 0.016800 0.031700 50 | v -0.076532 4.004359 0.031700 51 | v -0.081245 0.016800 0.016161 52 | v -0.081245 4.004359 0.016161 53 | v -0.082837 0.016800 -0.000000 54 | v -0.082837 4.004359 -0.000000 55 | v -0.081245 0.016800 -0.016161 56 | v -0.081245 4.004359 -0.016161 57 | v -0.076532 0.016800 -0.031700 58 | v -0.076532 4.004359 -0.031700 59 | v -0.068877 0.016800 -0.046022 60 | v -0.068877 4.004359 -0.046022 61 | v -0.058575 0.016800 -0.058575 62 | v -0.058575 4.004359 -0.058575 63 | v -0.046022 0.016800 -0.068877 64 | v -0.046022 4.004359 -0.068877 65 | v -0.031700 0.016800 -0.076532 66 | v -0.031700 4.004359 -0.076532 67 | v -0.016161 0.016800 -0.081245 68 | v -0.016161 4.004359 -0.081245 69 | v -0.000000 4.004359 -0.775488 70 | v 0.151290 4.004359 -0.760587 71 | v 0.296766 4.004359 -0.716458 72 | v 0.430838 4.004359 -0.644795 73 | v 0.548353 4.004359 -0.548353 74 | v 0.644795 4.004359 -0.430838 75 | v 0.716458 4.004359 -0.296766 76 | v 0.760587 4.004359 -0.151290 77 | v 0.775488 4.004359 0.000000 78 | v 0.760588 4.004359 0.151290 79 | v 0.716458 4.004359 0.296767 80 | v 0.644795 4.004359 0.430838 81 | v 0.548353 4.004359 0.548353 82 | v 0.430838 4.004359 0.644795 83 | v 0.296766 4.004359 0.716458 84 | v 0.151290 4.004359 0.760588 85 | v -0.000000 4.004359 0.775488 86 | v -0.151291 4.004359 0.760588 87 | v -0.296767 4.004359 0.716458 88 | v -0.430839 4.004359 0.644795 89 | v -0.548353 4.004359 0.548353 90 | v -0.644795 4.004359 0.430838 91 | v -0.716458 4.004359 0.296766 92 | v -0.760588 4.004359 0.151290 93 | v -0.775488 4.004359 -0.000001 94 | v -0.760587 4.004359 -0.151291 95 | v -0.716458 4.004359 -0.296767 96 | v -0.644795 4.004359 -0.430839 97 | v -0.548352 4.004359 -0.548354 98 | v -0.430837 4.004359 -0.644795 99 | v -0.296766 4.004359 -0.716458 100 | v -0.151289 4.004359 -0.760588 101 | v -0.000000 6.317841 -0.000000 102 | vn 0.0980 0.0000 -0.9952 103 | vn 0.2903 0.0000 -0.9569 104 | vn 0.4714 0.0000 -0.8819 105 | vn 0.6344 0.0000 -0.7730 106 | vn 0.7730 0.0000 -0.6344 107 | vn 0.8819 0.0000 -0.4714 108 | vn 0.9569 0.0000 -0.2903 109 | vn 0.9952 0.0000 -0.0980 110 | vn 0.9952 0.0000 0.0980 111 | vn 0.9569 0.0000 0.2903 112 | vn 0.8819 0.0000 0.4714 113 | vn 0.7730 0.0000 0.6344 114 | vn 0.6344 0.0000 0.7730 115 | vn 0.4714 0.0000 0.8819 116 | vn 0.2903 0.0000 0.9569 117 | vn 0.0980 0.0000 0.9952 118 | vn -0.0980 0.0000 0.9952 119 | vn -0.2903 0.0000 0.9569 120 | vn -0.4714 0.0000 0.8819 121 | vn -0.6344 0.0000 0.7730 122 | vn -0.7730 0.0000 0.6344 123 | vn -0.8819 0.0000 0.4714 124 | vn -0.9569 0.0000 0.2903 125 | vn -0.9952 0.0000 0.0980 126 | vn -0.9952 0.0000 -0.0980 127 | vn -0.9569 0.0000 -0.2903 128 | vn -0.8819 0.0000 -0.4714 129 | vn -0.7730 0.0000 -0.6344 130 | vn -0.6344 0.0000 -0.7730 131 | vn -0.4714 0.0000 -0.8819 132 | vn 0.0000 -1.0000 -0.0000 133 | vn -0.2903 0.0000 -0.9569 134 | vn -0.0980 0.0000 -0.9952 135 | vn 0.2754 0.3164 -0.9078 136 | vn -0.6018 0.3164 -0.7333 137 | vn 0.0930 0.3164 0.9440 138 | vn 0.4472 0.3164 -0.8366 139 | vn -0.4472 0.3164 -0.8366 140 | vn -0.0930 0.3164 0.9440 141 | vn 0.6018 0.3164 -0.7333 142 | vn -0.2754 0.3164 -0.9078 143 | vn -0.2754 0.3164 0.9078 144 | vn 0.7333 0.3164 -0.6018 145 | vn -0.0930 0.3164 -0.9440 146 | vn -0.4472 0.3164 0.8366 147 | vn 0.8366 0.3164 -0.4472 148 | vn -0.6018 0.3164 0.7333 149 | vn 0.9078 0.3164 -0.2754 150 | vn -0.7333 0.3164 0.6018 151 | vn 0.9440 0.3164 -0.0930 152 | vn -0.8366 0.3164 0.4472 153 | vn 0.9440 0.3164 0.0930 154 | vn -0.9078 0.3164 0.2754 155 | vn 0.9078 0.3164 0.2754 156 | vn -0.9440 0.3164 0.0930 157 | vn 0.8366 0.3164 0.4472 158 | vn -0.9440 0.3164 -0.0930 159 | vn 0.7333 0.3164 0.6018 160 | vn -0.9078 0.3164 -0.2754 161 | vn 0.6018 0.3164 0.7333 162 | vn -0.8366 0.3164 -0.4472 163 | vn 0.4472 0.3164 0.8366 164 | vn 0.0930 0.3164 -0.9440 165 | vn -0.7333 0.3164 -0.6018 166 | vn 0.2754 0.3164 0.9078 167 | usemtl None 168 | s off 169 | f 1//1 2//1 4//1 3//1 170 | f 3//2 4//2 6//2 5//2 171 | f 5//3 6//3 8//3 7//3 172 | f 7//4 8//4 10//4 9//4 173 | f 9//5 10//5 12//5 11//5 174 | f 11//6 12//6 14//6 13//6 175 | f 13//7 14//7 16//7 15//7 176 | f 15//8 16//8 18//8 17//8 177 | f 17//9 18//9 20//9 19//9 178 | f 19//10 20//10 22//10 21//10 179 | f 21//11 22//11 24//11 23//11 180 | f 23//12 24//12 26//12 25//12 181 | f 25//13 26//13 28//13 27//13 182 | f 27//14 28//14 30//14 29//14 183 | f 29//15 30//15 32//15 31//15 184 | f 31//16 32//16 34//16 33//16 185 | f 33//17 34//17 36//17 35//17 186 | f 35//18 36//18 38//18 37//18 187 | f 37//19 38//19 40//19 39//19 188 | f 39//20 40//20 42//20 41//20 189 | f 41//21 42//21 44//21 43//21 190 | f 43//22 44//22 46//22 45//22 191 | f 45//23 46//23 48//23 47//23 192 | f 47//24 48//24 50//24 49//24 193 | f 49//25 50//25 52//25 51//25 194 | f 51//26 52//26 54//26 53//26 195 | f 53//27 54//27 56//27 55//27 196 | f 55//28 56//28 58//28 57//28 197 | f 57//29 58//29 60//29 59//29 198 | f 59//30 60//30 62//30 61//30 199 | f 14//31 12//31 70//31 71//31 200 | f 61//32 62//32 64//32 63//32 201 | f 63//33 64//33 2//33 1//33 202 | f 1//31 3//31 5//31 7//31 9//31 11//31 13//31 15//31 17//31 19//31 21//31 23//31 25//31 27//31 29//31 31//31 33//31 35//31 37//31 39//31 41//31 43//31 45//31 47//31 49//31 51//31 53//31 55//31 57//31 59//31 61//31 63//31 203 | f 67//34 66//34 97//34 204 | f 32//31 30//31 79//31 80//31 205 | f 50//31 48//31 88//31 89//31 206 | f 6//31 4//31 66//31 67//31 207 | f 24//31 22//31 75//31 76//31 208 | f 42//31 40//31 84//31 85//31 209 | f 60//31 58//31 93//31 94//31 210 | f 16//31 14//31 71//31 72//31 211 | f 34//31 32//31 80//31 81//31 212 | f 52//31 50//31 89//31 90//31 213 | f 8//31 6//31 67//31 68//31 214 | f 26//31 24//31 76//31 77//31 215 | f 44//31 42//31 85//31 86//31 216 | f 62//31 60//31 94//31 95//31 217 | f 18//31 16//31 72//31 73//31 218 | f 36//31 34//31 81//31 82//31 219 | f 54//31 52//31 90//31 91//31 220 | f 10//31 8//31 68//31 69//31 221 | f 28//31 26//31 77//31 78//31 222 | f 46//31 44//31 86//31 87//31 223 | f 64//31 62//31 95//31 96//31 224 | f 20//31 18//31 73//31 74//31 225 | f 38//31 36//31 82//31 83//31 226 | f 56//31 54//31 91//31 92//31 227 | f 12//31 10//31 69//31 70//31 228 | f 30//31 28//31 78//31 79//31 229 | f 48//31 46//31 87//31 88//31 230 | f 4//31 2//31 65//31 66//31 231 | f 2//31 64//31 96//31 65//31 232 | f 22//31 20//31 74//31 75//31 233 | f 40//31 38//31 83//31 84//31 234 | f 58//31 56//31 92//31 93//31 235 | f 94//35 93//35 97//35 236 | f 81//36 80//36 97//36 237 | f 68//37 67//37 97//37 238 | f 95//38 94//38 97//38 239 | f 82//39 81//39 97//39 240 | f 69//40 68//40 97//40 241 | f 96//41 95//41 97//41 242 | f 83//42 82//42 97//42 243 | f 70//43 69//43 97//43 244 | f 65//44 96//44 97//44 245 | f 84//45 83//45 97//45 246 | f 71//46 70//46 97//46 247 | f 85//47 84//47 97//47 248 | f 72//48 71//48 97//48 249 | f 86//49 85//49 97//49 250 | f 73//50 72//50 97//50 251 | f 87//51 86//51 97//51 252 | f 74//52 73//52 97//52 253 | f 88//53 87//53 97//53 254 | f 75//54 74//54 97//54 255 | f 89//55 88//55 97//55 256 | f 76//56 75//56 97//56 257 | f 90//57 89//57 97//57 258 | f 77//58 76//58 97//58 259 | f 91//59 90//59 97//59 260 | f 78//60 77//60 97//60 261 | f 92//61 91//61 97//61 262 | f 79//62 78//62 97//62 263 | f 66//63 65//63 97//63 264 | f 93//64 92//64 97//64 265 | f 80//65 79//65 97//65 266 | -------------------------------------------------------------------------------- /Resources/SnapToolArrow.obj.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 013fd8046c2144c89b12886128762bd3 3 | timeCreated: 1511363206 4 | licenseType: Free 5 | ModelImporter: 6 | serializedVersion: 22 7 | fileIDToRecycleName: 8 | 100000: default 9 | 100002: //RootNode 10 | 400000: default 11 | 400002: //RootNode 12 | 2300000: default 13 | 3300000: default 14 | 4300000: default 15 | externalObjects: 16 | - first: 17 | type: UnityEngine:Material 18 | assembly: UnityEngine.CoreModule 19 | name: None 20 | second: {fileID: 2100000, guid: 9a6259ea2af4a4c11845a939c87ed614, type: 2} 21 | materials: 22 | importMaterials: 1 23 | materialName: 0 24 | materialSearch: 1 25 | materialLocation: 0 26 | animations: 27 | legacyGenerateAnimations: 4 28 | bakeSimulation: 0 29 | resampleCurves: 1 30 | optimizeGameObjects: 0 31 | motionNodeName: 32 | rigImportErrors: 33 | rigImportWarnings: 34 | animationImportErrors: 35 | animationImportWarnings: 36 | animationRetargetingWarnings: 37 | animationDoRetargetingWarnings: 0 38 | importAnimatedCustomProperties: 0 39 | animationCompression: 1 40 | animationRotationError: 0.5 41 | animationPositionError: 0.5 42 | animationScaleError: 0.5 43 | animationWrapMode: 0 44 | extraExposedTransformPaths: [] 45 | extraUserProperties: [] 46 | clipAnimations: [] 47 | isReadable: 1 48 | meshes: 49 | lODScreenPercentages: [] 50 | globalScale: 1 51 | meshCompression: 0 52 | addColliders: 0 53 | importVisibility: 1 54 | importBlendShapes: 1 55 | importCameras: 1 56 | importLights: 1 57 | swapUVChannels: 0 58 | generateSecondaryUV: 0 59 | useFileUnits: 1 60 | optimizeMeshForGPU: 1 61 | keepQuads: 0 62 | weldVertices: 1 63 | secondaryUVAngleDistortion: 8 64 | secondaryUVAreaDistortion: 15.000001 65 | secondaryUVHardAngle: 88 66 | secondaryUVPackMargin: 4 67 | useFileScale: 1 68 | tangentSpace: 69 | normalSmoothAngle: 60 70 | normalImportMode: 0 71 | tangentImportMode: 3 72 | normalCalculationMode: 4 73 | importAnimation: 1 74 | copyAvatar: 0 75 | humanDescription: 76 | serializedVersion: 2 77 | human: [] 78 | skeleton: [] 79 | armTwist: 0.5 80 | foreArmTwist: 0.5 81 | upperLegTwist: 0.5 82 | legTwist: 0.5 83 | armStretch: 0.05 84 | legStretch: 0.05 85 | feetSpacing: 0 86 | rootMotionBoneName: 87 | rootMotionBoneRotation: {x: 0, y: 0, z: 0, w: 1} 88 | hasTranslationDoF: 0 89 | hasExtraRoot: 0 90 | skeletonHasParents: 1 91 | lastHumanDescriptionAvatarSource: {instanceID: 0} 92 | animationType: 0 93 | humanoidOversampling: 1 94 | additionalBone: 0 95 | userData: 96 | assetBundleName: 97 | assetBundleVariant: 98 | -------------------------------------------------------------------------------- /Resources/cylinder.mtl: -------------------------------------------------------------------------------- 1 | # Blender MTL File: 'None' 2 | # Material Count: 1 3 | 4 | newmtl None 5 | Ns 0 6 | Ka 0.000000 0.000000 0.000000 7 | Kd 0.8 0.8 0.8 8 | Ks 0.8 0.8 0.8 9 | d 1 10 | illum 2 11 | -------------------------------------------------------------------------------- /Resources/cylinder.mtl.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3c7ccd27223bd44a586e57a0c74069d0 3 | timeCreated: 1511372598 4 | licenseType: Free 5 | DefaultImporter: 6 | externalObjects: {} 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Resources/cylinder.obj: -------------------------------------------------------------------------------- 1 | # Blender v2.78 (sub 0) OBJ File: '' 2 | # www.blender.org 3 | mtllib cylinder.mtl 4 | o Cylinder.001 5 | v 0.000000 -2.000000 -0.500000 6 | v 0.000000 2.000000 -0.500000 7 | v 0.097545 -2.000000 -0.490393 8 | v 0.097545 2.000000 -0.490393 9 | v 0.191342 -2.000000 -0.461940 10 | v 0.191342 2.000000 -0.461940 11 | v 0.277785 -2.000000 -0.415735 12 | v 0.277785 2.000000 -0.415735 13 | v 0.353553 -2.000000 -0.353553 14 | v 0.353553 2.000000 -0.353553 15 | v 0.415735 -2.000000 -0.277785 16 | v 0.415735 2.000000 -0.277785 17 | v 0.461940 -2.000000 -0.191342 18 | v 0.461940 2.000000 -0.191342 19 | v 0.490393 -2.000000 -0.097545 20 | v 0.490393 2.000000 -0.097545 21 | v 0.500000 -2.000000 -0.000000 22 | v 0.500000 2.000000 -0.000000 23 | v 0.490393 -2.000000 0.097545 24 | v 0.490393 2.000000 0.097545 25 | v 0.461940 -2.000000 0.191342 26 | v 0.461940 2.000000 0.191342 27 | v 0.415735 -2.000000 0.277785 28 | v 0.415735 2.000000 0.277785 29 | v 0.353553 -2.000000 0.353553 30 | v 0.353553 2.000000 0.353553 31 | v 0.277785 -2.000000 0.415735 32 | v 0.277785 2.000000 0.415735 33 | v 0.191342 -2.000000 0.461940 34 | v 0.191342 2.000000 0.461940 35 | v 0.097545 -2.000000 0.490393 36 | v 0.097545 2.000000 0.490393 37 | v -0.000000 -2.000000 0.500000 38 | v -0.000000 2.000000 0.500000 39 | v -0.097545 -2.000000 0.490393 40 | v -0.097545 2.000000 0.490393 41 | v -0.191342 -2.000000 0.461940 42 | v -0.191342 2.000000 0.461940 43 | v -0.277785 -2.000000 0.415735 44 | v -0.277785 2.000000 0.415735 45 | v -0.353554 -2.000000 0.353553 46 | v -0.353554 2.000000 0.353553 47 | v -0.415735 -2.000000 0.277785 48 | v -0.415735 2.000000 0.277785 49 | v -0.461940 -2.000000 0.191341 50 | v -0.461940 2.000000 0.191341 51 | v -0.490393 -2.000000 0.097545 52 | v -0.490393 2.000000 0.097545 53 | v -0.500000 -2.000000 -0.000000 54 | v -0.500000 2.000000 -0.000000 55 | v -0.490393 -2.000000 -0.097546 56 | v -0.490393 2.000000 -0.097546 57 | v -0.461940 -2.000000 -0.191342 58 | v -0.461940 2.000000 -0.191342 59 | v -0.415734 -2.000000 -0.277786 60 | v -0.415734 2.000000 -0.277786 61 | v -0.353553 -2.000000 -0.353554 62 | v -0.353553 2.000000 -0.353554 63 | v -0.277785 -2.000000 -0.415735 64 | v -0.277785 2.000000 -0.415735 65 | v -0.191341 -2.000000 -0.461940 66 | v -0.191341 2.000000 -0.461940 67 | v -0.097544 -2.000000 -0.490393 68 | v -0.097544 2.000000 -0.490393 69 | vn 0.0980 0.0000 -0.9952 70 | vn 0.2903 0.0000 -0.9569 71 | vn 0.4714 0.0000 -0.8819 72 | vn 0.6344 0.0000 -0.7730 73 | vn 0.7730 0.0000 -0.6344 74 | vn 0.8819 0.0000 -0.4714 75 | vn 0.9569 0.0000 -0.2903 76 | vn 0.9952 0.0000 -0.0980 77 | vn 0.9952 0.0000 0.0980 78 | vn 0.9569 0.0000 0.2903 79 | vn 0.8819 0.0000 0.4714 80 | vn 0.7730 0.0000 0.6344 81 | vn 0.6344 0.0000 0.7730 82 | vn 0.4714 0.0000 0.8819 83 | vn 0.2903 0.0000 0.9569 84 | vn 0.0980 0.0000 0.9952 85 | vn -0.0980 0.0000 0.9952 86 | vn -0.2903 0.0000 0.9569 87 | vn -0.4714 0.0000 0.8819 88 | vn -0.6344 0.0000 0.7730 89 | vn -0.7730 0.0000 0.6344 90 | vn -0.8819 0.0000 0.4714 91 | vn -0.9569 0.0000 0.2903 92 | vn -0.9952 0.0000 0.0980 93 | vn -0.9952 0.0000 -0.0980 94 | vn -0.9569 0.0000 -0.2903 95 | vn -0.8819 0.0000 -0.4714 96 | vn -0.7730 0.0000 -0.6344 97 | vn -0.6344 0.0000 -0.7730 98 | vn -0.4714 0.0000 -0.8819 99 | vn 0.0000 1.0000 0.0000 100 | vn -0.2903 0.0000 -0.9569 101 | vn -0.0980 0.0000 -0.9952 102 | vn 0.0000 -1.0000 -0.0000 103 | usemtl None 104 | s off 105 | f 1//1 2//1 4//1 3//1 106 | f 3//2 4//2 6//2 5//2 107 | f 5//3 6//3 8//3 7//3 108 | f 7//4 8//4 10//4 9//4 109 | f 9//5 10//5 12//5 11//5 110 | f 11//6 12//6 14//6 13//6 111 | f 13//7 14//7 16//7 15//7 112 | f 15//8 16//8 18//8 17//8 113 | f 17//9 18//9 20//9 19//9 114 | f 19//10 20//10 22//10 21//10 115 | f 21//11 22//11 24//11 23//11 116 | f 23//12 24//12 26//12 25//12 117 | f 25//13 26//13 28//13 27//13 118 | f 27//14 28//14 30//14 29//14 119 | f 29//15 30//15 32//15 31//15 120 | f 31//16 32//16 34//16 33//16 121 | f 33//17 34//17 36//17 35//17 122 | f 35//18 36//18 38//18 37//18 123 | f 37//19 38//19 40//19 39//19 124 | f 39//20 40//20 42//20 41//20 125 | f 41//21 42//21 44//21 43//21 126 | f 43//22 44//22 46//22 45//22 127 | f 45//23 46//23 48//23 47//23 128 | f 47//24 48//24 50//24 49//24 129 | f 49//25 50//25 52//25 51//25 130 | f 51//26 52//26 54//26 53//26 131 | f 53//27 54//27 56//27 55//27 132 | f 55//28 56//28 58//28 57//28 133 | f 57//29 58//29 60//29 59//29 134 | f 59//30 60//30 62//30 61//30 135 | f 4//31 2//31 64//31 62//31 60//31 58//31 56//31 54//31 52//31 50//31 48//31 46//31 44//31 42//31 40//31 38//31 36//31 34//31 32//31 30//31 28//31 26//31 24//31 22//31 20//31 18//31 16//31 14//31 12//31 10//31 8//31 6//31 136 | f 61//32 62//32 64//32 63//32 137 | f 63//33 64//33 2//33 1//33 138 | f 1//34 3//34 5//34 7//34 9//34 11//34 13//34 15//34 17//34 19//34 21//34 23//34 25//34 27//34 29//34 31//34 33//34 35//34 37//34 39//34 41//34 43//34 45//34 47//34 49//34 51//34 53//34 55//34 57//34 59//34 61//34 63//34 139 | -------------------------------------------------------------------------------- /Resources/cylinder.obj.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7fd6346f4e4b84679837a801b68982cf 3 | timeCreated: 1511372598 4 | licenseType: Free 5 | ModelImporter: 6 | serializedVersion: 22 7 | fileIDToRecycleName: 8 | 100000: //RootNode 9 | 100002: default 10 | 400000: //RootNode 11 | 400002: default 12 | 2300000: default 13 | 3300000: default 14 | 4300000: default 15 | externalObjects: 16 | - first: 17 | type: UnityEngine:Material 18 | assembly: UnityEngine.CoreModule 19 | name: None 20 | second: {fileID: 2100000, guid: 9a6259ea2af4a4c11845a939c87ed614, type: 2} 21 | materials: 22 | importMaterials: 1 23 | materialName: 0 24 | materialSearch: 1 25 | materialLocation: 0 26 | animations: 27 | legacyGenerateAnimations: 4 28 | bakeSimulation: 0 29 | resampleCurves: 1 30 | optimizeGameObjects: 0 31 | motionNodeName: 32 | rigImportErrors: 33 | rigImportWarnings: 34 | animationImportErrors: 35 | animationImportWarnings: 36 | animationRetargetingWarnings: 37 | animationDoRetargetingWarnings: 0 38 | importAnimatedCustomProperties: 0 39 | animationCompression: 1 40 | animationRotationError: 0.5 41 | animationPositionError: 0.5 42 | animationScaleError: 0.5 43 | animationWrapMode: 0 44 | extraExposedTransformPaths: [] 45 | extraUserProperties: [] 46 | clipAnimations: [] 47 | isReadable: 1 48 | meshes: 49 | lODScreenPercentages: [] 50 | globalScale: 1 51 | meshCompression: 0 52 | addColliders: 0 53 | importVisibility: 1 54 | importBlendShapes: 1 55 | importCameras: 1 56 | importLights: 1 57 | swapUVChannels: 0 58 | generateSecondaryUV: 0 59 | useFileUnits: 1 60 | optimizeMeshForGPU: 1 61 | keepQuads: 0 62 | weldVertices: 1 63 | secondaryUVAngleDistortion: 8 64 | secondaryUVAreaDistortion: 15.000001 65 | secondaryUVHardAngle: 88 66 | secondaryUVPackMargin: 4 67 | useFileScale: 1 68 | tangentSpace: 69 | normalSmoothAngle: 60 70 | normalImportMode: 0 71 | tangentImportMode: 3 72 | normalCalculationMode: 4 73 | importAnimation: 1 74 | copyAvatar: 0 75 | humanDescription: 76 | serializedVersion: 2 77 | human: [] 78 | skeleton: [] 79 | armTwist: 0.5 80 | foreArmTwist: 0.5 81 | upperLegTwist: 0.5 82 | legTwist: 0.5 83 | armStretch: 0.05 84 | legStretch: 0.05 85 | feetSpacing: 0 86 | rootMotionBoneName: 87 | rootMotionBoneRotation: {x: 0, y: 0, z: 0, w: 1} 88 | hasTranslationDoF: 0 89 | hasExtraRoot: 0 90 | skeletonHasParents: 1 91 | lastHumanDescriptionAvatarSource: {instanceID: 0} 92 | animationType: 0 93 | humanoidOversampling: 1 94 | additionalBone: 0 95 | userData: 96 | assetBundleName: 97 | assetBundleVariant: 98 | -------------------------------------------------------------------------------- /Resources/default.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1001 &100100000 4 | Prefab: 5 | m_ObjectHideFlags: 1 6 | serializedVersion: 2 7 | m_Modification: 8 | m_TransformParent: {fileID: 0} 9 | m_Modifications: [] 10 | m_RemovedComponents: [] 11 | m_ParentPrefab: {fileID: 0} 12 | m_RootGameObject: {fileID: 1336383360737538} 13 | m_IsPrefabParent: 1 14 | --- !u!1 &1336383360737538 15 | GameObject: 16 | m_ObjectHideFlags: 0 17 | m_PrefabParentObject: {fileID: 0} 18 | m_PrefabInternal: {fileID: 100100000} 19 | serializedVersion: 5 20 | m_Component: 21 | - component: {fileID: 4928593478726848} 22 | - component: {fileID: 33837411909727036} 23 | - component: {fileID: 23603358422957072} 24 | m_Layer: 0 25 | m_Name: default 26 | m_TagString: Untagged 27 | m_Icon: {fileID: 0} 28 | m_NavMeshLayer: 0 29 | m_StaticEditorFlags: 0 30 | m_IsActive: 1 31 | --- !u!4 &4928593478726848 32 | Transform: 33 | m_ObjectHideFlags: 1 34 | m_PrefabParentObject: {fileID: 0} 35 | m_PrefabInternal: {fileID: 100100000} 36 | m_GameObject: {fileID: 1336383360737538} 37 | m_LocalRotation: {x: 0, y: -0, z: -0, w: 1} 38 | m_LocalPosition: {x: -0, y: 0, z: 0} 39 | m_LocalScale: {x: 1, y: 1, z: 1} 40 | m_Children: [] 41 | m_Father: {fileID: 0} 42 | m_RootOrder: 0 43 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 44 | --- !u!23 &23603358422957072 45 | MeshRenderer: 46 | m_ObjectHideFlags: 1 47 | m_PrefabParentObject: {fileID: 0} 48 | m_PrefabInternal: {fileID: 100100000} 49 | m_GameObject: {fileID: 1336383360737538} 50 | m_Enabled: 1 51 | m_CastShadows: 1 52 | m_ReceiveShadows: 1 53 | m_DynamicOccludee: 1 54 | m_MotionVectors: 1 55 | m_LightProbeUsage: 1 56 | m_ReflectionProbeUsage: 1 57 | m_Materials: 58 | - {fileID: 2100000, guid: e30f55b4056a646a685b13b96974984a, type: 2} 59 | m_StaticBatchInfo: 60 | firstSubMesh: 0 61 | subMeshCount: 0 62 | m_StaticBatchRoot: {fileID: 0} 63 | m_ProbeAnchor: {fileID: 0} 64 | m_LightProbeVolumeOverride: {fileID: 0} 65 | m_ScaleInLightmap: 1 66 | m_PreserveUVs: 0 67 | m_IgnoreNormalsForChartDetection: 0 68 | m_ImportantGI: 0 69 | m_StitchLightmapSeams: 0 70 | m_SelectedEditorRenderState: 3 71 | m_MinimumChartSize: 4 72 | m_AutoUVMaxDistance: 0.5 73 | m_AutoUVMaxAngle: 89 74 | m_LightmapParameters: {fileID: 0} 75 | m_SortingLayerID: 0 76 | m_SortingLayer: 0 77 | m_SortingOrder: 0 78 | --- !u!33 &33837411909727036 79 | MeshFilter: 80 | m_ObjectHideFlags: 1 81 | m_PrefabParentObject: {fileID: 0} 82 | m_PrefabInternal: {fileID: 100100000} 83 | m_GameObject: {fileID: 1336383360737538} 84 | m_Mesh: {fileID: 4300000, guid: b299ae4db8fa64492937d362fbb09120, type: 3} 85 | -------------------------------------------------------------------------------- /Resources/default.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6b662122a269a474f9a4f295431b8bd0 3 | timeCreated: 1511363251 4 | licenseType: Free 5 | NativeFormatImporter: 6 | externalObjects: {} 7 | mainObjectFileID: 100100000 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Resources/normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alelievr/MasterUnityHandles/e375cc733f047de35e7fb4a98b495318e7de5be8/Resources/normal.png -------------------------------------------------------------------------------- /Resources/normal.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 28b4c11629c654fc88742b9b30e6b2b5 3 | timeCreated: 1511217403 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | externalObjects: {} 8 | serializedVersion: 4 9 | mipmaps: 10 | mipMapMode: 0 11 | enableMipMap: 0 12 | sRGBTexture: 0 13 | linearTexture: 0 14 | fadeOut: 0 15 | borderMipMap: 0 16 | mipMapsPreserveCoverage: 0 17 | alphaTestReferenceValue: 0.5 18 | mipMapFadeDistanceStart: 1 19 | mipMapFadeDistanceEnd: 3 20 | bumpmap: 21 | convertToNormalMap: 0 22 | externalNormalMap: 0 23 | heightScale: 0.25 24 | normalMapFilter: 0 25 | isReadable: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: 1 36 | mipBias: -1 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: -1 40 | nPOTScale: 0 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 0 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 49 | spritePixelsToUnits: 100 50 | alphaUsage: 1 51 | alphaIsTransparency: 1 52 | spriteTessellationDetail: -1 53 | textureType: 2 54 | textureShape: 1 55 | maxTextureSizeSet: 0 56 | compressionQualitySet: 0 57 | textureFormatSet: 0 58 | platformSettings: 59 | - buildTarget: DefaultTexturePlatform 60 | maxTextureSize: 2048 61 | resizeAlgorithm: 0 62 | textureFormat: -1 63 | textureCompression: 1 64 | compressionQuality: 50 65 | crunchedCompression: 0 66 | allowsAlphaSplitting: 0 67 | overridden: 0 68 | - buildTarget: Standalone 69 | maxTextureSize: 2048 70 | resizeAlgorithm: 0 71 | textureFormat: -1 72 | textureCompression: 1 73 | compressionQuality: 50 74 | crunchedCompression: 0 75 | allowsAlphaSplitting: 0 76 | overridden: 0 77 | - buildTarget: WebGL 78 | maxTextureSize: 2048 79 | resizeAlgorithm: 0 80 | textureFormat: -1 81 | textureCompression: 1 82 | compressionQuality: 50 83 | crunchedCompression: 0 84 | allowsAlphaSplitting: 0 85 | overridden: 0 86 | spriteSheet: 87 | serializedVersion: 2 88 | sprites: [] 89 | outline: [] 90 | physicsShape: [] 91 | spritePackingTag: 92 | userData: 93 | assetBundleName: 94 | assetBundleVariant: 95 | -------------------------------------------------------------------------------- /Resources/selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alelievr/MasterUnityHandles/e375cc733f047de35e7fb4a98b495318e7de5be8/Resources/selected.png -------------------------------------------------------------------------------- /Resources/selected.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dcf83e6723cb846cf9f7569a8d40e846 3 | timeCreated: 1511217394 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | externalObjects: {} 8 | serializedVersion: 4 9 | mipmaps: 10 | mipMapMode: 0 11 | enableMipMap: 0 12 | sRGBTexture: 0 13 | linearTexture: 0 14 | fadeOut: 0 15 | borderMipMap: 0 16 | mipMapsPreserveCoverage: 0 17 | alphaTestReferenceValue: 0.5 18 | mipMapFadeDistanceStart: 1 19 | mipMapFadeDistanceEnd: 3 20 | bumpmap: 21 | convertToNormalMap: 0 22 | externalNormalMap: 0 23 | heightScale: 0.25 24 | normalMapFilter: 0 25 | isReadable: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: 1 36 | mipBias: -1 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: -1 40 | nPOTScale: 0 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 0 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 49 | spritePixelsToUnits: 100 50 | alphaUsage: 1 51 | alphaIsTransparency: 1 52 | spriteTessellationDetail: -1 53 | textureType: 2 54 | textureShape: 1 55 | maxTextureSizeSet: 0 56 | compressionQualitySet: 0 57 | textureFormatSet: 0 58 | platformSettings: 59 | - buildTarget: DefaultTexturePlatform 60 | maxTextureSize: 2048 61 | resizeAlgorithm: 0 62 | textureFormat: -1 63 | textureCompression: 1 64 | compressionQuality: 50 65 | crunchedCompression: 0 66 | allowsAlphaSplitting: 0 67 | overridden: 0 68 | - buildTarget: Standalone 69 | maxTextureSize: 2048 70 | resizeAlgorithm: 0 71 | textureFormat: -1 72 | textureCompression: 1 73 | compressionQuality: 50 74 | crunchedCompression: 0 75 | allowsAlphaSplitting: 0 76 | overridden: 0 77 | - buildTarget: WebGL 78 | maxTextureSize: 2048 79 | resizeAlgorithm: 0 80 | textureFormat: -1 81 | textureCompression: 1 82 | compressionQuality: 50 83 | crunchedCompression: 0 84 | allowsAlphaSplitting: 0 85 | overridden: 0 86 | spriteSheet: 87 | serializedVersion: 2 88 | sprites: [] 89 | outline: [] 90 | physicsShape: [] 91 | spritePackingTag: 92 | userData: 93 | assetBundleName: 94 | assetBundleVariant: 95 | -------------------------------------------------------------------------------- /Resources/snapToolHandle.mtl: -------------------------------------------------------------------------------- 1 | # Blender MTL File: 'None' 2 | # Material Count: 1 3 | 4 | newmtl None 5 | Ns 96.078431 6 | Ka 1.000000 1.000000 1.000000 7 | Kd 0.640000 0.640000 0.640000 8 | Ks 0.500000 0.500000 0.500000 9 | Ke 0.000000 0.000000 0.000000 10 | Ni 1.000000 11 | d 1.000000 12 | illum 2 13 | -------------------------------------------------------------------------------- /Resources/snapToolHandle.mtl.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c4f7eaeff3f39443eabda40c95fa45ef 3 | timeCreated: 1511533822 4 | licenseType: Free 5 | DefaultImporter: 6 | externalObjects: {} 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Resources/snapToolHandle.obj: -------------------------------------------------------------------------------- 1 | # Blender v2.78 (sub 0) OBJ File: '' 2 | # www.blender.org 3 | mtllib snapToolHandle.mtl 4 | o Circle 5 | v -0.108393 -0.436615 -0.544927 6 | v 0.000000 -0.436615 -0.555603 7 | v 0.108392 -0.436615 -0.544927 8 | v 0.212619 -0.436615 -0.513310 9 | v 0.308676 -0.436615 -0.461967 10 | v 0.392870 -0.436615 -0.392871 11 | v 0.461966 -0.436615 -0.308677 12 | v 0.513310 -0.436615 -0.212621 13 | v 0.544927 -0.436615 -0.108393 14 | v 0.555603 -0.436615 -0.000001 15 | v 0.544927 -0.436616 0.108392 16 | v 0.513310 -0.436616 0.212620 17 | v 0.461967 -0.436616 0.308676 18 | v 0.392871 -0.436616 0.392870 19 | v 0.308677 -0.436616 0.461967 20 | v 0.212620 -0.436616 0.513310 21 | v 0.108393 -0.436616 0.544927 22 | v 0.000000 -0.436616 0.555603 23 | v -0.108393 -0.436616 0.544927 24 | v -0.212620 -0.436616 0.513310 25 | v -0.308676 -0.436616 0.461967 26 | v -0.392870 -0.436616 0.392870 27 | v -0.461967 -0.436616 0.308676 28 | v -0.513310 -0.436616 0.212620 29 | v -0.544927 -0.436616 0.108393 30 | v -0.555603 -0.436615 0.000000 31 | v -0.544927 -0.436615 -0.108393 32 | v -0.513310 -0.436615 -0.212620 33 | v -0.461967 -0.436615 -0.308676 34 | v -0.392870 -0.436615 -0.392870 35 | v -0.308676 -0.436615 -0.461967 36 | v -0.212620 -0.436615 -0.513310 37 | v -0.108393 0.436615 -0.544927 38 | v -0.212620 0.436615 -0.513310 39 | v -0.308676 0.436615 -0.461967 40 | v -0.392870 0.436615 -0.392870 41 | v -0.461967 0.436615 -0.308676 42 | v -0.513310 0.436615 -0.212620 43 | v -0.544927 0.436615 -0.108393 44 | v -0.555603 0.436615 0.000000 45 | v -0.544927 0.436615 0.108393 46 | v -0.513310 0.436615 0.212620 47 | v -0.461967 0.436615 0.308676 48 | v -0.392870 0.436615 0.392870 49 | v -0.308676 0.436615 0.461967 50 | v -0.212620 0.436615 0.513310 51 | v -0.108393 0.436615 0.544927 52 | v 0.000000 0.436615 0.555603 53 | v 0.108393 0.436615 0.544927 54 | v 0.212620 0.436615 0.513310 55 | v 0.308677 0.436615 0.461967 56 | v 0.392871 0.436615 0.392870 57 | v 0.461967 0.436615 0.308676 58 | v 0.513310 0.436615 0.212620 59 | v 0.544927 0.436615 0.108392 60 | v 0.555603 0.436615 -0.000001 61 | v 0.544927 0.436615 -0.108393 62 | v 0.513310 0.436615 -0.212621 63 | v 0.461966 0.436615 -0.308677 64 | v 0.392870 0.436615 -0.392871 65 | v 0.308676 0.436615 -0.461967 66 | v 0.212619 0.436615 -0.513310 67 | v 0.108392 0.436615 -0.544927 68 | v 0.000000 0.436615 -0.555603 69 | vn -0.0000 -1.0000 -0.0000 70 | vn 0.0000 1.0000 0.0000 71 | vn 0.2903 0.0000 -0.9569 72 | vn 0.2903 -0.0000 0.9569 73 | vn -0.7730 0.0000 -0.6344 74 | vn 0.0980 0.0000 -0.9952 75 | vn 0.4714 -0.0000 0.8819 76 | vn -0.8819 0.0000 -0.4714 77 | vn 0.6344 -0.0000 0.7730 78 | vn -0.9569 0.0000 -0.2903 79 | vn 0.7730 -0.0000 0.6344 80 | vn -0.9952 -0.0000 -0.0980 81 | vn 0.8819 -0.0000 0.4714 82 | vn -0.9952 0.0000 0.0980 83 | vn 0.9569 -0.0000 0.2903 84 | vn -0.9569 -0.0000 0.2903 85 | vn 0.9952 0.0000 0.0980 86 | vn -0.8819 -0.0000 0.4714 87 | vn 0.9952 0.0000 -0.0980 88 | vn -0.7730 -0.0000 0.6344 89 | vn 0.9569 0.0000 -0.2903 90 | vn -0.6344 -0.0000 0.7730 91 | vn 0.8819 0.0000 -0.4714 92 | vn -0.4714 -0.0000 0.8819 93 | vn -0.0980 0.0000 -0.9952 94 | vn 0.7730 0.0000 -0.6344 95 | vn -0.2903 -0.0000 0.9569 96 | vn -0.2903 0.0000 -0.9569 97 | vn 0.6344 0.0000 -0.7730 98 | vn -0.0980 -0.0000 0.9952 99 | vn -0.4714 0.0000 -0.8819 100 | vn 0.4714 0.0000 -0.8819 101 | vn 0.0980 -0.0000 0.9952 102 | vn -0.6344 0.0000 -0.7730 103 | usemtl None 104 | s 1 105 | f 1//1 2//1 3//1 4//1 5//1 6//1 7//1 8//1 9//1 10//1 11//1 12//1 13//1 14//1 15//1 16//1 17//1 18//1 19//1 20//1 21//1 22//1 23//1 24//1 25//1 26//1 27//1 28//1 29//1 30//1 31//1 32//1 106 | f 33//2 34//2 35//2 36//2 37//2 38//2 39//2 40//2 41//2 42//2 43//2 44//2 45//2 46//2 47//2 48//2 49//2 50//2 51//2 52//2 53//2 54//2 55//2 56//2 57//2 58//2 59//2 60//2 61//2 62//2 63//2 64//2 107 | f 4//3 3//3 63//3 62//3 108 | f 17//4 16//4 50//4 49//4 109 | f 30//5 29//5 37//5 36//5 110 | f 3//6 2//6 64//6 63//6 111 | f 16//7 15//7 51//7 50//7 112 | f 29//8 28//8 38//8 37//8 113 | f 15//9 14//9 52//9 51//9 114 | f 28//10 27//10 39//10 38//10 115 | f 14//11 13//11 53//11 52//11 116 | f 27//12 26//12 40//12 39//12 117 | f 13//13 12//13 54//13 53//13 118 | f 26//14 25//14 41//14 40//14 119 | f 12//15 11//15 55//15 54//15 120 | f 25//16 24//16 42//16 41//16 121 | f 11//17 10//17 56//17 55//17 122 | f 24//18 23//18 43//18 42//18 123 | f 10//19 9//19 57//19 56//19 124 | f 23//20 22//20 44//20 43//20 125 | f 9//21 8//21 58//21 57//21 126 | f 22//22 21//22 45//22 44//22 127 | f 8//23 7//23 59//23 58//23 128 | f 21//24 20//24 46//24 45//24 129 | f 2//25 1//25 33//25 64//25 130 | f 7//26 6//26 60//26 59//26 131 | f 20//27 19//27 47//27 46//27 132 | f 1//28 32//28 34//28 33//28 133 | f 6//29 5//29 61//29 60//29 134 | f 19//30 18//30 48//30 47//30 135 | f 32//31 31//31 35//31 34//31 136 | f 5//32 4//32 62//32 61//32 137 | f 18//33 17//33 49//33 48//33 138 | f 31//34 30//34 36//34 35//34 139 | -------------------------------------------------------------------------------- /Resources/snapToolHandle.obj.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b299ae4db8fa64492937d362fbb09120 3 | timeCreated: 1511363206 4 | licenseType: Free 5 | ModelImporter: 6 | serializedVersion: 22 7 | fileIDToRecycleName: 8 | 100000: default 9 | 100002: //RootNode 10 | 400000: default 11 | 400002: //RootNode 12 | 2300000: default 13 | 3300000: default 14 | 4300000: default 15 | externalObjects: 16 | - first: 17 | type: UnityEngine:Material 18 | assembly: UnityEngine.CoreModule 19 | name: None 20 | second: {fileID: 2100000, guid: 9a6259ea2af4a4c11845a939c87ed614, type: 2} 21 | - first: 22 | type: UnityEngine:Material 23 | assembly: UnityEngine.CoreModule 24 | name: defaultMat 25 | second: {fileID: 2100000, guid: e30f55b4056a646a685b13b96974984a, type: 2} 26 | materials: 27 | importMaterials: 1 28 | materialName: 0 29 | materialSearch: 1 30 | materialLocation: 0 31 | animations: 32 | legacyGenerateAnimations: 4 33 | bakeSimulation: 0 34 | resampleCurves: 1 35 | optimizeGameObjects: 0 36 | motionNodeName: 37 | rigImportErrors: 38 | rigImportWarnings: 39 | animationImportErrors: 40 | animationImportWarnings: 41 | animationRetargetingWarnings: 42 | animationDoRetargetingWarnings: 0 43 | importAnimatedCustomProperties: 0 44 | animationCompression: 1 45 | animationRotationError: 0.5 46 | animationPositionError: 0.5 47 | animationScaleError: 0.5 48 | animationWrapMode: 0 49 | extraExposedTransformPaths: [] 50 | extraUserProperties: [] 51 | clipAnimations: [] 52 | isReadable: 1 53 | meshes: 54 | lODScreenPercentages: [] 55 | globalScale: 1 56 | meshCompression: 0 57 | addColliders: 0 58 | importVisibility: 1 59 | importBlendShapes: 1 60 | importCameras: 1 61 | importLights: 1 62 | swapUVChannels: 0 63 | generateSecondaryUV: 0 64 | useFileUnits: 1 65 | optimizeMeshForGPU: 1 66 | keepQuads: 0 67 | weldVertices: 1 68 | secondaryUVAngleDistortion: 8 69 | secondaryUVAreaDistortion: 15.000001 70 | secondaryUVHardAngle: 88 71 | secondaryUVPackMargin: 4 72 | useFileScale: 1 73 | tangentSpace: 74 | normalSmoothAngle: 60 75 | normalImportMode: 0 76 | tangentImportMode: 3 77 | normalCalculationMode: 4 78 | importAnimation: 1 79 | copyAvatar: 0 80 | humanDescription: 81 | serializedVersion: 2 82 | human: [] 83 | skeleton: [] 84 | armTwist: 0.5 85 | foreArmTwist: 0.5 86 | upperLegTwist: 0.5 87 | legTwist: 0.5 88 | armStretch: 0.05 89 | legStretch: 0.05 90 | feetSpacing: 0 91 | rootMotionBoneName: 92 | rootMotionBoneRotation: {x: 0, y: 0, z: 0, w: 1} 93 | hasTranslationDoF: 0 94 | hasExtraRoot: 0 95 | skeletonHasParents: 1 96 | lastHumanDescriptionAvatarSource: {instanceID: 0} 97 | animationType: 0 98 | humanoidOversampling: 1 99 | additionalBone: 0 100 | userData: 101 | assetBundleName: 102 | assetBundleVariant: 103 | -------------------------------------------------------------------------------- /Resources/texturedMaterial.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: TexturedMaterial 10 | m_Shader: {fileID: 4800000, guid: e3c881c89fa81495da359dc1b0aa2474, type: 3} 11 | m_ShaderKeywords: 12 | m_LightmapFlags: 4 13 | m_EnableInstancingVariants: 0 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: -1 16 | stringTagMap: {} 17 | disabledShaderPasses: [] 18 | m_SavedProperties: 19 | serializedVersion: 3 20 | m_TexEnvs: 21 | - _BumpMap: 22 | m_Texture: {fileID: 0} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | - _DetailAlbedoMap: 26 | m_Texture: {fileID: 0} 27 | m_Scale: {x: 1, y: 1} 28 | m_Offset: {x: 0, y: 0} 29 | - _DetailMask: 30 | m_Texture: {fileID: 0} 31 | m_Scale: {x: 1, y: 1} 32 | m_Offset: {x: 0, y: 0} 33 | - _DetailNormalMap: 34 | m_Texture: {fileID: 0} 35 | m_Scale: {x: 1, y: 1} 36 | m_Offset: {x: 0, y: 0} 37 | - _EmissionMap: 38 | m_Texture: {fileID: 0} 39 | m_Scale: {x: 1, y: 1} 40 | m_Offset: {x: 0, y: 0} 41 | - _MainTex: 42 | m_Texture: {fileID: 0} 43 | m_Scale: {x: 1, y: 1} 44 | m_Offset: {x: 0, y: 0} 45 | - _MetallicGlossMap: 46 | m_Texture: {fileID: 0} 47 | m_Scale: {x: 1, y: 1} 48 | m_Offset: {x: 0, y: 0} 49 | - _OcclusionMap: 50 | m_Texture: {fileID: 0} 51 | m_Scale: {x: 1, y: 1} 52 | m_Offset: {x: 0, y: 0} 53 | - _ParallaxMap: 54 | m_Texture: {fileID: 0} 55 | m_Scale: {x: 1, y: 1} 56 | m_Offset: {x: 0, y: 0} 57 | m_Floats: 58 | - _BumpScale: 1 59 | - _Cutoff: 0.5 60 | - _DetailNormalMapScale: 1 61 | - _DstBlend: 0 62 | - _GlossMapScale: 1 63 | - _Glossiness: 0.5 64 | - _GlossyReflections: 1 65 | - _Metallic: 0 66 | - _Mode: 0 67 | - _OcclusionStrength: 1 68 | - _Parallax: 0.02 69 | - _SmoothnessTextureChannel: 0 70 | - _SpecularHighlights: 1 71 | - _SrcBlend: 1 72 | - _UVSec: 0 73 | - _ZWrite: 1 74 | m_Colors: 75 | - _Color: {r: 0.227451, g: 0.4784314, b: 0.972549, a: 0.93} 76 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 77 | -------------------------------------------------------------------------------- /Resources/texturedMaterial.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e7b277184f6db43f5b3e1d875b887e00 3 | timeCreated: 1510748765 4 | licenseType: Free 5 | NativeFormatImporter: 6 | externalObjects: {} 7 | mainObjectFileID: 2100000 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Resources/vertexColorMaterial.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: VertexColorMaterial 10 | m_Shader: {fileID: 4800000, guid: 6536f73c5833c427abd2b03b801cc3ed, type: 3} 11 | m_ShaderKeywords: 12 | m_LightmapFlags: 4 13 | m_EnableInstancingVariants: 0 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: -1 16 | stringTagMap: {} 17 | disabledShaderPasses: [] 18 | m_SavedProperties: 19 | serializedVersion: 3 20 | m_TexEnvs: 21 | - _BumpMap: 22 | m_Texture: {fileID: 0} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | - _DetailAlbedoMap: 26 | m_Texture: {fileID: 0} 27 | m_Scale: {x: 1, y: 1} 28 | m_Offset: {x: 0, y: 0} 29 | - _DetailMask: 30 | m_Texture: {fileID: 0} 31 | m_Scale: {x: 1, y: 1} 32 | m_Offset: {x: 0, y: 0} 33 | - _DetailNormalMap: 34 | m_Texture: {fileID: 0} 35 | m_Scale: {x: 1, y: 1} 36 | m_Offset: {x: 0, y: 0} 37 | - _EmissionMap: 38 | m_Texture: {fileID: 0} 39 | m_Scale: {x: 1, y: 1} 40 | m_Offset: {x: 0, y: 0} 41 | - _MainTex: 42 | m_Texture: {fileID: 0} 43 | m_Scale: {x: 1, y: 1} 44 | m_Offset: {x: 0, y: 0} 45 | - _MetallicGlossMap: 46 | m_Texture: {fileID: 0} 47 | m_Scale: {x: 1, y: 1} 48 | m_Offset: {x: 0, y: 0} 49 | - _OcclusionMap: 50 | m_Texture: {fileID: 0} 51 | m_Scale: {x: 1, y: 1} 52 | m_Offset: {x: 0, y: 0} 53 | - _ParallaxMap: 54 | m_Texture: {fileID: 0} 55 | m_Scale: {x: 1, y: 1} 56 | m_Offset: {x: 0, y: 0} 57 | m_Floats: 58 | - _BumpScale: 1 59 | - _Cutoff: 0.5 60 | - _DetailNormalMapScale: 1 61 | - _DstBlend: 0 62 | - _GlossMapScale: 1 63 | - _Glossiness: 0.5 64 | - _GlossyReflections: 1 65 | - _Metallic: 0 66 | - _Mode: 0 67 | - _OcclusionStrength: 1 68 | - _Parallax: 0.02 69 | - _SmoothnessTextureChannel: 0 70 | - _SpecularHighlights: 1 71 | - _SrcBlend: 1 72 | - _UVSec: 0 73 | - _ZWrite: 0 74 | m_Colors: 75 | - _Color: {r: 1, g: 1, b: 1, a: 1} 76 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 77 | -------------------------------------------------------------------------------- /Resources/vertexColorMaterial.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8c9d9d1f1f5934211befcb3f958976fe 3 | timeCreated: 1510324436 4 | licenseType: Free 5 | NativeFormatImporter: 6 | externalObjects: {} 7 | mainObjectFileID: 2100000 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Shaders.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 39127d4c48b5a4f0ead35e8f4740623b 3 | folderAsset: yes 4 | timeCreated: 1510324468 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Shaders/OverlayColorHandle.shader: -------------------------------------------------------------------------------- 1 | Shader "Handles/OverlayColor" 2 | { 3 | Properties 4 | { 5 | _Color ("Color", Color) = (1, 1, 1, 1) 6 | } 7 | SubShader 8 | { 9 | Tags { "RenderType"="Opaque" } 10 | LOD 100 11 | 12 | ZWrite Off 13 | ZTest Off 14 | Cull Off 15 | 16 | Pass 17 | { 18 | CGPROGRAM 19 | #pragma vertex vert 20 | #pragma fragment frag 21 | 22 | #include "UnityCG.cginc" 23 | 24 | struct appdata 25 | { 26 | float4 vertex : POSITION; 27 | float2 uv : TEXCOORD0; 28 | }; 29 | 30 | struct v2f 31 | { 32 | float2 uv : TEXCOORD0; 33 | float4 vertex : SV_POSITION; 34 | }; 35 | 36 | float4 _Color; 37 | 38 | v2f vert (appdata v) 39 | { 40 | v2f o; 41 | o.vertex = UnityObjectToClipPos(v.vertex); 42 | o.uv = v.uv; 43 | return o; 44 | } 45 | 46 | fixed4 frag (v2f i) : SV_Target 47 | { 48 | // sample the texture 49 | return _Color; 50 | } 51 | ENDCG 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Shaders/OverlayColorHandle.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 01e9f68f8b863406893a2dc8ee9a4340 3 | timeCreated: 1511536609 4 | licenseType: Free 5 | ShaderImporter: 6 | externalObjects: {} 7 | defaultTextures: [] 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Shaders/TexturedHandle.shader: -------------------------------------------------------------------------------- 1 | Shader "Handles/Textured" 2 | { 3 | Properties 4 | { 5 | _MainTex ("Texture", 2D) = "white" {} 6 | _Color ("Color", Color) = (1, 1, 1, 1) 7 | } 8 | SubShader 9 | { 10 | Tags { "RenderType"="Transparent" "RenderQueue"="Transparent" } 11 | LOD 100 12 | 13 | ZWrite Off 14 | Blend SrcAlpha OneMinusSrcAlpha 15 | Cull Off 16 | 17 | Pass 18 | { 19 | CGPROGRAM 20 | #pragma vertex vert 21 | #pragma fragment frag 22 | // make fog work 23 | #pragma multi_compile_fog 24 | 25 | #include "UnityCG.cginc" 26 | 27 | struct appdata 28 | { 29 | float4 vertex : POSITION; 30 | float2 uv : TEXCOORD0; 31 | }; 32 | 33 | struct v2f 34 | { 35 | float2 uv : TEXCOORD0; 36 | UNITY_FOG_COORDS(1) 37 | float4 vertex : SV_POSITION; 38 | }; 39 | 40 | sampler2D _MainTex; 41 | float4 _MainTex_ST; 42 | float4 _Color; 43 | 44 | v2f vert (appdata v) 45 | { 46 | v2f o; 47 | o.vertex = UnityObjectToClipPos(v.vertex); 48 | o.uv = TRANSFORM_TEX(v.uv, _MainTex); 49 | UNITY_TRANSFER_FOG(o,o.vertex); 50 | return o; 51 | } 52 | 53 | fixed4 frag (v2f i) : SV_Target 54 | { 55 | // sample the texture 56 | fixed4 col = tex2D(_MainTex, i.uv) * _Color; 57 | // apply fog 58 | UNITY_APPLY_FOG(i.fogCoord, col); 59 | return col; 60 | } 61 | ENDCG 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /Shaders/TexturedHandle.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e3c881c89fa81495da359dc1b0aa2474 3 | timeCreated: 1510748547 4 | licenseType: Free 5 | ShaderImporter: 6 | externalObjects: {} 7 | defaultTextures: [] 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Shaders/VertexColorHandle.shader: -------------------------------------------------------------------------------- 1 | Shader "Handles/VertexColor" 2 | { 3 | Properties 4 | { 5 | } 6 | SubShader 7 | { 8 | Tags { "RenderType"="Opaque" } 9 | LOD 100 10 | 11 | ZWrite Off 12 | Blend SrcAlpha OneMinusSrcAlpha 13 | Cull Off 14 | ZTest On 15 | 16 | Pass 17 | { 18 | CGPROGRAM 19 | #pragma vertex vert 20 | #pragma fragment frag 21 | // make fog work 22 | #pragma multi_compile_fog 23 | 24 | #include "UnityCG.cginc" 25 | 26 | struct appdata 27 | { 28 | float4 vertex : POSITION; 29 | float2 uv : TEXCOORD0; 30 | float4 color : COLOR; 31 | }; 32 | 33 | struct v2f 34 | { 35 | float2 uv : TEXCOORD0; 36 | UNITY_FOG_COORDS(1) 37 | float4 vertex : SV_POSITION; 38 | float4 color : COLOR; 39 | }; 40 | 41 | v2f vert (appdata v) 42 | { 43 | v2f o; 44 | o.vertex = UnityObjectToClipPos(v.vertex); 45 | o.color = v.color; 46 | UNITY_TRANSFER_FOG(o,o.vertex); 47 | return o; 48 | } 49 | 50 | fixed4 frag (v2f i) : SV_Target 51 | { 52 | fixed4 col = i.color; 53 | UNITY_APPLY_FOG(i.fogCoord, col); 54 | return col; 55 | } 56 | ENDCG 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Shaders/VertexColorHandle.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6536f73c5833c427abd2b03b801cc3ed 3 | timeCreated: 1510324486 4 | licenseType: Free 5 | ShaderImporter: 6 | externalObjects: {} 7 | defaultTextures: [] 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | --------------------------------------------------------------------------------