You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
101 lines
3.7 KiB
101 lines
3.7 KiB
using UnityEditor;
|
|
using UnityEngine;
|
|
|
|
namespace uc.Timeline
|
|
{/*
|
|
[CustomEditor(typeof(MoviePlayerClip))]
|
|
internal sealed class MoviePlayerClipEditor : UnityEditor.Editor
|
|
{
|
|
private static readonly string[] m_excludeFields = new string[] { "m_Script" };
|
|
private SerializedProperty mVirtualCameraProperty = null;
|
|
private static readonly GUIContent kVirtualCameraLabel
|
|
= new GUIContent("Virtual Camera", "The virtual camera to use for this shot");
|
|
|
|
private void OnEnable()
|
|
{
|
|
if (serializedObject != null)
|
|
mVirtualCameraProperty = serializedObject.FindProperty("VirtualCamera");
|
|
}
|
|
|
|
private void OnDisable()
|
|
{
|
|
DestroyComponentEditors();
|
|
}
|
|
|
|
private void OnDestroy()
|
|
{
|
|
DestroyComponentEditors();
|
|
}
|
|
|
|
public override void OnInspectorGUI()
|
|
{
|
|
MoviePlayerBase obj
|
|
= mVirtualCameraProperty.exposedReferenceValue as MoviePlayerBase;
|
|
if (obj == null)
|
|
{
|
|
serializedObject.Update();
|
|
EditorGUILayout.BeginHorizontal();
|
|
EditorGUILayout.PropertyField(mVirtualCameraProperty, kVirtualCameraLabel, GUILayout.ExpandWidth(true));
|
|
obj = mVirtualCameraProperty.exposedReferenceValue as MoviePlayerBase;
|
|
if ((obj == null) && GUILayout.Button(new GUIContent("Create"), GUILayout.ExpandWidth(false)))
|
|
{
|
|
//MoviePlayerBase vcam = CinemachineMenu.CreateDefaultVirtualCamera();
|
|
//mVirtualCameraProperty.exposedReferenceValue = vcam;
|
|
}
|
|
EditorGUILayout.EndHorizontal();
|
|
serializedObject.ApplyModifiedProperties();
|
|
}
|
|
else
|
|
{
|
|
serializedObject.Update();
|
|
DrawPropertiesExcluding(serializedObject, m_excludeFields);
|
|
|
|
// Create an editor for each of the cinemachine virtual cam and its components
|
|
UpdateComponentEditors(obj);
|
|
if (m_editors != null)
|
|
{
|
|
foreach (UnityEditor.Editor e in m_editors)
|
|
{
|
|
EditorGUILayout.Separator();
|
|
e.OnInspectorGUI();
|
|
}
|
|
}
|
|
serializedObject.ApplyModifiedProperties();
|
|
}
|
|
}
|
|
|
|
MoviePlayerBase m_cachedReferenceObject;
|
|
UnityEditor.Editor[] m_editors = null;
|
|
void UpdateComponentEditors(MoviePlayerBase obj)
|
|
{
|
|
if (m_cachedReferenceObject != obj)
|
|
{
|
|
DestroyComponentEditors();
|
|
m_cachedReferenceObject = obj;
|
|
if (obj != null)
|
|
{
|
|
MonoBehaviour[] components = obj.gameObject.GetComponents<MonoBehaviour>();
|
|
m_editors = new UnityEditor.Editor[components.Length + 1];
|
|
CreateCachedEditor(obj.gameObject.GetComponent<Transform>(), null, ref m_editors[0]);
|
|
for (int i = 0; i < components.Length; ++i)
|
|
CreateCachedEditor(components[i], null, ref m_editors[i + 1]);
|
|
}
|
|
}
|
|
}
|
|
|
|
void DestroyComponentEditors()
|
|
{
|
|
m_cachedReferenceObject = null;
|
|
if (m_editors != null)
|
|
{
|
|
for (int i = 0; i < m_editors.Length; ++i)
|
|
{
|
|
if (m_editors[i] != null)
|
|
UnityEngine.Object.DestroyImmediate(m_editors[i]);
|
|
m_editors[i] = null;
|
|
}
|
|
m_editors = null;
|
|
}
|
|
}
|
|
}*/
|
|
}
|
|
|