-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathCameraProjectionBlenderEditor.cs
More file actions
94 lines (68 loc) · 1.73 KB
/
CameraProjectionBlenderEditor.cs
File metadata and controls
94 lines (68 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
using System.Diagnostics;
using UnityEngine;
using UnityEditor;
namespace cmdwtf.UnityTools.Editor
{
/// <summary>
/// A teeny editor to add buttons to test the camera projection blender.
/// </summary>
[CustomEditor(typeof(CameraProjectionBlender))]
public class CameraProjectionBlenderEditor : CustomEditorBase
{
#region Overrides of Editor
/// <inheritdoc />
public override void OnInspectorGUI()
{
if (Application.isPlaying)
{
PlayingGUI();
}
base.OnInspectorGUI();
}
#endregion
private void PlayingGUI()
{
var cpb = target as CameraProjectionBlender;
if (cpb == null)
{
return;
}
GUILayout.Space(EditorGUIUtility.standardVerticalSpacing);
if (Debugger.IsAttached)
{
Color oldColor = GUI.color;
GUILayout.BeginHorizontal();
GUI.color = Color.yellow;
if (GUILayout.Button("Force Perspective"))
{
cpb.ForcePerspective();
}
if (GUILayout.Button("Force 'Almost Orthographic'"))
{
cpb.ForceAlmostOrthographic();
}
if (GUILayout.Button("Force Orthographic"))
{
cpb.ForceOrthographic();
}
GUILayout.EndHorizontal();
GUI.color = oldColor;
GUILayout.Space(EditorGUIUtility.standardVerticalSpacing);
}
GUILayout.BeginHorizontal();
GUI.enabled = !cpb.FinishedPerspective;
if (GUILayout.Button("Blend to Perspective"))
{
cpb.Perspective();
}
GUI.enabled = !cpb.FinishedOrthographic;
if (GUILayout.Button("Blend to Orthographic"))
{
cpb.Orthographic();
}
GUI.enabled = true;
GUILayout.EndHorizontal();
GUILayout.Space(EditorGUIUtility.standardVerticalSpacing);
}
}
}