initial commit
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
using System;
|
||||
using UnityEditor;
|
||||
|
||||
namespace UnityStandardAssets.CinematicEffects
|
||||
{
|
||||
[CustomEditor(typeof(AntiAliasing))]
|
||||
public class AntiAliasingEditor : Editor
|
||||
{
|
||||
private string[] methodNames =
|
||||
{
|
||||
"Subpixel Morphological Anti-aliasing",
|
||||
"Fast Approximate Anti-aliasing"
|
||||
};
|
||||
|
||||
private int m_SelectedMethod;
|
||||
|
||||
private SMAAEditor m_SMAAEditor = new SMAAEditor();
|
||||
private FXAAEditor m_FXAAEditor = new FXAAEditor();
|
||||
|
||||
IAntiAliasingEditor m_AntiAliasingEditor;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
m_SMAAEditor.OnEnable(serializedObject, "m_SMAA");
|
||||
m_FXAAEditor.OnEnable(serializedObject, "m_FXAA");
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
var antiAliasingTarget = (AntiAliasing)target;
|
||||
|
||||
m_SelectedMethod = antiAliasingTarget.method;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
m_SelectedMethod = EditorGUILayout.Popup("Method", m_SelectedMethod, methodNames);
|
||||
|
||||
bool dirty = false;
|
||||
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
if (m_SelectedMethod < 0)
|
||||
m_SelectedMethod = 0;
|
||||
else if (m_SelectedMethod > 1)
|
||||
m_SelectedMethod = 1;
|
||||
|
||||
antiAliasingTarget.method = m_SelectedMethod;
|
||||
dirty = true;
|
||||
}
|
||||
|
||||
if (m_SelectedMethod == 0)
|
||||
m_AntiAliasingEditor = m_SMAAEditor;
|
||||
else
|
||||
m_AntiAliasingEditor = m_FXAAEditor;
|
||||
|
||||
dirty |= m_AntiAliasingEditor.OnInspectorGUI(antiAliasingTarget.current);
|
||||
|
||||
if (dirty)
|
||||
{
|
||||
EditorUtility.SetDirty(antiAliasingTarget);
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6bd9375ab74a65448b556b0452e8c6af
|
||||
timeCreated: 1454593885
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,10 @@
|
||||
using UnityEditor;
|
||||
|
||||
namespace UnityStandardAssets.CinematicEffects
|
||||
{
|
||||
public interface IAntiAliasingEditor
|
||||
{
|
||||
void OnEnable(SerializedObject serializedObject, string path);
|
||||
bool OnInspectorGUI(IAntiAliasing target);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 015ee83e537e9e4438f403e2149c69ae
|
||||
timeCreated: 1454595240
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user