blob: 42f551be47f69c463326820a40c676b3ba07c8d2 (
plain) (
blame)
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
|
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using UnityEditor;
using UnityEngine;
using Cinemachine.Utility;
namespace Cinemachine.Editor
{
[CustomEditor(typeof(CinemachineGroupComposer))]
internal class CinemachineGroupComposerEditor : CinemachineComposerEditor
{
// Specialization
private CinemachineGroupComposer MyTarget { get { return target as CinemachineGroupComposer; } }
protected string FieldPath<TValue>(Expression<Func<CinemachineGroupComposer, TValue>> expr)
{
return ReflectionHelpers.GetFieldPath(expr);
}
protected override List<string> GetExcludedPropertiesInInspector()
{
List<string> excluded = base.GetExcludedPropertiesInInspector();
CinemachineBrain brain = CinemachineCore.Instance.FindPotentialTargetBrain(MyTarget.VirtualCamera);
bool ortho = brain != null ? brain.OutputCamera.orthographic : false;
if (ortho)
{
excluded.Add(FieldPath(x => x.m_AdjustmentMode));
excluded.Add(FieldPath(x => x.m_MinimumFOV));
excluded.Add(FieldPath(x => x.m_MaximumFOV));
excluded.Add(FieldPath(x => x.m_MaxDollyIn));
excluded.Add(FieldPath(x => x.m_MaxDollyOut));
excluded.Add(FieldPath(x => x.m_MinimumDistance));
excluded.Add(FieldPath(x => x.m_MaximumDistance));
}
else
{
excluded.Add(FieldPath(x => x.m_MinimumOrthoSize));
excluded.Add(FieldPath(x => x.m_MaximumOrthoSize));
switch (MyTarget.m_AdjustmentMode)
{
case CinemachineGroupComposer.AdjustmentMode.DollyOnly:
excluded.Add(FieldPath(x => x.m_MinimumFOV));
excluded.Add(FieldPath(x => x.m_MaximumFOV));
break;
case CinemachineGroupComposer.AdjustmentMode.ZoomOnly:
excluded.Add(FieldPath(x => x.m_MaxDollyIn));
excluded.Add(FieldPath(x => x.m_MaxDollyOut));
excluded.Add(FieldPath(x => x.m_MinimumDistance));
excluded.Add(FieldPath(x => x.m_MaximumDistance));
break;
default:
break;
}
}
return excluded;
}
public override void OnInspectorGUI()
{
if (MyTarget.IsValid && MyTarget.TargetGroup == null)
EditorGUILayout.HelpBox(
"The Framing settings will be ignored because the LookAt target is not a kind of CinemachineTargetGroup",
MessageType.Info);
base.OnInspectorGUI();
}
[DrawGizmo(GizmoType.Active | GizmoType.InSelectionHierarchy, typeof(CinemachineGroupComposer))]
private static void DrawGroupComposerGizmos(CinemachineGroupComposer target, GizmoType selectionType)
{
// Show the group bounding box, as viewed from the camera position
if (target.TargetGroup != null)
{
Matrix4x4 m = Gizmos.matrix;
Bounds b = target.m_LastBounds;
Gizmos.matrix = target.m_lastBoundsMatrix;
Gizmos.color = Color.yellow;
Gizmos.DrawWireCube(b.center, b.size);
Gizmos.matrix = m;
}
}
}
}
|