OSDN Git Service

Added Assets for main menu
[mindgames/Mindgames_main.git] / Mindgames / Library / PackageCache / com.unity.render-pipelines.high-definition@6.9.0-preview / Editor / RenderPipeline / HDBaseEditor.cs
1 using UnityEditor.Rendering;
2 using UnityEngine.Experimental.Rendering.HDPipeline;
3 using UnityEngine.Rendering;
4
5 namespace UnityEditor.Experimental.Rendering.HDPipeline
6 {
7     using UnityObject = UnityEngine.Object;
8
9     //
10     // Sample use:
11     //
12     // [CustomEditor(typeof(TestComponent)]
13     // class TestEditor : HDBaseEditor<TestComponent>
14     // {
15     //     SerializedProperty m_MyFloat;
16     //
17     //     protected override void OnEnable()
18     //     {
19     //         base.OnEnable();
20     //         m_MyFloat = properties.Find(x => x.myFloat);
21     //     }
22     //
23     //     public override void OnInspectorGUI()
24     //     {
25     //         EditorGUILayout.PropertyField(m_MyFloat);
26     //     }
27     // }
28     //
29     public class HDBaseEditor<T> : Editor
30         where T : UnityObject
31     {
32         internal PropertyFetcher<T> properties { get; private set; }
33
34         protected T m_Target
35         {
36             get { return target as T; }
37         }
38
39         protected T[] m_Targets
40         {
41             get { return targets as T[]; }
42         }
43
44         protected HDRenderPipeline m_HDPipeline
45         {
46             get { return RenderPipelineManager.currentPipeline as HDRenderPipeline; }
47         }
48
49         protected virtual void OnEnable()
50         {
51             properties = new PropertyFetcher<T>(serializedObject);
52         }
53     }
54 }