浏览代码

Grouping advanced properties toggle inside the same header

/main
RSlysz 7 年前
当前提交
75331918
共有 2 个文件被更改,包括 51 次插入59 次删除
  1. 100
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeUI.Drawers.cs
  2. 10
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeUI.cs

100
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeUI.Drawers.cs


"Influence volume settings",
(s, p, o) => s.isSectionExpandedInfluenceVolume,
FoldoutOption.Indent,
CED.Action(Drawer_InfluenceAdvancedSwitch),
CED.space,
CED.Action(Drawer_InfluenceShape),
CED.space,
CED.Action(Drawer_InfluenceAreas),

p.blendDistanceNegative,
maxBlendDistance,
CoreEditorUtils.GetContent("Blend Distance|Area around the probe where it is blended with other probes. Only used in deferred probes."),
s.isSectionExpendedAdvancedBlendDistanceBoxShape
s.isSectionAdvancedInfluenceSettings
if (GUILayout.Button(toolbar_Contents[1], GUILayout.ExpandHeight(true), GUILayout.Width(28f), GUILayout.MinHeight(22f), GUILayout.MaxHeight((s.isSectionExpendedAdvancedBlendDistanceBoxShape.value ? 3 : 1) * (EditorGUIUtility.singleLineHeight + 3))))
if (GUILayout.Button(toolbar_Contents[1], GUILayout.ExpandHeight(true), GUILayout.Width(28f), GUILayout.MinHeight(22f), GUILayout.MaxHeight((s.isSectionAdvancedInfluenceSettings.value ? 3 : 1) * (EditorGUIUtility.singleLineHeight + 3))))
{
EditMode.ChangeEditMode(k_Toolbar_SceneViewEditModes[1], GetBoundsGetter(p)(), owner);
}

p.blendNormalDistanceNegative,
maxBlendDistance,
CoreEditorUtils.GetContent("Blend Normal Distance|Area around the probe where the normals influence the probe. Only used in deferred probes."),
s.isSectionExpendedAdvancedBlendNormalDistanceBoxShape
s.isSectionAdvancedInfluenceSettings
if (GUILayout.Button(toolbar_Contents[2], GUILayout.ExpandHeight(true), GUILayout.Width(28f), GUILayout.MinHeight(22f), GUILayout.MaxHeight((s.isSectionExpendedAdvancedBlendNormalDistanceBoxShape.value ? 3 : 1) * (EditorGUIUtility.singleLineHeight + 3))))
if (GUILayout.Button(toolbar_Contents[2], GUILayout.ExpandHeight(true), GUILayout.Width(28f), GUILayout.MinHeight(22f), GUILayout.MaxHeight((s.isSectionAdvancedInfluenceSettings.value ? 3 : 1) * (EditorGUIUtility.singleLineHeight + 3))))
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField(CoreEditorUtils.GetContent("Face fade|Fade faces of the cubemap."));
if (GUILayout.Button(CoreEditorUtils.GetContent(s.isSectionExpendedAdvancedBlendFaceFadeBoxShape.value ? "Hide" : "Advanced")))
{
s.isSectionExpendedAdvancedBlendFaceFadeBoxShape.value ^= true;
}
EditorGUILayout.EndHorizontal();
if (s.isSectionExpendedAdvancedBlendFaceFadeBoxShape.value)
if (s.isSectionAdvancedInfluenceSettings.value)
GUIContent.none, //CoreEditorUtils.GetContent("Face fade|Fade faces of the cubemap."),
CoreEditorUtils.GetContent("Face fade|Fade faces of the cubemap."),
p.boxSideFadePositive, p.boxSideFadeNegative, Vector3.zero, Vector3.one, HDReflectionProbeEditor.k_handlesColor);
}
}

Vector3 bdp = blendDistancePositive.vector3Value;
Vector3 bdn = blendDistanceNegative.vector3Value;
float maxDistance = Mathf.Max(bdp.x, bdp.y, bdp.z, bdn.x, bdn.y, bdn.z);
float originalMaxDistance = maxDistance;
GUIStyle styleTextDisabled = new GUIStyle(GUI.skin.textField);
styleTextDisabled.normal.textColor = Color.grey;
EditorGUILayout.BeginHorizontal();
EditorGUI.BeginChangeCheck();
maxDistance = EditorGUILayout.FloatField(content, maxDistance, advanced.value ? styleTextDisabled : GUI.skin.textField);
maxDistance = originalMaxDistance;
EditorGUI.EndChangeCheck();
}
else if (EditorGUI.EndChangeCheck())
{
Vector3 decal = Vector3.one * maxDistance;
bdp = decal;
bdn = decal;
bdp.x = Mathf.Clamp(bdp.x, 0f, maxBlendDistance.x);
bdp.y = Mathf.Clamp(bdp.y, 0f, maxBlendDistance.y);
bdp.z = Mathf.Clamp(bdp.z, 0f, maxBlendDistance.z);
bdn.x = Mathf.Clamp(bdp.x, 0f, maxBlendDistance.x);
bdn.y = Mathf.Clamp(bdp.y, 0f, maxBlendDistance.y);
bdn.z = Mathf.Clamp(bdp.z, 0f, maxBlendDistance.z);
blendDistancePositive.vector3Value = bdp;
blendDistanceNegative.vector3Value = bdn;
}
if (GUILayout.Button(CoreEditorUtils.GetContent(advanced.value ? "Hide" : "Advanced"), GUILayout.MaxWidth(70)))
{
advanced.value ^= true;
CoreEditorUtils.DrawVector6(
content,
blendDistancePositive, blendDistanceNegative, Vector3.zero, maxBlendDistance, HDReflectionProbeEditor.k_handlesColor);
EditorGUILayout.EndHorizontal();
if (advanced.value)
else
CoreEditorUtils.DrawVector6(
GUIContent.none,
blendDistancePositive, blendDistanceNegative, Vector3.zero, maxBlendDistance, HDReflectionProbeEditor.k_handlesColor);
float distance = bdp.x;
EditorGUI.BeginChangeCheck();
distance = EditorGUILayout.FloatField(content, distance);
if (EditorGUI.EndChangeCheck())
{
Vector3 decal = Vector3.one * distance;
bdp.x = Mathf.Clamp(decal.x, 0f, maxBlendDistance.x);
bdp.y = Mathf.Clamp(decal.y, 0f, maxBlendDistance.y);
bdp.z = Mathf.Clamp(decal.z, 0f, maxBlendDistance.z);
bdn.x = Mathf.Clamp(decal.x, 0f, maxBlendDistance.x);
bdn.y = Mathf.Clamp(decal.y, 0f, maxBlendDistance.y);
bdn.z = Mathf.Clamp(decal.z, 0f, maxBlendDistance.z);
blendDistancePositive.vector3Value = bdp;
blendDistanceNegative.vector3Value = bdn;
}
}
GUILayout.EndVertical();

s.SetModeTarget(p.mode.intValue);
foreach (var targetObject in p.so.targetObjects)
HDReflectionProbeEditorUtility.ResetProbeSceneTextureInMaterial((ReflectionProbe)targetObject);
}
}
static void Drawer_InfluenceAdvancedSwitch(HDReflectionProbeUI s, SerializedHDReflectionProbe p, Editor owner)
{
using (new EditorGUILayout.HorizontalScope())
{
GUILayout.FlexibleSpace();
bool advanced = s.isSectionAdvancedInfluenceSettings.value;
advanced = !GUILayout.Toggle(!advanced, CoreEditorUtils.GetContent("Normal|Normal parameters mode (only change for box shape)."), EditorStyles.miniButtonLeft, GUILayout.Width(60f), GUILayout.ExpandWidth(false));
advanced = GUILayout.Toggle(advanced, CoreEditorUtils.GetContent("Advanced|Advanced parameters mode (only change for box shape)."), EditorStyles.miniButtonRight, GUILayout.Width(60f), GUILayout.ExpandWidth(false));
if (s.isSectionAdvancedInfluenceSettings.value ^ advanced)
{
s.isSectionAdvancedInfluenceSettings.value = advanced;
if (!advanced)
{
p.blendDistanceNegative.vector3Value = p.blendDistancePositive.vector3Value = Vector3.one * p.blendDistancePositive.vector3Value.x;
p.blendNormalDistanceNegative.vector3Value = p.blendNormalDistancePositive.vector3Value = Vector3.one * p.blendNormalDistancePositive.vector3Value.x;
}
}
}
}

10
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeUI.cs


{
public partial class HDReflectionProbeUI : BaseUI<SerializedHDReflectionProbe>
{
const int k_AnimBoolSingleFieldCount = 7;
const int k_AnimBoolSingleFieldCount = 5;
static readonly int k_ReflectionProbeModeCount = Enum.GetValues(typeof(ReflectionProbeMode)).Length;
static readonly int k_ReflectionInfluenceShapeCount = Enum.GetValues(typeof(ShapeType)).Length;
static readonly int k_AnimBoolsCount = k_ReflectionProbeModeCount + k_ReflectionInfluenceShapeCount + k_AnimBoolSingleFieldCount;

public AnimBool isSectionExpandedInfluenceVolume { get { return m_AnimBools[1]; } }
public AnimBool isSectionExpandedCaptureSettings { get { return m_AnimBools[2]; } }
public AnimBool isSectionExpandedAdditional { get { return m_AnimBools[3]; } }
public AnimBool isSectionExpendedAdvancedBlendDistanceBoxShape { get { return m_AnimBools[4]; } }
public AnimBool isSectionExpendedAdvancedBlendNormalDistanceBoxShape { get { return m_AnimBools[5]; } }
public AnimBool isSectionExpendedAdvancedBlendFaceFadeBoxShape { get { return m_AnimBools[6]; } }
public AnimBool isSectionAdvancedInfluenceSettings { get { return m_AnimBools[4]; } }
public bool HasAndClearOperation(Operation op)
{

isSectionExpandedCaptureSettings.value = true;
isSectionExpandedInfluenceVolume.value = true;
isSectionExpandedAdditional.value = false;
isSectionExpendedAdvancedBlendDistanceBoxShape.value = false;
isSectionExpendedAdvancedBlendNormalDistanceBoxShape.value = false;
isSectionExpendedAdvancedBlendFaceFadeBoxShape.value = false;
isSectionAdvancedInfluenceSettings.value = false;
alternativeBoxInfluenceHandle = new Gizmo6FacesBox(monochromeFace:true, monochromeSelectedFace:true);
alternativeBoxBlendHandle = new Gizmo6FacesBoxContained(alternativeBoxInfluenceHandle, monochromeFace:true, monochromeSelectedFace:true);

正在加载...
取消
保存