5 namespace UnityStandardAssets.ImageEffects
7 [CustomEditor (typeof(CameraMotionBlur))]
10 SerializedObject serObj;
12 SerializedProperty filterType;
13 SerializedProperty preview;
14 SerializedProperty previewScale;
15 SerializedProperty movementScale;
16 SerializedProperty jitter;
17 SerializedProperty rotationScale;
18 SerializedProperty maxVelocity;
19 SerializedProperty minVelocity;
20 SerializedProperty velocityScale;
21 SerializedProperty velocityDownsample;
22 SerializedProperty noiseTexture;
23 SerializedProperty showVelocity;
24 SerializedProperty showVelocityScale;
25 SerializedProperty excludeLayers;
28 serObj =
new SerializedObject (target);
30 filterType = serObj.FindProperty (
"filterType");
32 preview = serObj.FindProperty (
"preview");
33 previewScale = serObj.FindProperty (
"previewScale");
35 movementScale = serObj.FindProperty (
"movementScale");
36 rotationScale = serObj.FindProperty (
"rotationScale");
38 maxVelocity = serObj.FindProperty (
"maxVelocity");
39 minVelocity = serObj.FindProperty (
"minVelocity");
41 jitter = serObj.FindProperty (
"jitter");
43 excludeLayers = serObj.FindProperty (
"excludeLayers");
45 velocityScale = serObj.FindProperty (
"velocityScale");
46 velocityDownsample = serObj.FindProperty (
"velocityDownsample");
48 noiseTexture = serObj.FindProperty (
"noiseTexture");
52 public override void OnInspectorGUI () {
55 EditorGUILayout.LabelField(
"Simulates camera based motion blur", EditorStyles.miniLabel);
57 EditorGUILayout.PropertyField (filterType,
new GUIContent(
"Technique"));
58 if (filterType.enumValueIndex == 3 && !(target as
CameraMotionBlur).Dx11Support()) {
59 EditorGUILayout.HelpBox(
"DX11 mode not supported (need shader model 5)", MessageType.Info);
61 EditorGUILayout.PropertyField (velocityScale,
new GUIContent(
" Velocity Scale"));
62 if (filterType.enumValueIndex >= 2) {
63 EditorGUILayout.LabelField(
" Tile size used during reconstruction filter:", EditorStyles.miniLabel);
64 EditorGUILayout.Slider(maxVelocity, 2.0f, 10.0f,
new GUIContent(
" Velocity Max"));
67 EditorGUILayout.Slider (maxVelocity, 2.0f, 10.0f,
new GUIContent(
" Velocity Max"));
68 EditorGUILayout.Slider(minVelocity, 0.0f, 10.0f,
new GUIContent(
" Velocity Min"));
70 EditorGUILayout.Separator ();
72 EditorGUILayout.LabelField(
"Technique Specific");
74 if (filterType.enumValueIndex == 0) {
76 EditorGUILayout.PropertyField (rotationScale,
new GUIContent(
" Camera Rotation"));
77 EditorGUILayout.PropertyField (movementScale,
new GUIContent(
" Camera Movement"));
81 EditorGUILayout.PropertyField (excludeLayers,
new GUIContent(
" Exclude Layers"));
82 EditorGUILayout.PropertyField (velocityDownsample,
new GUIContent(
" Velocity Downsample"));
83 velocityDownsample.intValue = velocityDownsample.intValue < 1 ? 1 : velocityDownsample.intValue;
84 if (filterType.enumValueIndex >= 2) {
85 EditorGUILayout.PropertyField (noiseTexture,
new GUIContent(
" Sample Jitter"));
86 EditorGUILayout.Slider (jitter, 0.0f, 10.0f,
new GUIContent(
" Jitter Strength"));
90 EditorGUILayout.Separator ();
92 EditorGUILayout.PropertyField (preview,
new GUIContent(
"Preview"));
93 if (preview.boolValue)
94 EditorGUILayout.PropertyField (previewScale,
new GUIContent(
""));
96 serObj.ApplyModifiedProperties();