Thomas
7 年前
当前提交
641f9dc3
共有 9 个文件被更改,包括 588 次插入 和 293 次删除
-
423ScriptableRenderPipeline/Core/Volume/VolumeParameter.cs
-
144ScriptableRenderPipeline/Core/Volume/Editor/Drawers/FloatParameterDrawer.cs
-
107ScriptableRenderPipeline/Core/Volume/Editor/Drawers/IntParameterDrawer.cs
-
77ScriptableRenderPipeline/Core/Volume/Editor/Drawers/ClampedFloatParameterDrawer.cs
-
77ScriptableRenderPipeline/Core/Volume/Editor/Drawers/ClampedIntParameterDrawer.cs
-
42ScriptableRenderPipeline/Core/Volume/Editor/Drawers/RangeParameterDrawer.cs
-
11ScriptableRenderPipeline/Core/Volume/Editor/Drawers/RangeParameterDrawer.cs.meta
-
0/ScriptableRenderPipeline/Core/Volume/Editor/Drawers/FloatParameterDrawer.cs.meta
-
0/ScriptableRenderPipeline/Core/Volume/Editor/Drawers/IntParameterDrawer.cs.meta
|
|||
using UnityEngine; |
|||
using UnityEngine.Experimental.Rendering; |
|||
|
|||
namespace UnityEditor.Experimental.Rendering |
|||
{ |
|||
[VolumeParameterDrawer(typeof(MinFloatParameter))] |
|||
sealed class MinFloatParameterDrawer : VolumeParameterDrawer |
|||
{ |
|||
public override bool OnGUI(SerializedDataParameter parameter, GUIContent title) |
|||
{ |
|||
var value = parameter.value; |
|||
|
|||
if (value.propertyType != SerializedPropertyType.Float) |
|||
return false; |
|||
|
|||
var o = parameter.GetObjectRef<MinFloatParameter>(); |
|||
float v = EditorGUILayout.FloatField(title, value.floatValue); |
|||
value.floatValue = Mathf.Max(v, o.min); |
|||
return true; |
|||
} |
|||
} |
|||
|
|||
[VolumeParameterDrawer(typeof(NoInterpMinFloatParameter))] |
|||
sealed class NoInterpMinFloatParameterDrawer : VolumeParameterDrawer |
|||
{ |
|||
public override bool OnGUI(SerializedDataParameter parameter, GUIContent title) |
|||
{ |
|||
var value = parameter.value; |
|||
|
|||
if (value.propertyType != SerializedPropertyType.Float) |
|||
return false; |
|||
|
|||
var o = parameter.GetObjectRef<NoInterpMinFloatParameter>(); |
|||
float v = EditorGUILayout.FloatField(title, value.floatValue); |
|||
value.floatValue = Mathf.Max(v, o.min); |
|||
return true; |
|||
} |
|||
} |
|||
|
|||
[VolumeParameterDrawer(typeof(MaxFloatParameter))] |
|||
sealed class MaxFloatParameterDrawer : VolumeParameterDrawer |
|||
{ |
|||
public override bool OnGUI(SerializedDataParameter parameter, GUIContent title) |
|||
{ |
|||
var value = parameter.value; |
|||
|
|||
if (value.propertyType != SerializedPropertyType.Float) |
|||
return false; |
|||
|
|||
var o = parameter.GetObjectRef<MaxFloatParameter>(); |
|||
float v = EditorGUILayout.FloatField(title, value.floatValue); |
|||
value.floatValue = Mathf.Min(v, o.max); |
|||
return true; |
|||
} |
|||
} |
|||
|
|||
[VolumeParameterDrawer(typeof(NoInterpMaxFloatParameter))] |
|||
sealed class NoInterpMaxFloatParameterDrawer : VolumeParameterDrawer |
|||
{ |
|||
public override bool OnGUI(SerializedDataParameter parameter, GUIContent title) |
|||
{ |
|||
var value = parameter.value; |
|||
|
|||
if (value.propertyType != SerializedPropertyType.Float) |
|||
return false; |
|||
|
|||
var o = parameter.GetObjectRef<NoInterpMaxFloatParameter>(); |
|||
float v = EditorGUILayout.FloatField(title, value.floatValue); |
|||
value.floatValue = Mathf.Min(v, o.max); |
|||
return true; |
|||
} |
|||
} |
|||
|
|||
[VolumeParameterDrawer(typeof(ClampedFloatParameter))] |
|||
sealed class ClampedFloatParameterDrawer : VolumeParameterDrawer |
|||
{ |
|||
public override bool OnGUI(SerializedDataParameter parameter, GUIContent title) |
|||
{ |
|||
var value = parameter.value; |
|||
|
|||
if (value.propertyType != SerializedPropertyType.Float) |
|||
return false; |
|||
|
|||
var o = parameter.GetObjectRef<ClampedFloatParameter>(); |
|||
EditorGUILayout.Slider(value, o.min, o.max, title); |
|||
value.floatValue = Mathf.Clamp(value.floatValue, o.min, o.max); |
|||
return true; |
|||
} |
|||
} |
|||
|
|||
[VolumeParameterDrawer(typeof(NoInterpClampedFloatParameter))] |
|||
sealed class NoInterpClampedFloatParameterDrawer : VolumeParameterDrawer |
|||
{ |
|||
public override bool OnGUI(SerializedDataParameter parameter, GUIContent title) |
|||
{ |
|||
var value = parameter.value; |
|||
|
|||
if (value.propertyType != SerializedPropertyType.Float) |
|||
return false; |
|||
|
|||
var o = parameter.GetObjectRef<NoInterpClampedFloatParameter>(); |
|||
EditorGUILayout.Slider(value, o.min, o.max, title); |
|||
value.floatValue = Mathf.Clamp(value.floatValue, o.min, o.max); |
|||
return true; |
|||
} |
|||
} |
|||
|
|||
[VolumeParameterDrawer(typeof(FloatRangeParameter))] |
|||
sealed class FloatRangeParameterDrawer : VolumeParameterDrawer |
|||
{ |
|||
public override bool OnGUI(SerializedDataParameter parameter, GUIContent title) |
|||
{ |
|||
var value = parameter.value; |
|||
|
|||
if (value.propertyType != SerializedPropertyType.Vector2) |
|||
return false; |
|||
|
|||
var o = parameter.GetObjectRef<FloatRangeParameter>(); |
|||
var v = value.vector2Value; |
|||
|
|||
// The layout system breaks alignement when mixing inspector fields with custom layouted
|
|||
// fields as soon as a scrollbar is needed in the inspector, so we'll do the layout
|
|||
// manually instead
|
|||
const int kFloatFieldWidth = 50; |
|||
const int kSeparatorWidth = 5; |
|||
float indentOffset = EditorGUI.indentLevel * 15f; |
|||
var lineRect = GUILayoutUtility.GetRect(1, EditorGUIUtility.singleLineHeight); |
|||
lineRect.xMin += 4f; |
|||
lineRect.y += 2f; |
|||
var labelRect = new Rect(lineRect.x, lineRect.y, EditorGUIUtility.labelWidth - indentOffset, lineRect.height); |
|||
var floatFieldLeft = new Rect(labelRect.xMax, lineRect.y, kFloatFieldWidth + indentOffset, lineRect.height); |
|||
var sliderRect = new Rect(floatFieldLeft.xMax + kSeparatorWidth - indentOffset, lineRect.y, lineRect.width - labelRect.width - kFloatFieldWidth * 2 - kSeparatorWidth * 2, lineRect.height); |
|||
var floatFieldRight = new Rect(sliderRect.xMax + kSeparatorWidth - indentOffset, lineRect.y, kFloatFieldWidth + indentOffset, lineRect.height); |
|||
|
|||
EditorGUI.PrefixLabel(labelRect, title); |
|||
v.x = EditorGUI.FloatField(floatFieldLeft, v.x); |
|||
EditorGUI.MinMaxSlider(sliderRect, ref v.x, ref v.y, o.min, o.max); |
|||
v.y = EditorGUI.FloatField(floatFieldRight, v.y); |
|||
|
|||
value.vector2Value = v; |
|||
return true; |
|||
} |
|||
} |
|||
} |
|
|||
using UnityEngine; |
|||
using UnityEngine.Experimental.Rendering; |
|||
|
|||
namespace UnityEditor.Experimental.Rendering |
|||
{ |
|||
[VolumeParameterDrawer(typeof(MinIntParameter))] |
|||
sealed class MinIntParameterDrawer : VolumeParameterDrawer |
|||
{ |
|||
public override bool OnGUI(SerializedDataParameter parameter, GUIContent title) |
|||
{ |
|||
var value = parameter.value; |
|||
|
|||
if (value.propertyType != SerializedPropertyType.Integer) |
|||
return false; |
|||
|
|||
var o = parameter.GetObjectRef<MinIntParameter>(); |
|||
int v = EditorGUILayout.IntField(title, value.intValue); |
|||
value.intValue = Mathf.Max(v, o.min); |
|||
return true; |
|||
} |
|||
} |
|||
|
|||
[VolumeParameterDrawer(typeof(NoInterpMinIntParameter))] |
|||
sealed class NoInterpMinIntParameterDrawer : VolumeParameterDrawer |
|||
{ |
|||
public override bool OnGUI(SerializedDataParameter parameter, GUIContent title) |
|||
{ |
|||
var value = parameter.value; |
|||
|
|||
if (value.propertyType != SerializedPropertyType.Integer) |
|||
return false; |
|||
|
|||
var o = parameter.GetObjectRef<NoInterpMinIntParameter>(); |
|||
int v = EditorGUILayout.IntField(title, value.intValue); |
|||
value.intValue = Mathf.Max(v, o.min); |
|||
return true; |
|||
} |
|||
} |
|||
|
|||
[VolumeParameterDrawer(typeof(MaxIntParameter))] |
|||
sealed class MaxIntParameterDrawer : VolumeParameterDrawer |
|||
{ |
|||
public override bool OnGUI(SerializedDataParameter parameter, GUIContent title) |
|||
{ |
|||
var value = parameter.value; |
|||
|
|||
if (value.propertyType != SerializedPropertyType.Integer) |
|||
return false; |
|||
|
|||
var o = parameter.GetObjectRef<MaxIntParameter>(); |
|||
int v = EditorGUILayout.IntField(title, value.intValue); |
|||
value.intValue = Mathf.Min(v, o.max); |
|||
return true; |
|||
} |
|||
} |
|||
|
|||
[VolumeParameterDrawer(typeof(NoInterpMaxIntParameter))] |
|||
sealed class NoInterpMaxIntParameterDrawer : VolumeParameterDrawer |
|||
{ |
|||
public override bool OnGUI(SerializedDataParameter parameter, GUIContent title) |
|||
{ |
|||
var value = parameter.value; |
|||
|
|||
if (value.propertyType != SerializedPropertyType.Integer) |
|||
return false; |
|||
|
|||
var o = parameter.GetObjectRef<NoInterpMaxIntParameter>(); |
|||
int v = EditorGUILayout.IntField(title, value.intValue); |
|||
value.intValue = Mathf.Min(v, o.max); |
|||
return true; |
|||
} |
|||
} |
|||
|
|||
[VolumeParameterDrawer(typeof(ClampedIntParameter))] |
|||
sealed class ClampedIntParameterDrawer : VolumeParameterDrawer |
|||
{ |
|||
public override bool OnGUI(SerializedDataParameter parameter, GUIContent title) |
|||
{ |
|||
var value = parameter.value; |
|||
|
|||
if (value.propertyType != SerializedPropertyType.Integer) |
|||
return false; |
|||
|
|||
var o = parameter.GetObjectRef<ClampedIntParameter>(); |
|||
EditorGUILayout.IntSlider(value, o.min, o.max, title); |
|||
value.intValue = Mathf.Clamp(value.intValue, o.min, o.max); |
|||
return true; |
|||
} |
|||
} |
|||
|
|||
[VolumeParameterDrawer(typeof(NoInterpClampedIntParameter))] |
|||
sealed class NoInterpClampedIntParameterDrawer : VolumeParameterDrawer |
|||
{ |
|||
public override bool OnGUI(SerializedDataParameter parameter, GUIContent title) |
|||
{ |
|||
var value = parameter.value; |
|||
|
|||
if (value.propertyType != SerializedPropertyType.Integer) |
|||
return false; |
|||
|
|||
var o = parameter.GetObjectRef<NoInterpClampedIntParameter>(); |
|||
EditorGUILayout.IntSlider(value, o.min, o.max, title); |
|||
value.intValue = Mathf.Clamp(value.intValue, o.min, o.max); |
|||
return true; |
|||
} |
|||
} |
|||
} |
|
|||
using UnityEngine; |
|||
using UnityEngine.Experimental.Rendering; |
|||
|
|||
namespace UnityEditor.Experimental.Rendering |
|||
{ |
|||
[VolumeParameterDrawer(typeof(ClampedFloatParameter))] |
|||
sealed class ClampedFloatParameterDrawer : VolumeParameterDrawer |
|||
{ |
|||
public override bool OnGUI(SerializedDataParameter parameter, GUIContent title) |
|||
{ |
|||
var value = parameter.value; |
|||
|
|||
if (value.propertyType != SerializedPropertyType.Float) |
|||
return false; |
|||
|
|||
var o = parameter.GetObjectRef<ClampedFloatParameter>(); |
|||
|
|||
if (o.clampMode == ParameterClampMode.MinMax) |
|||
{ |
|||
EditorGUILayout.Slider(value, o.min, o.max, title); |
|||
value.floatValue = Mathf.Clamp(value.floatValue, o.min, o.max); |
|||
} |
|||
else if (o.clampMode == ParameterClampMode.Min) |
|||
{ |
|||
float v = EditorGUILayout.FloatField(title, value.floatValue); |
|||
value.floatValue = Mathf.Max(v, o.min); |
|||
} |
|||
else if (o.clampMode == ParameterClampMode.Max) |
|||
{ |
|||
float v = EditorGUILayout.FloatField(title, value.floatValue); |
|||
value.floatValue = Mathf.Min(v, o.max); |
|||
} |
|||
else |
|||
{ |
|||
return false; |
|||
} |
|||
|
|||
return true; |
|||
} |
|||
} |
|||
|
|||
[VolumeParameterDrawer(typeof(InstantClampedFloatParameter))] |
|||
sealed class InstantClampedFloatParameterDrawer : VolumeParameterDrawer |
|||
{ |
|||
public override bool OnGUI(SerializedDataParameter parameter, GUIContent title) |
|||
{ |
|||
var value = parameter.value; |
|||
|
|||
if (value.propertyType != SerializedPropertyType.Float) |
|||
return false; |
|||
|
|||
var o = parameter.GetObjectRef<InstantClampedFloatParameter>(); |
|||
|
|||
if (o.clampMode == ParameterClampMode.MinMax) |
|||
{ |
|||
EditorGUILayout.Slider(value, o.min, o.max, title); |
|||
value.floatValue = Mathf.Clamp(value.floatValue, o.min, o.max); |
|||
} |
|||
else if (o.clampMode == ParameterClampMode.Min) |
|||
{ |
|||
float v = EditorGUILayout.FloatField(title, value.floatValue); |
|||
value.floatValue = Mathf.Max(v, o.min); |
|||
} |
|||
else if (o.clampMode == ParameterClampMode.Max) |
|||
{ |
|||
float v = EditorGUILayout.FloatField(title, value.floatValue); |
|||
value.floatValue = Mathf.Min(v, o.max); |
|||
} |
|||
else |
|||
{ |
|||
return false; |
|||
} |
|||
|
|||
return true; |
|||
} |
|||
} |
|||
} |
|
|||
using UnityEngine; |
|||
using UnityEngine.Experimental.Rendering; |
|||
|
|||
namespace UnityEditor.Experimental.Rendering |
|||
{ |
|||
[VolumeParameterDrawer(typeof(ClampedIntParameter))] |
|||
sealed class ClampedIntParameterDrawer : VolumeParameterDrawer |
|||
{ |
|||
public override bool OnGUI(SerializedDataParameter parameter, GUIContent title) |
|||
{ |
|||
var value = parameter.value; |
|||
|
|||
if (value.propertyType != SerializedPropertyType.Integer) |
|||
return false; |
|||
|
|||
var o = parameter.GetObjectRef<ClampedIntParameter>(); |
|||
|
|||
if (o.clampMode == ParameterClampMode.MinMax) |
|||
{ |
|||
EditorGUILayout.IntSlider(value, o.min, o.max, title); |
|||
value.intValue = Mathf.Clamp(value.intValue, o.min, o.max); |
|||
} |
|||
else if (o.clampMode == ParameterClampMode.Min) |
|||
{ |
|||
int v = EditorGUILayout.IntField(title, value.intValue); |
|||
value.intValue = Mathf.Max(v, o.min); |
|||
} |
|||
else if (o.clampMode == ParameterClampMode.Max) |
|||
{ |
|||
int v = EditorGUILayout.IntField(title, value.intValue); |
|||
value.intValue = Mathf.Min(v, o.max); |
|||
} |
|||
else |
|||
{ |
|||
return false; |
|||
} |
|||
|
|||
return true; |
|||
} |
|||
} |
|||
|
|||
[VolumeParameterDrawer(typeof(InstantClampedIntParameter))] |
|||
sealed class InstantClampedIntParameterDrawer : VolumeParameterDrawer |
|||
{ |
|||
public override bool OnGUI(SerializedDataParameter parameter, GUIContent title) |
|||
{ |
|||
var value = parameter.value; |
|||
|
|||
if (value.propertyType != SerializedPropertyType.Integer) |
|||
return false; |
|||
|
|||
var o = parameter.GetObjectRef<InstantClampedIntParameter>(); |
|||
|
|||
if (o.clampMode == ParameterClampMode.MinMax) |
|||
{ |
|||
EditorGUILayout.IntSlider(value, o.min, o.max, title); |
|||
value.intValue = Mathf.Clamp(value.intValue, o.min, o.max); |
|||
} |
|||
else if (o.clampMode == ParameterClampMode.Min) |
|||
{ |
|||
int v = EditorGUILayout.IntField(title, value.intValue); |
|||
value.intValue = Mathf.Max(v, o.min); |
|||
} |
|||
else if (o.clampMode == ParameterClampMode.Max) |
|||
{ |
|||
int v = EditorGUILayout.IntField(title, value.intValue); |
|||
value.intValue = Mathf.Min(v, o.max); |
|||
} |
|||
else |
|||
{ |
|||
return false; |
|||
} |
|||
|
|||
return true; |
|||
} |
|||
} |
|||
} |
|
|||
using UnityEngine; |
|||
using UnityEngine.Experimental.Rendering; |
|||
|
|||
namespace UnityEditor.Experimental.Rendering |
|||
{ |
|||
[VolumeParameterDrawer(typeof(RangeParameter))] |
|||
sealed class RangeParameterDrawer : VolumeParameterDrawer |
|||
{ |
|||
public override bool OnGUI(SerializedDataParameter parameter, GUIContent title) |
|||
{ |
|||
var value = parameter.value; |
|||
|
|||
if (value.propertyType != SerializedPropertyType.Vector2) |
|||
return false; |
|||
|
|||
var o = parameter.GetObjectRef<RangeParameter>(); |
|||
var v = value.vector2Value; |
|||
|
|||
// The layout system breaks alignement when mixing inspector fields with custom layouted
|
|||
// fields as soon as a scrollbar is needed in the inspector, so we'll do the layout
|
|||
// manually instead
|
|||
const int kFloatFieldWidth = 50; |
|||
const int kSeparatorWidth = 5; |
|||
float indentOffset = EditorGUI.indentLevel * 15f; |
|||
var lineRect = GUILayoutUtility.GetRect(1, EditorGUIUtility.singleLineHeight); |
|||
lineRect.xMin += 4f; |
|||
lineRect.y += 2f; |
|||
var labelRect = new Rect(lineRect.x, lineRect.y, EditorGUIUtility.labelWidth - indentOffset, lineRect.height); |
|||
var floatFieldLeft = new Rect(labelRect.xMax, lineRect.y, kFloatFieldWidth + indentOffset, lineRect.height); |
|||
var sliderRect = new Rect(floatFieldLeft.xMax + kSeparatorWidth - indentOffset, lineRect.y, lineRect.width - labelRect.width - kFloatFieldWidth * 2 - kSeparatorWidth * 2, lineRect.height); |
|||
var floatFieldRight = new Rect(sliderRect.xMax + kSeparatorWidth - indentOffset, lineRect.y, kFloatFieldWidth + indentOffset, lineRect.height); |
|||
|
|||
EditorGUI.PrefixLabel(labelRect, title); |
|||
v.x = EditorGUI.FloatField(floatFieldLeft, v.x); |
|||
EditorGUI.MinMaxSlider(sliderRect, ref v.x, ref v.y, o.min, o.max); |
|||
v.y = EditorGUI.FloatField(floatFieldRight, v.y); |
|||
|
|||
value.vector2Value = v; |
|||
return true; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 54ad01bd6d555e0438e364d8b0f17e06 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue