Frédéric Vauchelles
7 年前
当前提交
9f1e2799
共有 16 个文件被更改,包括 696 次插入 和 147 次删除
-
2ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/HDReflectionProbeUI.cs
-
29ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/PlanarReflectionProbeEditor.cs
-
19ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/PlanarReflectionProbeUI.cs
-
122ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/Volume/InfluenceVolumeUI.cs
-
12ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/Volume/SerializedInfluenceVolume.cs
-
40ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/Volumes/InfluenceVolume.cs
-
84ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/PlanarReflectionProbeUI.Drawers.cs
-
11ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/PlanarReflectionProbeUI.Drawers.cs.meta
-
58ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/PlanarReflectionProbeUI.Handles.cs
-
11ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/PlanarReflectionProbeUI.Handles.cs.meta
-
77ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/Volume/InfluenceVolumeUI.Drawers.cs
-
11ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/Volume/InfluenceVolumeUI.Drawers.cs.meta
-
115ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/Volume/InfluenceVolumeUI.Gizmos.cs
-
11ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/Volume/InfluenceVolumeUI.Gizmos.cs.meta
-
230ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/Volume/InfluenceVolumeUI.Handles.cs
-
11ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/Volume/InfluenceVolumeUI.Handles.cs.meta
|
|||
using System; |
|||
using UnityEditorInternal; |
|||
using UnityEngine; |
|||
|
|||
namespace UnityEditor.Experimental.Rendering.HDPipeline |
|||
{ |
|||
using _ = CoreEditorUtils; |
|||
using CED = CoreEditorDrawer<PlanarReflectionProbeUI, SerializedPlanarReflectionProbe>; |
|||
|
|||
partial class PlanarReflectionProbeUI |
|||
{ |
|||
public static readonly CED.IDrawer Inspector = CED.Group( |
|||
CED.Action((s, d, o) => EditorGUILayout.LabelField(_.GetContent("Projection Volume"), EditorStyles.boldLabel)), |
|||
CED.Action(Drawer_FieldProjectionVolumeReference), |
|||
CED.space, |
|||
CED.Action((s, d, o) => EditorGUILayout.LabelField(_.GetContent("Influence Volume"), EditorStyles.boldLabel)), |
|||
CED.Action(Drawer_Toolbar), |
|||
CED.space, |
|||
CED.Select( |
|||
(s, d, o) => s.influenceVolume, |
|||
(s, d, o) => d.influenceVolume, |
|||
InfluenceVolumeUI.SectionShape |
|||
) |
|||
); |
|||
|
|||
const EditMode.SceneViewEditMode EditBaseShape = EditMode.SceneViewEditMode.ReflectionProbeBox; |
|||
const EditMode.SceneViewEditMode EditInfluenceShape = EditMode.SceneViewEditMode.GridBox; |
|||
const EditMode.SceneViewEditMode EditInfluenceNormalShape = EditMode.SceneViewEditMode.Collider; |
|||
const EditMode.SceneViewEditMode EditCenter = EditMode.SceneViewEditMode.ReflectionProbeOrigin; |
|||
|
|||
static void Drawer_FieldProjectionVolumeReference(PlanarReflectionProbeUI s, SerializedPlanarReflectionProbe d, Editor o) |
|||
{ |
|||
EditorGUILayout.PropertyField(d.projectionVolumeReference, _.GetContent("Reference")); |
|||
} |
|||
|
|||
static readonly EditMode.SceneViewEditMode[] k_Toolbar_SceneViewEditModes = |
|||
{ |
|||
EditBaseShape, |
|||
EditInfluenceShape, |
|||
EditInfluenceNormalShape, |
|||
EditCenter |
|||
}; |
|||
static GUIContent[] s_Toolbar_Contents = null; |
|||
static GUIContent[] toolbar_Contents |
|||
{ |
|||
get |
|||
{ |
|||
return s_Toolbar_Contents ?? (s_Toolbar_Contents = new[] |
|||
{ |
|||
EditorGUIUtility.IconContent("EditCollider", "|Modify the base shape. (SHIFT+1)"), |
|||
EditorGUIUtility.IconContent("PreMatCube", "|Modify the influence volume. (SHIFT+2)"), |
|||
EditorGUIUtility.IconContent("SceneViewOrtho", "|Modify the influence normal volume. (SHIFT+3)"), |
|||
EditorGUIUtility.IconContent("MoveTool", "|Move the center.") |
|||
}); |
|||
} |
|||
} |
|||
static void Drawer_Toolbar(PlanarReflectionProbeUI s, SerializedPlanarReflectionProbe d, Editor o) |
|||
{ |
|||
GUILayout.BeginHorizontal(); |
|||
GUILayout.FlexibleSpace(); |
|||
GUI.changed = false; |
|||
|
|||
EditMode.DoInspectorToolbar(k_Toolbar_SceneViewEditModes, toolbar_Contents, GetBoundsGetter(o), o); |
|||
|
|||
GUILayout.FlexibleSpace(); |
|||
GUILayout.EndHorizontal(); |
|||
} |
|||
|
|||
static Func<Bounds> GetBoundsGetter(Editor o) |
|||
{ |
|||
return () => |
|||
{ |
|||
var bounds = new Bounds(); |
|||
foreach (Component targetObject in o.targets) |
|||
{ |
|||
var rp = targetObject.transform; |
|||
var b = rp.position; |
|||
bounds.Encapsulate(b); |
|||
} |
|||
return bounds; |
|||
}; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: ce4764ad508471d498f39a66388bb18d |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEditorInternal; |
|||
using UnityEngine.Experimental.Rendering; |
|||
|
|||
namespace UnityEditor.Experimental.Rendering.HDPipeline |
|||
{ |
|||
partial class PlanarReflectionProbeUI |
|||
{ |
|||
public static void DrawHandles(PlanarReflectionProbeUI s, PlanarReflectionProbe d, Editor o) |
|||
{ |
|||
var mat = d.transform.localToWorldMatrix; |
|||
|
|||
switch (EditMode.editMode) |
|||
{ |
|||
case EditBaseShape: |
|||
InfluenceVolumeUI.DrawHandles_EditBase(s.influenceVolume, d.influenceVolume, o, mat, d); |
|||
break; |
|||
case EditInfluenceShape: |
|||
InfluenceVolumeUI.DrawHandles_EditInfluence(s.influenceVolume, d.influenceVolume, o, mat, d); |
|||
break; |
|||
case EditInfluenceNormalShape: |
|||
InfluenceVolumeUI.DrawHandles_EditInfluenceNormal(s.influenceVolume, d.influenceVolume, o, mat, d); |
|||
break; |
|||
case EditCenter: |
|||
InfluenceVolumeUI.DrawHandles_EditCenter(s.influenceVolume, d.influenceVolume, o, mat, d); |
|||
break; |
|||
} |
|||
} |
|||
|
|||
[DrawGizmo(GizmoType.Selected)] |
|||
public static void DrawGizmos(PlanarReflectionProbe d, GizmoType gizmoType) |
|||
{ |
|||
PlanarReflectionProbeUI s; |
|||
if (!PlanarReflectionProbeEditor.TryGetUIStateFor(d, out s)) |
|||
return; |
|||
|
|||
var mat = d.transform.localToWorldMatrix; |
|||
|
|||
switch (EditMode.editMode) |
|||
{ |
|||
case EditBaseShape: |
|||
InfluenceVolumeUI.DrawGizmos_EditBase(s.influenceVolume, d.influenceVolume, mat); |
|||
break; |
|||
case EditInfluenceShape: |
|||
InfluenceVolumeUI.DrawGizmos_EditInfluence(s.influenceVolume, d.influenceVolume, mat); |
|||
break; |
|||
case EditInfluenceNormalShape: |
|||
InfluenceVolumeUI.DrawGizmos_EditInfluenceNormal(s.influenceVolume, d.influenceVolume, mat); |
|||
break; |
|||
case EditCenter: |
|||
InfluenceVolumeUI.DrawGizmos_EditCenter(s.influenceVolume, d.influenceVolume, mat); |
|||
break; |
|||
default: |
|||
InfluenceVolumeUI.DrawGizmos_EditNone(s.influenceVolume, d.influenceVolume, mat); |
|||
break; |
|||
} |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 8ee668677cd59784d8fb06a531b49a77 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine; |
|||
using UnityEngine.Experimental.Rendering.HDPipeline; |
|||
|
|||
namespace UnityEditor.Experimental.Rendering.HDPipeline |
|||
{ |
|||
using _ = CoreEditorUtils; |
|||
using CED = CoreEditorDrawer<InfluenceVolumeUI, SerializedInfluenceVolume>; |
|||
|
|||
partial class InfluenceVolumeUI |
|||
{ |
|||
public static readonly CED.IDrawer SectionShape; |
|||
|
|||
public static readonly CED.IDrawer SectionShapeBox = CED.Action(Drawer_SectionShapeBox); |
|||
public static readonly CED.IDrawer SectionShapeSphere = CED.Action(Drawer_SectionShapeSphere); |
|||
|
|||
static InfluenceVolumeUI() |
|||
{ |
|||
SectionShape = CED.Group( |
|||
CED.Action(Drawer_FieldShapeType), |
|||
CED.FadeGroup( |
|||
(s, d, o, i) => s.IsSectionExpanded_Shape((ShapeType)i), |
|||
true, |
|||
SectionShapeBox, |
|||
SectionShapeSphere |
|||
) |
|||
); |
|||
} |
|||
|
|||
static void Drawer_FieldShapeType(InfluenceVolumeUI s, SerializedInfluenceVolume d, Editor o) |
|||
{ |
|||
EditorGUILayout.PropertyField(d.shapeType, _.GetContent("Shape Type")); |
|||
} |
|||
|
|||
static void Drawer_SectionShapeBox(InfluenceVolumeUI s, SerializedInfluenceVolume d, Editor o) |
|||
{ |
|||
var maxFadeDistance = d.boxBaseSize.vector3Value * 0.5f; |
|||
var minFadeDistance = Vector3.zero; |
|||
|
|||
EditorGUILayout.PropertyField(d.boxBaseSize, _.GetContent("Box Size")); |
|||
EditorGUILayout.PropertyField(d.boxBaseOffset, _.GetContent("Box Offset")); |
|||
|
|||
EditorGUILayout.Space(); |
|||
|
|||
_.DrawVector6Slider( |
|||
_.GetContent("Influence Fade"), |
|||
d.boxInfluencePositiveFade, d.boxInfluenceNegativeFade, |
|||
minFadeDistance, maxFadeDistance); |
|||
|
|||
EditorGUILayout.Space(); |
|||
|
|||
_.DrawVector6Slider( |
|||
_.GetContent("Influence Normal Fade"), |
|||
d.boxInfluenceNormalPositiveFade, d.boxInfluenceNormalNegativeFade, |
|||
minFadeDistance, maxFadeDistance); |
|||
|
|||
EditorGUILayout.Space(); |
|||
|
|||
_.DrawVector6Slider( |
|||
_.GetContent("Influence Face Fade"), |
|||
d.boxPositiveFaceFade, d.boxNegativeFaceFade, |
|||
Vector3.zero, Vector3.one); |
|||
} |
|||
|
|||
static void Drawer_SectionShapeSphere(InfluenceVolumeUI s, SerializedInfluenceVolume d, Editor o) |
|||
{ |
|||
var maxFaceDistance = d.sphereBaseRadius.floatValue; |
|||
|
|||
EditorGUILayout.PropertyField(d.sphereBaseRadius, _.GetContent("Radius")); |
|||
EditorGUILayout.PropertyField(d.sphereBaseOffset, _.GetContent("Offset")); |
|||
|
|||
EditorGUILayout.Space(); |
|||
|
|||
EditorGUILayout.Slider(d.sphereInfluenceFade, 0, maxFaceDistance, _.GetContent("Influence Fade")); |
|||
EditorGUILayout.Slider(d.sphereInfluenceNormalFade, 0, maxFaceDistance, _.GetContent("Influence Normal Fade")); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 3bb195b0017843b459f27cd1431041c8 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine; |
|||
using UnityEngine.Experimental.Rendering.HDPipeline; |
|||
|
|||
namespace UnityEditor.Experimental.Rendering.HDPipeline |
|||
{ |
|||
partial class InfluenceVolumeUI |
|||
{ |
|||
public static void DrawGizmos_EditBase(InfluenceVolumeUI s, InfluenceVolume d, Matrix4x4 matrix) |
|||
{ |
|||
DrawGizmos_Generic(s, d, matrix, 0); |
|||
} |
|||
|
|||
public static void DrawGizmos_EditInfluence(InfluenceVolumeUI s, InfluenceVolume d, Matrix4x4 matrix) |
|||
{ |
|||
DrawGizmos_Generic(s, d, matrix, 1); |
|||
} |
|||
|
|||
public static void DrawGizmos_EditInfluenceNormal(InfluenceVolumeUI s, InfluenceVolume d, Matrix4x4 matrix) |
|||
{ |
|||
DrawGizmos_Generic(s, d, matrix, 2); |
|||
|
|||
} |
|||
|
|||
public static void DrawGizmos_EditCenter(InfluenceVolumeUI s, InfluenceVolume d, Matrix4x4 matrix) |
|||
{ |
|||
|
|||
} |
|||
|
|||
public static void DrawGizmos_EditNone(InfluenceVolumeUI s, InfluenceVolume d, Matrix4x4 matrix) |
|||
{ |
|||
DrawGizmos_Generic(s, d, matrix, -1); |
|||
} |
|||
|
|||
static void DrawGizmos_Generic(InfluenceVolumeUI s, InfluenceVolume d, Matrix4x4 matrix, int solidIndex) |
|||
{ |
|||
DrawGizmos_BaseHandle(s, d, matrix, solidIndex == 0, k_GizmoThemeColorBase); |
|||
DrawGizmos_FadeHandle( |
|||
s, d, matrix, |
|||
d.boxInfluenceOffset, d.boxInfluenceSizeOffset, |
|||
d.sphereInfluenceRadiusOffset, |
|||
solidIndex == 1, |
|||
k_GizmoThemeColorInfluence); |
|||
DrawGizmos_FadeHandle( |
|||
s, d, matrix, |
|||
d.boxInfluenceNormalOffset, d.boxInfluenceNormalSizeOffset, |
|||
d.sphereInfluenceNormalRadiusOffset, |
|||
solidIndex == 2, |
|||
k_GizmoThemeColorInfluenceNormal); |
|||
} |
|||
|
|||
static void DrawGizmos_BaseHandle( |
|||
InfluenceVolumeUI s, InfluenceVolume d, Matrix4x4 matrix, |
|||
bool isSolid, Color color) |
|||
{ |
|||
var mat = Gizmos.matrix; |
|||
var c = Gizmos.color; |
|||
Gizmos.matrix = matrix; |
|||
Gizmos.color = color; |
|||
switch (d.shapeType) |
|||
{ |
|||
case ShapeType.Box: |
|||
{ |
|||
if (isSolid) |
|||
Gizmos.DrawCube(d.boxBaseOffset, d.boxBaseSize); |
|||
else |
|||
Gizmos.DrawWireCube(d.boxBaseOffset, d.boxBaseSize); |
|||
break; |
|||
} |
|||
case ShapeType.Sphere: |
|||
{ |
|||
if (isSolid) |
|||
Gizmos.DrawSphere(d.sphereBaseOffset, d.sphereBaseRadius); |
|||
else |
|||
Gizmos.DrawWireSphere(d.sphereBaseOffset, d.sphereBaseRadius); |
|||
break; |
|||
} |
|||
} |
|||
Gizmos.matrix = mat; |
|||
Gizmos.color = c; |
|||
} |
|||
|
|||
static void DrawGizmos_FadeHandle( |
|||
InfluenceVolumeUI s, InfluenceVolume d, Matrix4x4 matrix, |
|||
Vector3 boxOffset, Vector3 boxSizeOffset, |
|||
float sphereOffset, |
|||
bool isSolid, Color color) |
|||
{ |
|||
var mat = Gizmos.matrix; |
|||
var c = Gizmos.color; |
|||
Gizmos.matrix = matrix; |
|||
Gizmos.color = color; |
|||
switch (d.shapeType) |
|||
{ |
|||
case ShapeType.Box: |
|||
{ |
|||
if (isSolid) |
|||
Gizmos.DrawCube(d.boxBaseOffset + boxOffset, d.boxBaseSize + boxSizeOffset); |
|||
else |
|||
Gizmos.DrawWireCube(d.boxBaseOffset + boxOffset, d.boxBaseSize + boxSizeOffset); |
|||
break; |
|||
} |
|||
case ShapeType.Sphere: |
|||
{ |
|||
if (isSolid) |
|||
Gizmos.DrawSphere(d.sphereBaseOffset, d.sphereBaseRadius + sphereOffset); |
|||
else |
|||
Gizmos.DrawWireSphere(d.sphereBaseOffset, d.sphereBaseRadius + sphereOffset); |
|||
break; |
|||
} |
|||
} |
|||
Gizmos.matrix = mat; |
|||
Gizmos.color = c; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 27c862f74a239bc4f996b8a8bbb971f5 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using UnityEditor.IMGUI.Controls; |
|||
using UnityEngine; |
|||
using UnityEngine.Experimental.Rendering.HDPipeline; |
|||
using Object = UnityEngine.Object; |
|||
|
|||
namespace UnityEditor.Experimental.Rendering.HDPipeline |
|||
{ |
|||
partial class InfluenceVolumeUI |
|||
{ |
|||
public static void DrawHandles_EditBase(InfluenceVolumeUI s, InfluenceVolume d, Editor o, Matrix4x4 matrix, Object sourceAsset) |
|||
{ |
|||
var mat = Handles.matrix; |
|||
var c = Handles.color; |
|||
Handles.matrix = matrix; |
|||
Handles.color = k_GizmoThemeColorBase; |
|||
switch (d.shapeType) |
|||
{ |
|||
case ShapeType.Box: |
|||
{ |
|||
var center = d.boxBaseOffset; |
|||
var size = d.boxBaseSize; |
|||
DrawBoxHandle( |
|||
s, d, o, sourceAsset, |
|||
s1 => s1.boxBaseHandle, |
|||
ref center, |
|||
ref size); |
|||
d.boxBaseOffset = center; |
|||
d.boxBaseSize = size; |
|||
break; |
|||
} |
|||
case ShapeType.Sphere: |
|||
{ |
|||
var center = d.sphereBaseOffset; |
|||
var radius = d.sphereBaseRadius; |
|||
DrawSphereHandle( |
|||
s, d, o, sourceAsset, |
|||
s1 => s1.sphereBaseHandle, |
|||
ref center, |
|||
ref radius); |
|||
d.sphereBaseOffset = center; |
|||
d.sphereBaseRadius = radius; |
|||
break; |
|||
} |
|||
} |
|||
Handles.matrix = mat; |
|||
Handles.color = c; |
|||
} |
|||
|
|||
public static void DrawHandles_EditInfluence(InfluenceVolumeUI s, InfluenceVolume d, Editor o, Matrix4x4 matrix, Object sourceAsset) |
|||
{ |
|||
var mat = Handles.matrix; |
|||
var c = Handles.color; |
|||
Handles.matrix = matrix; |
|||
Handles.color = k_GizmoThemeColorInfluence; |
|||
switch (d.shapeType) |
|||
{ |
|||
case ShapeType.Box: |
|||
{ |
|||
var positive = d.boxInfluencePositiveFade; |
|||
var negative = d.boxInfluenceNegativeFade; |
|||
DrawBoxFadeHandle( |
|||
s, d, o, sourceAsset, |
|||
s1 => s1.boxInfluenceHandle, |
|||
d.boxBaseOffset, d.boxBaseSize, |
|||
ref positive, |
|||
ref negative); |
|||
d.boxInfluencePositiveFade = positive; |
|||
d.boxInfluenceNegativeFade = negative; |
|||
break; |
|||
} |
|||
case ShapeType.Sphere: |
|||
{ |
|||
var fade = d.sphereInfluenceFade; |
|||
DrawSphereFadeHandle( |
|||
s, d, o, sourceAsset, |
|||
s1 => s1.sphereInfluenceHandle, |
|||
d.sphereBaseOffset, d.sphereBaseRadius, |
|||
ref fade); |
|||
d.sphereInfluenceFade = fade; |
|||
break; |
|||
} |
|||
} |
|||
Handles.matrix = mat; |
|||
Handles.color = c; |
|||
} |
|||
|
|||
public static void DrawHandles_EditInfluenceNormal(InfluenceVolumeUI s, InfluenceVolume d, Editor o, Matrix4x4 matrix, Object sourceAsset) |
|||
{ |
|||
var mat = Handles.matrix; |
|||
var c = Handles.color; |
|||
Handles.matrix = matrix; |
|||
Handles.color = k_GizmoThemeColorInfluenceNormal; |
|||
switch (d.shapeType) |
|||
{ |
|||
case ShapeType.Box: |
|||
{ |
|||
var positive = d.boxInfluenceNormalPositiveFade; |
|||
var negative = d.boxInfluenceNormalNegativeFade; |
|||
DrawBoxFadeHandle( |
|||
s, d, o, sourceAsset, |
|||
s1 => s1.boxInfluenceNormalHandle, |
|||
d.boxBaseOffset, d.boxBaseSize, |
|||
ref positive, |
|||
ref negative); |
|||
d.boxInfluenceNormalPositiveFade = positive; |
|||
d.boxInfluenceNormalNegativeFade = negative; |
|||
break; |
|||
} |
|||
case ShapeType.Sphere: |
|||
{ |
|||
var fade = d.sphereInfluenceNormalFade; |
|||
DrawSphereFadeHandle( |
|||
s, d, o, sourceAsset, |
|||
s1 => s1.sphereInfluenceNormalHandle, |
|||
d.sphereBaseOffset, d.sphereBaseRadius, |
|||
ref fade); |
|||
d.sphereInfluenceNormalFade = fade; |
|||
break; |
|||
} |
|||
} |
|||
Handles.matrix = mat; |
|||
Handles.color = c; |
|||
} |
|||
|
|||
public static void DrawHandles_EditCenter(InfluenceVolumeUI s, InfluenceVolume d, Editor o, Matrix4x4 matrix, Object sourceAsset) |
|||
{ |
|||
} |
|||
|
|||
static void DrawBoxHandle( |
|||
InfluenceVolumeUI s, InfluenceVolume d, Editor o, Object sourceAsset, |
|||
Func<InfluenceVolumeUI, BoxBoundsHandle> boundsGetter, |
|||
ref Vector3 center, ref Vector3 size) |
|||
{ |
|||
var b = boundsGetter(s); |
|||
b.center = center; |
|||
b.size = size; |
|||
|
|||
EditorGUI.BeginChangeCheck(); |
|||
b.DrawHandle(); |
|||
if (EditorGUI.EndChangeCheck()) |
|||
{ |
|||
Undo.RecordObject(sourceAsset, "Modified Base Volume AABB"); |
|||
|
|||
center = b.center; |
|||
size = b.size; |
|||
|
|||
EditorUtility.SetDirty(sourceAsset); |
|||
} |
|||
} |
|||
|
|||
static void DrawBoxFadeHandle( |
|||
InfluenceVolumeUI s, InfluenceVolume d, Editor o, Object sourceAsset, |
|||
Func<InfluenceVolumeUI, BoxBoundsHandle> boundsGetter, |
|||
Vector3 baseOffset, Vector3 baseSize, |
|||
ref Vector3 positive, ref Vector3 negative) |
|||
{ |
|||
var b = boundsGetter(s); |
|||
|
|||
b.center = baseOffset - (positive - negative) * 0.5f; |
|||
b.size = baseSize - positive - negative; |
|||
|
|||
EditorGUI.BeginChangeCheck(); |
|||
b.DrawHandle(); |
|||
if (EditorGUI.EndChangeCheck()) |
|||
{ |
|||
Undo.RecordObject(sourceAsset, "Modified Influence Volume"); |
|||
|
|||
var center = baseOffset; |
|||
var influenceSize = baseSize; |
|||
|
|||
var diff = 2 * (b.center - center); |
|||
var sum = influenceSize - b.size; |
|||
var positiveNew = (sum - diff) * 0.5f; |
|||
var negativeNew = (sum + diff) * 0.5f; |
|||
var blendDistancePositive = Vector3.Max(Vector3.zero, Vector3.Min(positiveNew, influenceSize)); |
|||
var blendDistanceNegative = Vector3.Max(Vector3.zero, Vector3.Min(negativeNew, influenceSize)); |
|||
|
|||
positive = blendDistancePositive; |
|||
negative = blendDistanceNegative; |
|||
|
|||
EditorUtility.SetDirty(sourceAsset); |
|||
} |
|||
} |
|||
|
|||
static void DrawSphereHandle( |
|||
InfluenceVolumeUI s, InfluenceVolume d, Editor o, Object sourceAsset, |
|||
Func<InfluenceVolumeUI, SphereBoundsHandle> boundsGetter, |
|||
ref Vector3 center, ref float radius) |
|||
{ |
|||
var b = boundsGetter(s); |
|||
b.center = center; |
|||
b.radius = radius; |
|||
|
|||
EditorGUI.BeginChangeCheck(); |
|||
b.DrawHandle(); |
|||
if (EditorGUI.EndChangeCheck()) |
|||
{ |
|||
Undo.RecordObject(sourceAsset, "Modified Base Volume AABB"); |
|||
|
|||
center = b.center; |
|||
radius = b.radius; |
|||
|
|||
EditorUtility.SetDirty(sourceAsset); |
|||
} |
|||
} |
|||
|
|||
static void DrawSphereFadeHandle( |
|||
InfluenceVolumeUI s, InfluenceVolume d, Editor o, Object sourceAsset, |
|||
Func<InfluenceVolumeUI, SphereBoundsHandle> boundsGetter, |
|||
Vector3 baseOffset, float baseRadius, |
|||
ref float radius) |
|||
{ |
|||
var b = boundsGetter(s); |
|||
b.center = baseOffset; |
|||
b.radius = Mathf.Clamp(baseRadius - radius, 0, baseRadius); |
|||
|
|||
EditorGUI.BeginChangeCheck(); |
|||
b.DrawHandle(); |
|||
if (EditorGUI.EndChangeCheck()) |
|||
{ |
|||
Undo.RecordObject(sourceAsset, "Modified Influence volume"); |
|||
|
|||
radius = Mathf.Clamp(baseRadius - b.radius, 0, baseRadius); |
|||
|
|||
EditorUtility.SetDirty(sourceAsset); |
|||
} |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: b7ed46e20ca504d4cae3c0a0c0ad3e79 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue