59 changes: 51 additions & 8 deletions Editor/Mono/Inspector/JointEditor.cs
Expand Up @@ -57,7 +57,7 @@ internal override Bounds GetWorldBoundsOfTarget(UnityObject targetObject)
{
var bounds = base.GetWorldBoundsOfTarget(targetObject);
// ensure joint's anchor point is included in bounds
bounds.Encapsulate(GetHandleMatrix((T)targetObject).MultiplyPoint3x4(Vector3.zero));
bounds.Encapsulate(GetAngularLimitHandleMatrix((T)targetObject).MultiplyPoint3x4(Vector3.zero));
return bounds;
}

Expand All @@ -68,23 +68,66 @@ protected virtual void OnSceneGUI()
T joint = (T)target;
EditorGUI.BeginChangeCheck();

using (new Handles.DrawingScope(GetHandleMatrix(joint)))
using (new Handles.DrawingScope(GetAngularLimitHandleMatrix(joint)))
DoAngularLimitHandles(joint);

// wake up rigidbody in case current orientation is out of bounds of new limits
// wake up rigidbodies in case current orientation is out of bounds of new limits
if (EditorGUI.EndChangeCheck())
joint.GetComponent<Rigidbody>().WakeUp();
{
var rigidbody = joint.GetComponent<Rigidbody>();
if (rigidbody.isKinematic && joint.connectedBody != null)
joint.connectedBody.WakeUp();
else
rigidbody.WakeUp();
}
}
}

protected virtual Matrix4x4 GetConnectedBodyMatrix(T joint)
protected virtual void GetActors(
T joint,
out Rigidbody dynamicActor,
out Rigidbody connectedActor,
out int jointFrameActorIndex,
out bool rightHandedLimit
)
{
return joint.connectedBody == null ? Matrix4x4.identity : joint.connectedBody.transform.localToWorldMatrix;
jointFrameActorIndex = 1;
rightHandedLimit = false;

dynamicActor = joint.GetComponent<Rigidbody>();
connectedActor = joint.connectedBody;

if (dynamicActor.isKinematic && connectedActor != null && !connectedActor.isKinematic)
{
var temp = connectedActor;
connectedActor = dynamicActor;
dynamicActor = temp;
}
}

protected virtual Matrix4x4 GetHandleMatrix(T joint)
private Matrix4x4 GetAngularLimitHandleMatrix(T joint)
{
return GetConnectedBodyMatrix(joint) * joint.GetJointFrame();
Rigidbody dynamicActor, connectedActor;
int jointFrameActorIndex;
bool rightHandedLimit;
GetActors(joint, out dynamicActor, out connectedActor, out jointFrameActorIndex, out rightHandedLimit);

var connectedBodyRotation =
connectedActor == null ? Quaternion.identity : connectedActor.transform.rotation;

// to enhance usability, orient the limit region so the dynamic body is within it, assuming bodies were bound on opposite sides of the anchor
var jointFrame = joint.GetActorLocalPose(jointFrameActorIndex);
var jointFrameOrientation = Quaternion.LookRotation(
jointFrame.MultiplyVector(Vector3.forward),
jointFrame.MultiplyVector(rightHandedLimit ? Vector3.down : Vector3.up)
);

// point of rotation is about the anchor of the joint body, which is not necessarily aligned to the anchor on the connected body
var jointAnchorPosition = joint.anchor;
if (dynamicActor != null)
jointAnchorPosition = dynamicActor.transform.TransformPoint(jointAnchorPosition);

return Matrix4x4.TRS(jointAnchorPosition, connectedBodyRotation * jointFrameOrientation, Vector3.one);
}

protected virtual void DoAngularLimitHandles(T joint)
Expand Down
2 changes: 1 addition & 1 deletion Editor/Mono/Inspector/LODGroupEditor.cs
Expand Up @@ -83,7 +83,7 @@ private static Rect CalculateScreenRect(IEnumerable<Vector3> points)

public void OnSceneGUI()
{
if (Event.current.type != EventType.repaint
if (Event.current.type != EventType.Repaint
|| Camera.current == null
|| SceneView.lastActiveSceneView != SceneView.currentDrawingSceneView)
return;
Expand Down
4 changes: 2 additions & 2 deletions Editor/Mono/Inspector/LightProbeGroupInspector.cs
Expand Up @@ -197,7 +197,7 @@ public void PushProbePositions()

private void DrawTetrahedra()
{
if (Event.current.type != EventType.repaint)
if (Event.current.type != EventType.Repaint)
return;

if (SceneView.lastActiveSceneView)
Expand Down Expand Up @@ -284,7 +284,7 @@ public bool OnSceneGUI(Transform transform)
if (!m_Group.enabled)
return m_Editing;

if (Event.current.type == EventType.layout)
if (Event.current.type == EventType.Layout)
{
//If the group has moved / scaled since last frame need to retetra);)
if (m_LastPosition != m_Group.transform.position
Expand Down
6 changes: 3 additions & 3 deletions Editor/Mono/Inspector/LightProbeProxyVolumeEditor.cs
Expand Up @@ -59,7 +59,7 @@ static Styles()
public static GUIContent[] probePositionMode = (Enum.GetNames(typeof(LightProbeProxyVolume.ProbePositionMode)).Select(x => ObjectNames.NicifyVariableName(x)).ToArray()).Select(x => new GUIContent(x)).ToArray();
public static GUIContent[] refreshMode = (Enum.GetNames(typeof(LightProbeProxyVolume.RefreshMode)).Select(x => ObjectNames.NicifyVariableName(x)).ToArray()).Select(x => new GUIContent(x)).ToArray();
public static GUIContent resProbesPerUnit = EditorGUIUtility.TextContent("Density|Density in probes per world unit.");
public static GUIContent componentUnusedNote = EditorGUIUtility.TextContent("In order to use the component on this game object, the Light Probes property should be set to 'Use Proxy Volume' in Renderer and baked lightmaps should be disabled.");
public static GUIContent componentUnusedNote = EditorGUIUtility.TextContent("In order to use the component on this game object, the Light Probes property should be set to 'Use Proxy Volume' in Renderer.");
public static GUIContent noRendererNode = EditorGUIUtility.TextContent("The component is unused by this game object because there is no Renderer component attached.");
public static GUIContent noLightProbes = EditorGUIUtility.TextContent("The scene doesn't contain any light probes. Add light probes using Light Probe Group components (menu: Component->Rendering->Light Probe Group).");
public static GUIContent componentUnsuportedOnTreesNote = EditorGUIUtility.TextContent("Tree rendering doesn't support Light Probe Proxy Volume components.");
Expand Down Expand Up @@ -113,8 +113,8 @@ private bool componentUnusedWarningValue
get
{
Renderer renderer = ((LightProbeProxyVolume)target).GetComponent(typeof(Renderer)) as Renderer;
bool isLightmapped = (renderer != null) && LightmapEditorSettings.IsLightmappedOrDynamicLightmappedForRendering(renderer);
return (renderer != null) && (targets.Length == 1) && ((renderer.lightProbeUsage != LightProbeUsage.UseProxyVolume) || isLightmapped);
bool useLightProbes = (renderer != null) && LightProbes.AreLightProbesAllowed(renderer);
return (renderer != null) && (targets.Length == 1) && ((renderer.lightProbeUsage != LightProbeUsage.UseProxyVolume) || !useLightProbes);
}
}

Expand Down
14 changes: 9 additions & 5 deletions Editor/Mono/Inspector/LightingSettingsInspector.cs
Expand Up @@ -29,7 +29,7 @@ class Styles
public GUIContent Lighting = new GUIContent(EditorGUIUtility.TextContent("Lighting").text); // prevent the Lighting window icon from being added
public GUIContent MinimumChartSize = EditorGUIUtility.TextContent("Min Chart Size|Specifies the minimum texel size used for a UV chart. If stitching is required, a value of 4 will create a chart of 4x4 texels to store lighting and directionality. If stitching is not required, a value of 2 will reduce the texel density and provide better lighting build times and run time performance.");
public GUIContent ImportantGI = EditorGUIUtility.TextContent("Prioritize Illumination|When enabled, the object will be marked as a priority object and always included in lighting calculations. Useful for objects that will be strongly emissive to make sure that other objects will be illuminated by this object.");
public GUIContent StitchSeams = EditorGUIUtility.TextContent("Stitch Seams|When enabled, seams in baked lightmaps will get smoothed.");
public GUIContent StitchLightmapSeams = EditorGUIUtility.TextContent("Stitch Seams|When enabled, seams in baked lightmaps will get smoothed.");
public GUIContent AutoUVMaxDistance = EditorGUIUtility.TextContent("Max Distance|Specifies the maximum worldspace distance to be used for UV chart simplification. If charts are within this distance they will be simplified for optimization purposes.");
public GUIContent AutoUVMaxAngle = EditorGUIUtility.TextContent("Max Angle|Specifies the maximum angle in degrees between faces sharing a UV edge. If the angle between the faces is below this value, the UV charts will be simplified.");
public GUIContent LightmapParameters = EditorGUIUtility.TextContent("Lightmap Parameters|Allows the adjustment of advanced parameters that affect the process of generating a lightmap for an object using global illumination.");
Expand Down Expand Up @@ -80,7 +80,7 @@ class Styles
SerializedObject m_GameObjectsSerializedObject;
SerializedProperty m_StaticEditorFlags;
SerializedProperty m_ImportantGI;
SerializedProperty m_StitchSeams;
SerializedProperty m_StitchLightmapSeams;
SerializedProperty m_LightmapParameters;
SerializedProperty m_LightmapIndex;
SerializedProperty m_LightmapTilingOffsetX;
Expand Down Expand Up @@ -123,7 +123,7 @@ public LightingSettingsInspector(SerializedObject serializedObject)
m_GameObjectsSerializedObject = new SerializedObject(serializedObject.targetObjects.Select(t => ((Component)t).gameObject).ToArray());

m_ImportantGI = m_SerializedObject.FindProperty("m_ImportantGI");
m_StitchSeams = m_SerializedObject.FindProperty("m_StitchSeams");
m_StitchLightmapSeams = m_SerializedObject.FindProperty("m_StitchLightmapSeams");
m_LightmapParameters = m_SerializedObject.FindProperty("m_LightmapParameters");
m_LightmapIndex = m_SerializedObject.FindProperty("m_LightmapIndex");
m_LightmapTilingOffsetX = m_SerializedObject.FindProperty("m_LightmapTilingOffset.x");
Expand Down Expand Up @@ -228,8 +228,12 @@ public void RenderMeshSettings(bool showLightmapSettings)

EditorGUILayout.PropertyField(m_ImportantGI, s_Styles.ImportantGI);

if (isPrefabAsset || LightmapEditorSettings.lightmapper == LightmapEditorSettings.Lightmapper.PathTracer)
EditorGUILayout.PropertyField(m_StitchSeams, s_Styles.StitchSeams);
bool pathTracerIsActive = (
LightModeUtil.Get().AreBakedLightmapsEnabled() &&
LightmapEditorSettings.lightmapper == LightmapEditorSettings.Lightmapper.PathTracer);

if (isPrefabAsset || pathTracerIsActive)
EditorGUILayout.PropertyField(m_StitchLightmapSeams, s_Styles.StitchLightmapSeams);

LightmapParametersGUI(m_LightmapParameters, s_Styles.LightmapParameters);

Expand Down
4 changes: 2 additions & 2 deletions Editor/Mono/Inspector/MaterialEditor.cs
Expand Up @@ -1466,7 +1466,7 @@ public bool PropertiesGUI()
Renderer renderer = GetAssociatedRenderFromInspector();
if (renderer != null)
{
if (Event.current.type == EventType.layout)
if (Event.current.type == EventType.Layout)
{
renderer.GetPropertyBlock(m_PropertyBlock);
}
Expand Down Expand Up @@ -1643,7 +1643,7 @@ private bool PreviewSettingsMenuButton(out Rect buttonRect)
const float iconHeight = 6f;
Rect iconRect = new Rect(buttonRect.x + (buttonRect.width - iconWidth) / 2, buttonRect.y + (buttonRect.height - iconHeight) / 2, iconWidth, iconHeight);

if (Event.current.type == EventType.repaint)
if (Event.current.type == EventType.Repaint)
Styles.kReflectionProbePickerStyle.Draw(iconRect, false, false, false, false);

if (EditorGUI.DropdownButton(buttonRect, GUIContent.none, FocusType.Passive, GUIStyle.none))
Expand Down
2 changes: 1 addition & 1 deletion Editor/Mono/Inspector/NavMeshEditorHelpers.cs
Expand Up @@ -28,7 +28,7 @@ public static void OpenAreaSettings()

public static void DrawAgentDiagram(Rect rect, float agentRadius, float agentHeight, float agentClimb, float agentSlope)
{
if (Event.current.type != EventType.repaint)
if (Event.current.type != EventType.Repaint)
return;

float cylinderRadius = agentRadius;
Expand Down
3 changes: 0 additions & 3 deletions Editor/Mono/Inspector/PhysicsManagerInspector.cs
Expand Up @@ -56,9 +56,6 @@ public static void DoGUI(string title, ref bool show, ref Vector2 scrollPos, Get
Vector3 translate = new Vector3(labelSize + indent + checkboxSize * (numLayers - y) + topLeft.y + topLeft.x + scrollPos.y - clipOffset, topLeft.y + scrollPos.y, 0);
GUI.matrix = Matrix4x4.TRS(translate, Quaternion.identity, Vector3.one) * Matrix4x4.TRS(Vector3.zero, Quaternion.Euler(0, 0, 90), Vector3.one);

if (SystemInfo.graphicsDeviceVersion.StartsWith("Direct3D 9.0"))
GUI.matrix *= Matrix4x4.TRS(new Vector3(-0.5f, -0.5f, 0), Quaternion.identity, Vector3.one);

GUI.Label(new Rect(2 - topLeft.x - scrollPos.y, scrollPos.y - clipOffset, labelSize, checkboxSize), LayerMask.LayerToName(i), "RightLabel");
y++;
}
Expand Down
40 changes: 22 additions & 18 deletions Editor/Mono/Inspector/PlayerSettingsEditor/PlayerSettingsEditor.cs
Expand Up @@ -100,7 +100,6 @@ static class Styles
public static readonly GUIContent UIStatusBarStyle = EditorGUIUtility.TextContent("Status Bar Style");
public static readonly GUIContent useMacAppStoreValidation = EditorGUIUtility.TextContent("Mac App Store Validation");
public static readonly GUIContent macAppStoreCategory = EditorGUIUtility.TextContent("Category|'LSApplicationCategoryType'");
public static readonly GUIContent D3D9FullscreenMode = EditorGUIUtility.TextContent("D3D9 Fullscreen Mode");
public static readonly GUIContent D3D11FullscreenMode = EditorGUIUtility.TextContent("D3D11 Fullscreen Mode");
public static readonly GUIContent visibleInBackground = EditorGUIUtility.TextContent("Visible In Background");
public static readonly GUIContent allowFullscreenSwitch = EditorGUIUtility.TextContent("Allow Fullscreen Switch");
Expand Down Expand Up @@ -191,6 +190,7 @@ PlayerSettingsSplashScreenEditor splashScreenEditor

private static GraphicsJobMode[] m_GfxJobModeValues = new GraphicsJobMode[] { GraphicsJobMode.Native, GraphicsJobMode.Legacy };
private static GUIContent[] m_GfxJobModeNames = new GUIContent[] { new GUIContent("Native"), new GUIContent("Legacy") };
private static GUIContent[] m_XBoxOneGfxJobModeNames = new GUIContent[] { new GUIContent("Native - DX12"), new GUIContent("Legacy - DX11") };

// Section and tab selection state

Expand Down Expand Up @@ -290,7 +290,6 @@ PlayerSettingsSplashScreenEditor splashScreenEditor
SerializedProperty m_BakeCollisionMeshes;
SerializedProperty m_ResizableWindow;
SerializedProperty m_MacFullscreenMode;
SerializedProperty m_D3D9FullscreenMode;
SerializedProperty m_D3D11FullscreenMode;
SerializedProperty m_VisibleInBackground;
SerializedProperty m_AllowFullscreenSwitch;
Expand Down Expand Up @@ -444,7 +443,6 @@ void OnEnable()
m_ResizableWindow = FindPropertyAssert("resizableWindow");
m_UseMacAppStoreValidation = FindPropertyAssert("useMacAppStoreValidation");
m_MacAppStoreCategory = FindPropertyAssert("macAppStoreCategory");
m_D3D9FullscreenMode = FindPropertyAssert("d3d9FullscreenMode");
m_D3D11FullscreenMode = FindPropertyAssert("d3d11FullscreenMode");
m_VisibleInBackground = FindPropertyAssert("visibleInBackground");
m_AllowFullscreenSwitch = FindPropertyAssert("allowFullscreenSwitch");
Expand Down Expand Up @@ -888,21 +886,8 @@ public void ResolutionSectionGUI(BuildTargetGroup targetGroup, ISettingEditorExt
EditorGUILayout.PropertyField(m_UsePlayerLog);
EditorGUILayout.PropertyField(m_ResizableWindow);
EditorGUILayout.PropertyField(m_MacFullscreenMode);
EditorGUILayout.PropertyField(m_D3D9FullscreenMode, Styles.D3D9FullscreenMode);
EditorGUILayout.PropertyField(m_D3D11FullscreenMode, Styles.D3D11FullscreenMode);

// If we are on DX9 and using Exclusive mode -> not visible in background is implied
var apisWin = PlayerSettings.GetGraphicsAPIs(BuildTarget.StandaloneWindows);
var dx9FirstAPI = apisWin.Length >= 1 && apisWin[0] == GraphicsDeviceType.Direct3D9;
bool dx9ExclusiveMode = m_D3D9FullscreenMode.intValue == (int)D3D9FullscreenMode.ExclusiveMode;
var alwaysVisibleBackground = (dx9FirstAPI && dx9ExclusiveMode);
if (alwaysVisibleBackground)
m_VisibleInBackground.boolValue = false;
using (new EditorGUI.DisabledScope(alwaysVisibleBackground))
{
EditorGUILayout.PropertyField(m_VisibleInBackground, Styles.visibleInBackground);
}

EditorGUILayout.PropertyField(m_VisibleInBackground, Styles.visibleInBackground);
EditorGUILayout.PropertyField(m_AllowFullscreenSwitch, Styles.allowFullscreenSwitch);

EditorGUILayout.PropertyField(m_ForceSingleInstance);
Expand Down Expand Up @@ -1113,6 +1098,10 @@ void GraphicsAPIsGUIOnePlatform(BuildTargetGroup targetGroup, BuildTarget target
if (availableDevices == null || availableDevices.Length < 2)
return;

// we do not want XboxOne users to select D3D12 via dropdown list. we only want to switch to D3D12 if native jobs are selected and otherwise default to D3D11.
if (targetGroup == BuildTargetGroup.XboxOne)
return;

// toggle for automatic API selection
EditorGUI.BeginChangeCheck();
var automatic = PlayerSettings.GetUseDefaultGraphicsAPIs(targetPlatform);
Expand Down Expand Up @@ -1627,12 +1616,27 @@ private void OtherSectionRenderingGUI(BuildPlatform platform, BuildTargetGroup t
using (new EditorGUI.DisabledScope(!m_GraphicsJobs.boolValue))
{
GraphicsJobMode currGfxJobMode = PlayerSettings.graphicsJobMode;
GraphicsJobMode newGfxJobMode = BuildEnumPopup(Styles.graphicsJobsMode, currGfxJobMode, m_GfxJobModeValues, m_GfxJobModeNames);
GraphicsJobMode newGfxJobMode = BuildEnumPopup(Styles.graphicsJobsMode, currGfxJobMode, m_GfxJobModeValues, targetGroup == BuildTargetGroup.XboxOne ? m_XBoxOneGfxJobModeNames : m_GfxJobModeNames);
if (newGfxJobMode != currGfxJobMode)
{
PlayerSettings.graphicsJobMode = newGfxJobMode;
}
}
if (targetGroup == BuildTargetGroup.XboxOne)
{
// for xboxone gfx job mode is the renderer api selector, use D3D12 only if the jobs are enabled and native selected...
bool isXBoxOneD3D12Required = m_GraphicsJobs.boolValue && (PlayerSettings.graphicsJobMode == GraphicsJobMode.Native);
GraphicsDeviceType[] gfxAPIs = PlayerSettings.GetGraphicsAPIs(BuildTarget.XboxOne);
GraphicsDeviceType newGfxAPI = isXBoxOneD3D12Required ? GraphicsDeviceType.XboxOneD3D12 : GraphicsDeviceType.XboxOne;
if (newGfxAPI != gfxAPIs[0])
{
ChangeGraphicsApiAction action = CheckApplyGraphicsAPIList(BuildTarget.XboxOne, true);
if (action.changeList)
{
ApplyChangeGraphicsApiAction(BuildTarget.XboxOne, new GraphicsDeviceType[] { newGfxAPI }, action);
}
}
}
}

if (m_VRSettings.TargetGroupSupportsVirtualReality(targetGroup))
Expand Down
4 changes: 2 additions & 2 deletions Editor/Mono/Inspector/QualitySettingsEditor.cs
Expand Up @@ -166,7 +166,7 @@ private int DoQualityLevelSelection(int currentQualitylevel, IList<QualitySettin
isDefaultQuality = true;

var toggleRect = GUILayoutUtility.GetRect(Styles.kPlatformTooltip, Styles.kToggle, GUILayout.MinWidth(Styles.kMinToggleWidth), GUILayout.MaxWidth(Styles.kMaxToggleWidth));
if (Event.current.type == EventType.repaint)
if (Event.current.type == EventType.Repaint)
{
bgStyle.Draw(toggleRect, GUIContent.none, false, false, selected, false);
}
Expand All @@ -190,7 +190,7 @@ private int DoQualityLevelSelection(int currentQualitylevel, IList<QualitySettin

//Extra column for deleting quality button
var deleteButton = GUILayoutUtility.GetRect(GUIContent.none, Styles.kToggle, GUILayout.MinWidth(Styles.kMinToggleWidth), GUILayout.MaxWidth(Styles.kMaxToggleWidth));
if (Event.current.type == EventType.repaint)
if (Event.current.type == EventType.Repaint)
{
bgStyle.Draw(deleteButton, GUIContent.none, false, false, selected, false);
}
Expand Down
6 changes: 3 additions & 3 deletions Editor/Mono/Inspector/RectHandles.cs
Expand Up @@ -58,7 +58,7 @@ internal static Vector3 SideSlider(int id, Vector3 position, Vector3 sideVector,

switch (evt.type)
{
case EventType.layout:
case EventType.Layout:
Vector3 sideDir = sideVector.normalized;
HandleUtility.AddControl(id, HandleUtility.DistanceToLine(position + sideVector * 0.5f - sideDir * size * 2, position - sideVector * 0.5f + sideDir * size * 2) - bias);
break;
Expand Down Expand Up @@ -252,7 +252,7 @@ public static void RenderRectWithShadow(bool active, params Vector3[] corners)
public static void DrawPolyLineWithShadow(Color shadowColor, Vector2 screenOffset, params Vector3[] points)
{
Camera cam = Camera.current;
if (!cam || Event.current.type != EventType.repaint)
if (!cam || Event.current.type != EventType.Repaint)
return;

if (s_TempVectors.Length != points.Length)
Expand All @@ -276,7 +276,7 @@ public static void DrawPolyLineWithShadow(Color shadowColor, Vector2 screenOffse
public static void DrawDottedLineWithShadow(Color shadowColor, Vector2 screenOffset, Vector3 p1, Vector3 p2, float screenSpaceSize)
{
Camera cam = Camera.current;
if (!cam || Event.current.type != EventType.repaint)
if (!cam || Event.current.type != EventType.Repaint)
return;

Color oldColor = Handles.color;
Expand Down
4 changes: 4 additions & 0 deletions Editor/Mono/Inspector/RectTransformEditor.cs
Expand Up @@ -717,6 +717,10 @@ void ParentRectPreviewDragHandles(RectTransform gui, Transform space)
Vector3 sideDir = (xHandle == 1 ? space.right * rect.width : space.up * rect.height);
Vector3 slideDir = (xHandle == 1 ? space.up : space.right);

// could happen if gui.rect.{width,height} == 0
if (sideDir == Vector3.zero)
continue;

EditorGUI.BeginChangeCheck();
Vector3 newPos = RectHandles.SideSlider(id, curPos, sideDir, slideDir, size, null, 0, -3);
if (EditorGUI.EndChangeCheck())
Expand Down
2 changes: 1 addition & 1 deletion Editor/Mono/Inspector/ReflectionProbeEditor.cs
Expand Up @@ -616,7 +616,7 @@ private float GetProbeIntensity(ReflectionProbe p)
// Draw Reflection probe preview sphere
private void OnPreSceneGUICallback(SceneView sceneView)
{
if (Event.current.type != EventType.repaint)
if (Event.current.type != EventType.Repaint)
return;

foreach (var t in targets)
Expand Down
30 changes: 15 additions & 15 deletions Editor/Mono/Inspector/RendererEditorBase.cs
Expand Up @@ -72,7 +72,7 @@ internal void RenderLightProbeProxyVolumeWarningNote(Renderer renderer, int sele
LightProbeProxyVolume lightProbeProxyVol = renderer.GetComponent<LightProbeProxyVolume>();
bool invalidProxyVolumeOverride = (renderer.lightProbeProxyVolumeOverride == null) ||
(renderer.lightProbeProxyVolumeOverride.GetComponent<LightProbeProxyVolume>() == null);
if (lightProbeProxyVol == null && invalidProxyVolumeOverride)
if (lightProbeProxyVol == null && invalidProxyVolumeOverride && LightProbes.AreLightProbesAllowed(renderer))
{
EditorGUILayout.HelpBox(m_LightProbeVolumeNote.text, MessageType.Warning);
}
Expand Down Expand Up @@ -114,15 +114,13 @@ internal void RenderReflectionProbeUsage(bool useMiniStyle, bool isDeferredRende
}
}

internal void RenderLightProbeUsage(int selectionCount, Renderer renderer, bool useMiniStyle, bool usesLightMaps)
internal void RenderLightProbeUsage(int selectionCount, Renderer renderer, bool useMiniStyle, bool lightProbeAllowed)
{
using (new EditorGUI.DisabledScope(usesLightMaps))
using (new EditorGUI.DisabledScope(!lightProbeAllowed))
{
if (!useMiniStyle)
{
if (usesLightMaps)
EditorGUILayout.EnumPopup(m_LightProbeUsageStyle, LightProbeUsage.Off);
else
if (lightProbeAllowed)
{
EditorGUILayout.Popup(m_LightProbeUsage, m_LightProbeBlendModeOptions, m_LightProbeUsageStyle);

Expand All @@ -133,12 +131,12 @@ internal void RenderLightProbeUsage(int selectionCount, Renderer renderer, bool
EditorGUI.indentLevel--;
}
}
else
EditorGUILayout.EnumPopup(m_LightProbeUsageStyle, LightProbeUsage.Off);
}
else
{
if (usesLightMaps)
ModuleUI.GUIPopup(m_LightProbeUsageStyle, (int)LightProbeUsage.Off, m_LightProbeBlendModeOptions);
else
if (lightProbeAllowed)
{
ModuleUI.GUIPopup(m_LightProbeUsageStyle, m_LightProbeUsage, m_LightProbeBlendModeOptions);

Expand All @@ -149,6 +147,8 @@ internal void RenderLightProbeUsage(int selectionCount, Renderer renderer, bool
EditorGUI.indentLevel--;
}
}
else
ModuleUI.GUIPopup(m_LightProbeUsageStyle, (int)LightProbeUsage.Off, m_LightProbeBlendModeOptions);
}
}

Expand Down Expand Up @@ -191,23 +191,25 @@ internal void OnGUI(UnityEngine.Object[] selection, Renderer renderer, bool useM
int selectionCount = 1;
bool isDeferredRenderingPath = SceneView.IsUsingDeferredRenderingPath();
bool isDeferredReflections = isDeferredRenderingPath && (UnityEngine.Rendering.GraphicsSettings.GetShaderMode(BuiltinShaderType.DeferredReflections) != BuiltinShaderMode.Disabled);
bool isLightmappedOrDynamicLightmappedForRendering = false;
bool areLightProbesAllowed = true;

if (selection != null)
{
foreach (UnityEngine.Object obj in selection)
{
if (LightmapEditorSettings.IsLightmappedOrDynamicLightmappedForRendering((Renderer)obj))
if (LightProbes.AreLightProbesAllowed((Renderer)obj) == false)
{
isLightmappedOrDynamicLightmappedForRendering = true;
areLightProbesAllowed = false;
break;
}
}

selectionCount = selection.Length;
}

RenderLightProbeUsage(selectionCount, renderer, useMiniStyle, isLightmappedOrDynamicLightmappedForRendering);
RenderLightProbeUsage(selectionCount, renderer, useMiniStyle, areLightProbesAllowed);

RenderLightProbeProxyVolumeWarningNote(renderer, selectionCount);

RenderReflectionProbeUsage(useMiniStyle, isDeferredRenderingPath, isDeferredReflections);

Expand All @@ -234,8 +236,6 @@ internal void OnGUI(UnityEngine.Object[] selection, Renderer renderer, bool useM
{
EditorGUILayout.HelpBox(m_DeferredNote.text, MessageType.Info);
}

RenderLightProbeProxyVolumeWarningNote(renderer, selectionCount);
}

// Show an info list of probes affecting this object, and their weights.
Expand Down
2 changes: 1 addition & 1 deletion Editor/Mono/Inspector/ScriptExecutionOrderInspector.cs
Expand Up @@ -629,7 +629,7 @@ public void DrawElement(Rect r, object obj, bool dragging)
{
MonoScript script = obj as MonoScript;

if (Event.current.type == EventType.repaint)
if (Event.current.type == EventType.Repaint)
{
m_Styles.elementBackground.Draw(r, false, false, false, false);
m_Styles.draggingHandle.Draw(GetDraggingHandleRect(r), false, false, false, false);
Expand Down
2 changes: 1 addition & 1 deletion Editor/Mono/Inspector/ShaderInspector.cs
Expand Up @@ -195,7 +195,7 @@ internal static void ShaderErrorListUI(Object shader, ShaderError[] errors, ref
}

// background
if (e.type == EventType.repaint)
if (e.type == EventType.Repaint)
{
if ((i & 1) == 0)
{
Expand Down
2 changes: 1 addition & 1 deletion Editor/Mono/Inspector/StandardParticlesShaderGUI.cs
Expand Up @@ -620,7 +620,7 @@ public static void SetupMaterialWithBlendMode(Material material, BlendMode blend
break;
case BlendMode.Modulate:
material.SetOverrideTag("RenderType", "Transparent");
material.SetInt("_BlendOp", (int)UnityEngine.Rendering.BlendOp.Multiply);
material.SetInt("_BlendOp", (int)UnityEngine.Rendering.BlendOp.Add);
material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.DstColor);
material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
material.SetInt("_ZWrite", 0);
Expand Down
38 changes: 38 additions & 0 deletions Editor/Mono/Inspector/TerrainColliderEditor.cs
@@ -0,0 +1,38 @@
// Unity C# reference source
// Copyright (c) Unity Technologies. For terms of use, see
// https://unity3d.com/legal/licenses/Unity_Reference_Only_License

using UnityEngine;

namespace UnityEditor
{
[CustomEditor(typeof(TerrainCollider))]
[CanEditMultipleObjects]
internal class TerrainColliderEditor : Collider3DEditorBase
{
SerializedProperty m_TerrainData;
SerializedProperty m_EnableTreeColliders;

protected GUIContent terrainContent = EditorGUIUtility.TextContent("Terrain Data|The TerrainData asset that stores heightmaps, terrain textures, detail meshes and trees.");
protected GUIContent treeColliderContent = EditorGUIUtility.TextContent("Enable Tree Colliders|When selected, Tree Colliders will be enabled.");

public override void OnEnable()
{
base.OnEnable();

m_TerrainData = serializedObject.FindProperty("m_TerrainData");
m_EnableTreeColliders = serializedObject.FindProperty("m_EnableTreeColliders");
}

public override void OnInspectorGUI()
{
serializedObject.Update();

EditorGUILayout.PropertyField(m_Material, materialContent);
EditorGUILayout.PropertyField(m_TerrainData, terrainContent);
EditorGUILayout.PropertyField(m_EnableTreeColliders, treeColliderContent);

serializedObject.ApplyModifiedProperties();
}
}
}
50 changes: 50 additions & 0 deletions Editor/Mono/Inspector/TimeManagerInspector.cs
@@ -0,0 +1,50 @@
// Unity C# reference source
// Copyright (c) Unity Technologies. For terms of use, see
// https://unity3d.com/legal/licenses/Unity_Reference_Only_License

using UnityEngine;
using UnityEditor;
using UnityEditorInternal;
using System.Collections;

namespace UnityEditor
{
[CustomEditor(typeof(TimeManager))]
internal class TimeManagerEditor : Editor
{
SerializedProperty m_FixedTimestepProperty;
SerializedProperty m_MaxAllowedTimestepProperty;
SerializedProperty m_TimeScaleProperty;
SerializedProperty m_MaxParticleTimestepProperty;

GUIContent m_FixedTimestepLabel;
GUIContent m_MaxAllowedTimestepLabel;
GUIContent m_TimeScaleLabel;
GUIContent m_MaxParticleTimestepLabel;

public void OnEnable()
{
m_FixedTimestepProperty = serializedObject.FindProperty("Fixed Timestep");
m_MaxAllowedTimestepProperty = serializedObject.FindProperty("Maximum Allowed Timestep");
m_TimeScaleProperty = serializedObject.FindProperty("m_TimeScale");
m_MaxParticleTimestepProperty = serializedObject.FindProperty("Maximum Particle Timestep");

m_FixedTimestepLabel = EditorGUIUtility.TextContent("Fixed Timestep|A framerate-independent interval that dictates when physics calculations and FixedUpdate() events are performed.");
m_MaxAllowedTimestepLabel = EditorGUIUtility.TextContent("Maximum Allowed Timestep|A framerate-independent interval that caps the worst case scenario when framerate is low. Physics calculations and FixedUpdate() events will not be performed for longer time than specified.");
m_TimeScaleLabel = EditorGUIUtility.TextContent("Time Scale|The speed at which time progresses. Change this value to simulate bullet-time effects. A value of 1 means real-time. A value of .5 means half speed; a value of 2 is double speed.");
m_MaxParticleTimestepLabel = EditorGUIUtility.TextContent("Maximum Particle Timestep|The maximum time that should be allowed to process particles for a frame.");
}

public override void OnInspectorGUI()
{
serializedObject.Update();

EditorGUILayout.PropertyField(m_FixedTimestepProperty, m_FixedTimestepLabel);
EditorGUILayout.PropertyField(m_MaxAllowedTimestepProperty, m_MaxAllowedTimestepLabel);
EditorGUILayout.PropertyField(m_TimeScaleProperty, m_TimeScaleLabel);
EditorGUILayout.PropertyField(m_MaxParticleTimestepProperty, m_MaxParticleTimestepLabel);

serializedObject.ApplyModifiedProperties();
}
}
}
6 changes: 3 additions & 3 deletions Editor/Mono/Inspector/TransformInspector.cs
Expand Up @@ -16,8 +16,8 @@ internal class TransformInspector : Editor

class Contents
{
public GUIContent positionContent = new GUIContent(LocalizationDatabase.GetLocalizedString("Position"), LocalizationDatabase.GetLocalizedString("The local position of this Game Object relative to the parent."));
public GUIContent scaleContent = new GUIContent(LocalizationDatabase.GetLocalizedString("Scale"), LocalizationDatabase.GetLocalizedString("The local scaling of this Game Object relative to the parent."));
public GUIContent positionContent = EditorGUIUtility.TextContent("Position|The local position of this GameObject relative to the parent.");
public GUIContent scaleContent = EditorGUIUtility.TextContent("Scale|The local scaling of this GameObject relative to the parent.");
public string floatingPointWarning = LocalizationDatabase.GetLocalizedString("Due to floating-point precision limitations, it is recommended to bring the world coordinates of the GameObject within a smaller range.");
}
static Contents s_Contents;
Expand All @@ -29,7 +29,7 @@ public void OnEnable()

if (m_RotationGUI == null)
m_RotationGUI = new TransformRotationGUI();
m_RotationGUI.OnEnable(serializedObject.FindProperty("m_LocalRotation"), new GUIContent(LocalizationDatabase.GetLocalizedString("Rotation")));
m_RotationGUI.OnEnable(serializedObject.FindProperty("m_LocalRotation"), EditorGUIUtility.TextContent("Rotation|The local rotation of this GameObject relative to the parent."));
}

public override void OnInspectorGUI()
Expand Down
2 changes: 1 addition & 1 deletion Editor/Mono/Inspector/VideoPlayerEditor.cs
Expand Up @@ -50,7 +50,7 @@ class Styles
public GUIContent audioOutputModeContent =
EditorGUIUtility.TextContent("Audio Output Mode|Where the audio in the movie will be output.");
public GUIContent audioSourceContent =
EditorGUIUtility.TextContent("Audio Source|AudioSource component tha will receive this track's audio samples.");
EditorGUIUtility.TextContent("Audio Source|AudioSource component that will receive this track's audio samples.");
public GUIContent aspectRatioLabel = EditorGUIUtility.TextContent("Aspect Ratio");
public GUIContent muteLabel = EditorGUIUtility.TextContent("Mute");
public GUIContent volumeLabel = EditorGUIUtility.TextContent("Volume");
Expand Down
2 changes: 1 addition & 1 deletion Editor/Mono/LookDevView/CameraControllerStandard.cs
Expand Up @@ -161,7 +161,7 @@ private void HandleCameraKeyDown()
evt.Use();
}

if (evt.type != EventType.keyDown && lastMotion.sqrMagnitude == 0)
if (evt.type != EventType.KeyDown && lastMotion.sqrMagnitude == 0)
m_FPSTiming.Begin();
}
}
Expand Down
130 changes: 130 additions & 0 deletions Editor/Mono/Media/Bindings/MediaEncoder.bindings.cs
@@ -0,0 +1,130 @@
// Unity C# reference source
// Copyright (c) Unity Technologies. For terms of use, see
// https://unity3d.com/legal/licenses/Unity_Reference_Only_License

using System;
using UnityEngine;
using UnityEngine.Bindings;
using UnityEngine.Collections;
using UnityEditor;
using Object = UnityEngine.Object;

namespace UnityEditor.Media
{
[NativeHeader("Editor/Mono/Media/Bindings/MediaEncoder.bindings.h")]

public struct MediaRational
{
public MediaRational(int num)
{
numerator = num;
denominator = 1;
}

public int numerator;
public int denominator;
}

public struct VideoTrackAttributes
{
public MediaRational frameRate;
public uint width;
public uint height;
public bool includeAlpha; // For webm only; not applicable to mp4.
}

public struct AudioTrackAttributes
{
public MediaRational sampleRate;
public ushort channelCount;
public string language;
//Future work:
//public string format; // E.g.: "Stereo", "5.1", "Ambisonic 1st order", ...
//public string layout[]; // E.g.: ["Left", "Right", "Center"]
}

public class MediaEncoder : IDisposable
{
public IntPtr m_Ptr;

public MediaEncoder(
string filePath, VideoTrackAttributes videoAttrs, AudioTrackAttributes[] audioAttrs)
{
m_Ptr = Create(filePath, new[] {videoAttrs}, audioAttrs);
}

public MediaEncoder(
string filePath, VideoTrackAttributes videoAttrs, AudioTrackAttributes audioAttrs)
: this(filePath, videoAttrs, new[] {audioAttrs})
{}

public MediaEncoder(string filePath, VideoTrackAttributes videoAttrs)
: this(filePath, videoAttrs, new AudioTrackAttributes[0])
{}

public MediaEncoder(string filePath, AudioTrackAttributes[] audioAttrs)
{
m_Ptr = Create(filePath, new VideoTrackAttributes[0], audioAttrs);
}

public MediaEncoder(string filePath, AudioTrackAttributes audioAttrs)
: this(filePath, new[] {audioAttrs})
{}

~MediaEncoder()
{
Dispose();
}

public bool AddFrame(Texture2D texture)
{
return Internal_AddFrame(m_Ptr, texture);
}

public bool AddSamples(ushort trackIndex, NativeArray<float> interleavedSamples)
{
return Internal_AddSamples(
m_Ptr, trackIndex, interleavedSamples.UnsafeReadOnlyPtr,
interleavedSamples.Length);
}

public bool AddSamples(NativeArray<float> interleavedSamples)
{
return AddSamples(0, interleavedSamples);
}

public void Dispose()
{
if (m_Ptr != IntPtr.Zero)
{
Internal_Release(m_Ptr);
m_Ptr = IntPtr.Zero;
}
GC.SuppressFinalize(this);
}

private IntPtr Create(
string filePath, VideoTrackAttributes[] videoAttrs, AudioTrackAttributes[] audioAttrs)
{
IntPtr ptr = Internal_Create(filePath, videoAttrs, audioAttrs);
if (ptr == IntPtr.Zero)
throw new InvalidOperationException(
"MediaEncoder: Output file creation failed for " + filePath);
return ptr;
}

[FreeFunction]
extern private static IntPtr Internal_Create(
string filePath, VideoTrackAttributes[] videoAttrs, AudioTrackAttributes[] audioAttrs);

[FreeFunction]
extern private static void Internal_Release(IntPtr encoder);

[FreeFunction]
extern private static bool Internal_AddFrame(IntPtr encoder, Texture2D texture);

[FreeFunction]
extern private static bool Internal_AddSamples(
IntPtr encoder, ushort trackIndex, IntPtr buffer, int sampleCount);
}
}
8 changes: 4 additions & 4 deletions Editor/Mono/ObjectListArea.cs
Expand Up @@ -573,7 +573,7 @@ public void OnGUI(Rect position, int keyboardControlID)

void FrameLastClickedItemIfWanted()
{
if (m_FrameLastClickedItem && Event.current.type == EventType.repaint)
if (m_FrameLastClickedItem && Event.current.type == EventType.Repaint)
{
m_FrameLastClickedItem = false;
double timeSinceLastDraw = EditorApplication.timeSinceStartup - m_LocalAssets.m_LastClickedDrawTime;
Expand Down Expand Up @@ -874,7 +874,7 @@ void SetSelection(AssetStoreAsset assetStoreResult, bool doubleClicked)

void HandleZoomScrolling()
{
if (EditorGUI.actionKey && Event.current.type == EventType.scrollWheel && m_TotalRect.Contains(Event.current.mousePosition))
if (EditorGUI.actionKey && Event.current.type == EventType.ScrollWheel && m_TotalRect.Contains(Event.current.mousePosition))
{
int sign = Event.current.delta.y > 0 ? -1 : 1;
gridSize = Mathf.Clamp(gridSize + sign * 7, minGridSize, maxGridSize);
Expand Down Expand Up @@ -912,7 +912,7 @@ public void HandleKeyboard(bool checkKeyboardControl)
m_KeyboardInputCallback();

// Now default list area handling
if (Event.current.type == EventType.keyDown)
if (Event.current.type == EventType.KeyDown)
{
int offset = 0;

Expand Down Expand Up @@ -1293,7 +1293,7 @@ private void SetupData(bool forceReflow)
g.UpdateAssets();
}

if (forceReflow || Event.current.type == EventType.repaint)
if (forceReflow || Event.current.type == EventType.Repaint)
{
// Reflow according to number of items, scrollbar presence, item dims etc.
Reflow();
Expand Down
4 changes: 2 additions & 2 deletions Editor/Mono/ObjectListLocalGroup.cs
Expand Up @@ -535,7 +535,7 @@ protected void DrawSubAssetRowBg(int startSubAssetIndex, int endSubAssetIndex, b

void DrawSubAssetBackground(int beginIndex, int endIndex, float yOffset)
{
if (Event.current.type != EventType.repaint)
if (Event.current.type != EventType.Repaint)
return;

FilteredHierarchy.FilterResult[] results = m_FilteredHierarchy.results;
Expand Down Expand Up @@ -1261,7 +1261,7 @@ static internal int GetControlIDFromInstanceID(int instanceID)

public bool DoCharacterOffsetSelection()
{
if (Event.current.type == EventType.keyDown && Event.current.shift)
if (Event.current.type == EventType.KeyDown && Event.current.shift)
{
System.StringComparison ignoreCase = System.StringComparison.CurrentCultureIgnoreCase;
string startName = "";
Expand Down
6 changes: 3 additions & 3 deletions Editor/Mono/ParticleSystemEditor/ParticleEffectUI.cs
Expand Up @@ -664,7 +664,7 @@ internal void PlayStopGUI()
s_Texts = new Texts();

Event evt = Event.current;
if (evt.type == EventType.layout)
if (evt.type == EventType.Layout)
m_TimeHelper.Update();

if (!EditorApplication.isPlaying)
Expand Down Expand Up @@ -786,7 +786,7 @@ private void MultiParticleSystemGUI(bool verticalLayout)

// Draw Emitters
Color orgColor = GUI.color;
bool isRepaintEvent = Event.current.type == EventType.repaint;
bool isRepaintEvent = Event.current.type == EventType.Repaint;
bool isShowOnlySelected = IsShowOnlySelectedMode();
List<ParticleSystemUI> selectedSystems = GetSelectedParticleSystemUIs();

Expand Down Expand Up @@ -907,7 +907,7 @@ void ResizeHandling(bool verticalLayout)
void ClampWindowContentSizes()
{
EventType type = Event.current.type;
if (type != EventType.layout)
if (type != EventType.Layout)
{
float width = GUIClip.visibleRect.width;
float height = GUIClip.visibleRect.height;
Expand Down
Expand Up @@ -619,7 +619,7 @@ void PresetCurveButtons(Rect position, Rect curveEditorRect)
m_CurveEditor.ClearSelection();
}
}
if (Event.current.type == EventType.repaint)
if (Event.current.type == EventType.Repaint)
curveLibrary.Draw(swatchRect, i);

curX += swatchWidth;
Expand Down
Expand Up @@ -587,7 +587,7 @@ void RenderCollisionBounds()

private static void DrawSolidPlane(Vector3 pos, Quaternion rot, Color faceColor, Color edgeColor)
{
if (Event.current.type != EventType.repaint)
if (Event.current.type != EventType.Repaint)
return;

var oldMatrix = Handles.matrix;
Expand All @@ -600,7 +600,7 @@ private static void DrawSolidPlane(Vector3 pos, Quaternion rot, Color faceColor,

private static void DrawGrid(Vector3 pos, Vector3 axis1, Vector3 axis2, Vector3 normal, Color color)
{
if (Event.current.type != EventType.repaint)
if (Event.current.type != EventType.Repaint)
return;

HandleUtility.ApplyWireMaterial();
Expand Down
2 changes: 1 addition & 1 deletion Editor/Mono/ParticleSystemEditor/ParticleSystemUI.cs
Expand Up @@ -120,7 +120,7 @@ public float GetEmitterDuration()

public void OnGUI(float width, bool fixedWidth)
{
bool isRepaintEvent = Event.current.type == EventType.repaint;
bool isRepaintEvent = Event.current.type == EventType.Repaint;

// Name of current emitter
string selectedEmitterName = null;
Expand Down
2 changes: 0 additions & 2 deletions Editor/Mono/PerformanceTools/FrameDebugger.cs
Expand Up @@ -816,8 +816,6 @@ private void DrawRenderTargetControls()
(RenderTextureFormat)cur.rtFormat));
if (cur.rtDim == (int)UnityEngine.Rendering.TextureDimension.Cube)
GUILayout.Label("Rendering into cubemap");
if (cur.rtFormat == (int)RenderTextureFormat.Shadowmap && SystemInfo.graphicsDeviceVersion.StartsWith("Direct3D 9"))
EditorGUILayout.HelpBox("Rendering into shadowmap on DX9, can't visualize it in the game view properly", MessageType.Info, true);
}

private void DrawEventDrawCallInfo()
Expand Down
20 changes: 19 additions & 1 deletion Editor/Mono/PluginImporter.bindings.cs
Expand Up @@ -8,6 +8,7 @@
using UnityEditor.Modules;
using UnityEditorInternal;
using UnityEngine.Bindings;
using UnityEngine.Scripting;

namespace UnityEditor
{
Expand Down Expand Up @@ -132,7 +133,24 @@ internal static IEnumerable<PluginDesc> GetExtensionPlugins(BuildTarget target)
extern public bool GetExcludeFromAnyPlatform(string platformName);

public delegate bool IncludeInBuildDelegate(string path);
extern public void SetIncludeInBuildDelegate(IncludeInBuildDelegate includeInBuildDelegate);

// this is implemented as a static map so that it can survive a garbage collection on the PluginImporter and not get lost
private static Dictionary<string, IncludeInBuildDelegate> s_includeInBuildDelegateMap = new Dictionary<string, IncludeInBuildDelegate>();
public void SetIncludeInBuildDelegate(IncludeInBuildDelegate includeInBuildDelegate)
{
s_includeInBuildDelegateMap[assetPath] = includeInBuildDelegate;
}

[RequiredByNativeCode]
private bool InvokeIncludeInBuildDelegate()
{
if (s_includeInBuildDelegateMap.ContainsKey(assetPath))
{
return s_includeInBuildDelegateMap[assetPath](assetPath);
}

return true;
}

public void SetExcludeFromAnyPlatform(BuildTarget platform, bool excludedFromAny)
{
Expand Down
Expand Up @@ -42,7 +42,7 @@ public override void OnGUI(Rect rect)
float labelWidth = 80f;

Rect size = EditorGUILayout.BeginVertical();
if (Event.current.type != EventType.layout)
if (Event.current.type != EventType.Layout)
m_WantedSize = size;

// Header
Expand Down Expand Up @@ -107,7 +107,7 @@ void KeyboardHandling(EditorWindow editorWindow)
Event evt = Event.current;
switch (evt.type)
{
case EventType.keyDown:
case EventType.KeyDown:
switch (evt.keyCode)
{
case KeyCode.KeypadEnter:
Expand Down
6 changes: 3 additions & 3 deletions Editor/Mono/PresetLibraries/PresetLibraryEditor.cs
Expand Up @@ -341,7 +341,7 @@ void TopArea(Rect rect)
const float optionsButtonWidth = 16f;
const float optionsButtonHeight = 6f;
Rect buttonRect = new Rect(rect.width - optionsButtonWidth - settingsMenuRightMargin, (rect.height - optionsButtonHeight) * 0.5f, optionsButtonWidth, rect.height);
if (Event.current.type == EventType.repaint)
if (Event.current.type == EventType.Repaint)
s_Styles.optionsButton.Draw(buttonRect, false, false, false, false);

// We want larger click area than the button icon
Expand Down Expand Up @@ -431,7 +431,7 @@ void ListArea(Rect rect, PresetLibrary lib, object newPresetObject)
}

// Draw horizontal lines for scrollview content to clip against
if ((m_ShowedScrollBarLastFrame || alwaysShowScrollAreaHorizontalLines) && Event.current.type == EventType.repaint)
if ((m_ShowedScrollBarLastFrame || alwaysShowScrollAreaHorizontalLines) && Event.current.type == EventType.Repaint)
{
Rect scrollEdgeRect = new RectOffset(1, 1, 1, 1).Add(rect);
scrollEdgeRect.height = 1;
Expand Down Expand Up @@ -681,7 +681,7 @@ void CreateNewPresetButton(Rect buttonRect, object newPresetObject, PresetLibrar
InspectorWindow.RepaintAllInspectors(); // If inspecting a preset libarary we want to show the new preset there as well
}

if (Event.current.type == EventType.repaint)
if (Event.current.type == EventType.Repaint)
{
Rect rect2 = new RectOffset(-3, -3, -3, -3).Add(buttonRect);
lib.Draw(rect2, newPresetObject);
Expand Down
8 changes: 4 additions & 4 deletions Editor/Mono/ProjectBrowser.cs
Expand Up @@ -885,7 +885,7 @@ void ListGotKeyboardFocus()

void ListAreaKeyboardCallback()
{
if (Event.current.type == EventType.keyDown)
if (Event.current.type == EventType.KeyDown)
{
switch (Event.current.keyCode)
{
Expand Down Expand Up @@ -1149,7 +1149,7 @@ void AssetTreeItemDoubleClickedCallback(int instanceID)

void AssetTreeKeyboardInputCallback()
{
if (Event.current.type == EventType.keyDown)
if (Event.current.type == EventType.KeyDown)
{
switch (Event.current.keyCode)
{
Expand Down Expand Up @@ -1736,7 +1736,7 @@ void OnGUI()
Event evt = Event.current;

Rect ProjectBrowserRect = new Rect(0, 0, position.width, position.height);
if (evt.type == EventType.mouseDown && ProjectBrowserRect.Contains(evt.mousePosition))
if (evt.type == EventType.MouseDown && ProjectBrowserRect.Contains(evt.mousePosition))
{
EndPing();
SetAsLastInteractedProjectBrowser();
Expand Down Expand Up @@ -2121,7 +2121,7 @@ void SearchField()

// On arrow down/up swicth to control selection in list area
Event evt = Event.current;
if (evt.type == EventType.keyDown && (evt.keyCode == KeyCode.DownArrow || evt.keyCode == KeyCode.UpArrow))
if (evt.type == EventType.KeyDown && (evt.keyCode == KeyCode.DownArrow || evt.keyCode == KeyCode.UpArrow))
{
if (GUIUtility.keyboardControl == searchFieldControlID)
{
Expand Down
4 changes: 2 additions & 2 deletions Editor/Mono/ProjectBrowserPopups.cs
Expand Up @@ -276,7 +276,7 @@ public override void OnGUI(Rect windowRect)
{
Event evt = Event.current;
// We do not use the layout event
if (evt.type == EventType.layout)
if (evt.type == EventType.Layout)
return;

if (s_Styles == null)
Expand Down Expand Up @@ -318,7 +318,7 @@ private void DrawCustomTextField(EditorWindow editorWindow, Rect windowRect)
string textBeforeEdit = CurrentDisplayedText();

// Handle "special" keyboard input
if (evt.type == EventType.keyDown)
if (evt.type == EventType.KeyDown)
{
switch (evt.keyCode)
{
Expand Down
47 changes: 47 additions & 0 deletions Editor/Mono/ProjectTemplateWindow.cs
@@ -0,0 +1,47 @@
// Unity C# reference source
// Copyright (c) Unity Technologies. For terms of use, see
// https://unity3d.com/legal/licenses/Unity_Reference_Only_License

using System;
using System.Collections.Generic;
using UnityEngine;

namespace UnityEditor
{
internal class ProjectTemplateWindow : EditorWindow
{
string m_Name;
string m_DisplayName;
string m_Description;
string m_Version;

[MenuItem("internal:Project/Save As Template...")]
internal static void SaveAsTemplate()
{
var window = EditorWindow.GetWindow<ProjectTemplateWindow>();
window.Show();
}

void OnEnable()
{
titleContent = new GUIContent("Save Template");
}

void OnGUI()
{
m_Name = EditorGUILayout.TextField("Name:", m_Name);
m_DisplayName = EditorGUILayout.TextField("Display name:", m_DisplayName);
m_Description = EditorGUILayout.TextField("Description:", m_Description);
m_Version = EditorGUILayout.TextField("Version:", m_Version);
if (GUILayout.Button("Save As...", GUILayout.Width(100)))
{
string path = EditorUtility.SaveFolderPanel("Save template to folder", "", "");
if (path.Length > 0)
{
AssetDatabase.SaveAssets();
EditorUtility.SaveProjectAsTemplate(path, m_Name, m_DisplayName, m_Description, m_Version);
}
}
}
}
}
18 changes: 17 additions & 1 deletion Editor/Mono/RetainedMode.cs
Expand Up @@ -4,6 +4,7 @@

using System;
using System.Collections.Generic;
using UnityEditor.Experimental.UIElements;
using UnityEngine;
using Object = UnityEngine.Object;
using UnityEngine.Experimental.UIElements;
Expand Down Expand Up @@ -79,13 +80,28 @@ static void UpdateSchedulersInternal(HashSet<Object> tmpDirtySet)

static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
{
bool anyUxmlImported = false;
bool anyUssImported = false;
foreach (string assetPath in importedAssets)
{
if (assetPath.EndsWith("uss"))
{
anyUssImported = true;
FlagStyleSheetChange();
break;
}
else if (assetPath.EndsWith("uxml"))
{
anyUxmlImported = true;
UIElementsViewImporter.logger.FinishImport();

// the inline stylesheet cache might get out of date.
// Usually called by the USS importer, which might not get called here
StyleSheetCache.ClearCaches();
}

// no need to continue, as we found both extensions we were looking for
if (anyUxmlImported && anyUssImported)
break;
}
}

Expand Down
2 changes: 1 addition & 1 deletion Editor/Mono/SceneHierarchySortingWindow.cs
Expand Up @@ -112,7 +112,7 @@ private void Init(Vector2 pos, List<InputData> data, OnSelectCallback callback)
internal void OnGUI()
{
// We do not use the layout event
if (Event.current.type == EventType.layout)
if (Event.current.type == EventType.Layout)
return;

if (Event.current.type == EventType.MouseMove)
Expand Down
4 changes: 2 additions & 2 deletions Editor/Mono/SceneHierarchyWindow.cs
Expand Up @@ -395,7 +395,7 @@ void OnGUI()

Rect SceneHierarchyRect = new Rect(0, 0, position.width, position.height);
Event evt = Event.current;
if (evt.type == EventType.mouseDown && SceneHierarchyRect.Contains(evt.mousePosition))
if (evt.type == EventType.MouseDown && SceneHierarchyRect.Contains(evt.mousePosition))
{
treeView.EndPing();
SetAsLastInteractedHierarchy();
Expand Down Expand Up @@ -607,7 +607,7 @@ void DoToolbar()
Event evt = Event.current;

// When searchfield has focus give keyboard focus to the tree view on Down/UpArrow
if (hasSearchFilterFocus && evt.type == EventType.keyDown && (evt.keyCode == KeyCode.DownArrow || evt.keyCode == KeyCode.UpArrow))
if (hasSearchFilterFocus && evt.type == EventType.KeyDown && (evt.keyCode == KeyCode.DownArrow || evt.keyCode == KeyCode.UpArrow))
{
GUIUtility.keyboardControl = m_TreeViewKeyboardControlID;

Expand Down
15 changes: 14 additions & 1 deletion Editor/Mono/SceneModeWindows/LightingWindowBakeSettings.cs
Expand Up @@ -70,6 +70,13 @@ internal class LightingWindowBakeSettings
SerializedProperty m_BounceScale;
SerializedProperty m_UpdateThreshold;

static bool PlayerHasSM20Support()
{
var apis = PlayerSettings.GetGraphicsAPIs(EditorUserBuildSettings.activeBuildTarget);
bool hasSM20Api = apis.Contains(UnityEngine.Rendering.GraphicsDeviceType.OpenGLES2) || apis.Contains(UnityEngine.Rendering.GraphicsDeviceType.N3DS);
return hasSM20Api;
}

public LightingWindowBakeSettings()
{
m_LightModeUtil = LightModeUtil.Get();
Expand Down Expand Up @@ -252,6 +259,11 @@ void RealtimeLightingGUI()
m_LightModeUtil.Store(realtimeGI ? 0 : 1, mixedMode);
}

if (realtimeGI && PlayerHasSM20Support())
{
EditorGUILayout.HelpBox(Styles.NoRealtimeGIInSM2AndGLES2.text, MessageType.Warning);
}

EditorGUI.indentLevel--;
EditorGUILayout.Space();
}
Expand Down Expand Up @@ -466,7 +478,7 @@ void GeneralLightmapSettingsGUI()

EditorGUILayout.IntPopup(m_LightmapDirectionalMode, Styles.LightmapDirectionalModeStrings, Styles.LightmapDirectionalModeValues, Styles.LightmapDirectionalMode);

if ((int)LightmapsMode.CombinedDirectional == m_LightmapDirectionalMode.intValue)
if ((int)LightmapsMode.CombinedDirectional == m_LightmapDirectionalMode.intValue && PlayerHasSM20Support())
EditorGUILayout.HelpBox(Styles.NoDirectionalInSM2AndGLES2.text, MessageType.Warning);

EditorGUILayout.Slider(m_IndirectOutputScale, 0.0f, 5.0f, Styles.IndirectOutputScale);
Expand Down Expand Up @@ -557,6 +569,7 @@ static class Styles
public static readonly GUIContent MixedLightsLabel = EditorGUIUtility.TextContent("Mixed Lighting|Bake Global Illumination for mixed lights and static objects. May bake both direct and/or indirect lighting based on settings. Only static objects are blocking and bouncing light, dynamic objects receive baked lighting via light probes.");
public static readonly GUIContent GeneralLightmapLabel = EditorGUIUtility.TextContent("Lightmapping Settings|Settings that apply to both Global Illumination modes (Precomputed Realtime and Baked).");
public static readonly GUIContent NoDirectionalInSM2AndGLES2 = EditorGUIUtility.TextContent("Directional lightmaps cannot be decoded on SM2.0 hardware nor when using GLES2.0. They will fallback to Non-Directional lightmaps.");
public static readonly GUIContent NoRealtimeGIInSM2AndGLES2 = EditorGUIUtility.TextContent("Realtime Global Illumination is not supported on SM2.0 hardware nor when using GLES2.0.");
public static readonly GUIContent NoShadowMaskInProgressive = EditorGUIUtility.TextContent("'Shadowmask' and 'Distance Shadowmask' modes are not supported in this preview version of the Progressive Lightmapper.");
public static readonly GUIContent ConcurrentJobs = EditorGUIUtility.TextContent("Concurrent Jobs|The amount of simultaneously scheduled jobs.");
public static readonly GUIContent ForceWhiteAlbedo = EditorGUIUtility.TextContent("Force White Albedo|Force white albedo during lighting calculations.");
Expand Down
10 changes: 5 additions & 5 deletions Editor/Mono/SceneView/RectSelection.cs
Expand Up @@ -41,12 +41,12 @@ public void OnGUI()

switch (evt.GetTypeForControl(id))
{
case EventType.layout:
case EventType.Layout:
if (!Tools.viewToolActive)
HandleUtility.AddDefaultControl(id);
break;

case EventType.mouseDown:
case EventType.MouseDown:
if (HandleUtility.nearestControl == id && evt.button == 0)
{
GUIUtility.hotControl = id;
Expand All @@ -55,7 +55,7 @@ public void OnGUI()
m_RectSelecting = false;
}
break;
case EventType.mouseDrag:
case EventType.MouseDrag:
if (GUIUtility.hotControl == id)
{
if (!m_RectSelecting && (mousePos - m_SelectStartPoint).magnitude > 6f)
Expand Down Expand Up @@ -111,12 +111,12 @@ public void OnGUI()
}
break;

case EventType.repaint:
case EventType.Repaint:
if (GUIUtility.hotControl == id && m_RectSelecting)
EditorStyles.selectionRect.Draw(EditorGUIExt.FromToRect(m_SelectStartPoint, m_SelectMousePoint), GUIContent.none, false, false, false, false);
break;

case EventType.mouseUp:
case EventType.MouseUp:
if (GUIUtility.hotControl == id && evt.button == 0)
{
GUIUtility.hotControl = 0;
Expand Down
17 changes: 9 additions & 8 deletions Editor/Mono/SceneView/SceneView.cs
Expand Up @@ -430,12 +430,12 @@ override public void OnEnable()
dontClearBackground = true;
s_SceneViews.Add(this);

m_Lighting = EditorGUIUtility.IconContent("SceneviewLighting", "Lighting|The scene lighting is used when toggled on. When toggled off a light attached to the scene view camera is used.");
m_Fx = EditorGUIUtility.IconContent("SceneviewFx", "Fx|Toggles skybox, fog and lens flare effects.");
m_AudioPlayContent = EditorGUIUtility.IconContent("SceneviewAudio", "AudioPlay|Toggles audio on or off.");
m_GizmosContent = new GUIContent("Gizmos");
m_2DModeContent = new GUIContent("2D");
m_RenderDocContent = EditorGUIUtility.IconContent("renderdoc", "Capture|Capture the current view and open in RenderDoc");
m_Lighting = EditorGUIUtility.IconContent("SceneviewLighting", "Lighting|When toggled on, the Scene lighting is used. When toggled off, a light attached to the Scene view camera is used.");
m_Fx = EditorGUIUtility.IconContent("SceneviewFx", "Effects|Toggle skybox, fog and lens flare effects.");
m_AudioPlayContent = EditorGUIUtility.IconContent("SceneviewAudio", "AudioPlay|Toggle audio on or off.");
m_GizmosContent = EditorGUIUtility.TextContent("Gizmos|Toggle the visibility of different Gizmos in the Scene view.");
m_2DModeContent = new GUIContent("2D", "When togggled on, the Scene is in 2D view. When toggled off, the Scene is in 3D view.");
m_RenderDocContent = EditorGUIUtility.IconContent("renderdoc", "Capture|Capture the current view and open in RenderDoc.");

m_SceneViewOverlay = new SceneViewOverlay(this);

Expand Down Expand Up @@ -548,6 +548,7 @@ void DoToolbarGUI()
{
// render mode popup
GUIContent modeContent = SceneRenderModeWindow.GetGUIContent(m_RenderMode);
modeContent.tooltip = LocalizationDatabase.GetLocalizedString("The Draw Mode used to display the Scene.");
Rect modeRect = GUILayoutUtility.GetRect(modeContent, EditorStyles.toolbarDropDown, GUILayout.Width(120));
if (EditorGUI.DropdownButton(modeRect, modeContent, FocusType.Passive, EditorStyles.toolbarDropDown))
{
Expand Down Expand Up @@ -860,7 +861,7 @@ private void HandleClickAndDragToFocus()
else if (GUIUtility.hotControl == 0 && draggingLocked == DraggingLockedState.Dragging)
draggingLocked = DraggingLockedState.LookAt;

if (evt.type == EventType.mouseDown)
if (evt.type == EventType.MouseDown)
{
Tools.s_ButtonDown = evt.button;
if (evt.button == 1 && Application.platform == RuntimePlatform.OSXEditor)
Expand Down Expand Up @@ -2167,7 +2168,7 @@ void DefaultHandles()
if (GUIUtility.hotControl == 0)
s_CurrentTool = Tools.viewToolActive ? 0 : Tools.current;

Tool tool = (Event.current.type == EventType.repaint ? Tools.current : s_CurrentTool);
Tool tool = (Event.current.type == EventType.Repaint ? Tools.current : s_CurrentTool);

switch (tool)
{
Expand Down
14 changes: 7 additions & 7 deletions Editor/Mono/SceneView/SceneViewMotion.cs
Expand Up @@ -46,7 +46,7 @@ public static void ArrowKeys(SceneView sv)
return;
switch (evt.GetTypeForControl(id))
{
case EventType.keyDown:
case EventType.KeyDown:
switch (evt.keyCode)
{
case KeyCode.UpArrow:
Expand Down Expand Up @@ -82,7 +82,7 @@ public static void ArrowKeys(SceneView sv)
}
break;

case EventType.keyUp:
case EventType.KeyUp:
if (GUIUtility.hotControl == id)
{
switch (evt.keyCode)
Expand All @@ -103,7 +103,7 @@ public static void ArrowKeys(SceneView sv)

break;

case EventType.layout:
case EventType.Layout:
if (GUIUtility.hotControl == id)
{
Vector3 fwd;
Expand Down Expand Up @@ -159,9 +159,9 @@ public static void DoViewTool(SceneView view)
case EventType.MouseDown: HandleMouseDown(view, id, evt.button); break;
case EventType.MouseUp: HandleMouseUp(view, id, evt.button, evt.clickCount); break;
case EventType.MouseDrag: HandleMouseDrag(view, id); break;
case EventType.keyDown: HandleKeyDown(view); break;
case EventType.keyUp: HandleKeyUp(); break;
case EventType.layout:
case EventType.KeyDown: HandleKeyDown(view); break;
case EventType.KeyUp: HandleKeyUp(); break;
case EventType.Layout:
{
Vector3 motion = GetMovementDirection();
// This seems to be the best way to have a continuously repeating event
Expand Down Expand Up @@ -489,7 +489,7 @@ private static void HandleKeyDown(SceneView sceneView)
evt.Use();
}

if (evt.type != EventType.keyDown && lastMotion.sqrMagnitude == 0)
if (evt.type != EventType.KeyDown && lastMotion.sqrMagnitude == 0)
s_FPSTiming.Begin();
}
}
Expand Down
6 changes: 3 additions & 3 deletions Editor/Mono/ShapeEditor/ShapeEditor.cs
Expand Up @@ -925,7 +925,7 @@ public void RectCap(int controlID, Vector3 position, Quaternion rotation, float
{
HandleUtility.AddControl(controlID, HandleUtility.DistanceToCircle(position, size * 0.5f));
}
else if (eventType == EventType.repaint)
else if (eventType == EventType.Repaint)
{
Vector3 normal = handles.matrix.GetColumn(2);
Vector3 projectedUp = (ProjectPointOnPlane(normal, position, position + Vector3.up) - position).normalized;
Expand Down Expand Up @@ -958,7 +958,7 @@ public void CircleCap(int controlID, Vector3 position, Quaternion rotation, floa
{
HandleUtility.AddControl(controlID, HandleUtility.DistanceToCircle(position, size * 0.5f));
}
else if (eventType == EventType.repaint)
else if (eventType == EventType.Repaint)
{
Vector3 forward = handleMatrixrotation * rotation * Vector3.forward;
Vector3 tangent = Vector3.Cross(forward, Vector3.up);
Expand Down Expand Up @@ -991,7 +991,7 @@ public void DiamondCap(int controlID, Vector3 position, Quaternion rotation, flo
{
HandleUtility.AddControl(controlID, HandleUtility.DistanceToCircle(position, size * 0.5f));
}
else if (eventType == EventType.repaint)
else if (eventType == EventType.Repaint)
{
Vector3 normal = handles.matrix.GetColumn(2);
Vector3 projectedUp = (ProjectPointOnPlane(normal, position, position + Vector3.up) - position).normalized;
Expand Down
42 changes: 21 additions & 21 deletions Editor/Mono/SpriteEditor/SpriteEditorHandles.cs
Expand Up @@ -30,7 +30,7 @@ static internal Vector2 PointSlider(Vector2 pos, MouseCursor cursor, GUIStyle dr
Event evt = Event.current;
switch (evt.GetTypeForControl(id))
{
case EventType.repaint:
case EventType.Repaint:
if (GUIUtility.hotControl == id)
dragDotActive.Draw(handleScreenPos, GUIContent.none, id);
else
Expand All @@ -53,7 +53,7 @@ static private Vector2 ScaleSlider(int id, Vector2 pos, MouseCursor cursor, Rect
Event evt = Event.current;
switch (evt.GetTypeForControl(id))
{
case EventType.mouseDown:
case EventType.MouseDown:
// am I closest to the thingy?
if (evt.button == 0 &&
cursorRect.Contains(Event.current.mousePosition) &&
Expand All @@ -67,7 +67,7 @@ static private Vector2 ScaleSlider(int id, Vector2 pos, MouseCursor cursor, Rect
EditorGUIUtility.SetWantsMouseJumping(1);
}
break;
case EventType.mouseDrag:
case EventType.MouseDrag:
if (GUIUtility.hotControl == id)
{
s_CurrentMousePosition += evt.delta;
Expand All @@ -78,15 +78,15 @@ static private Vector2 ScaleSlider(int id, Vector2 pos, MouseCursor cursor, Rect
evt.Use();
}
break;
case EventType.mouseUp:
case EventType.MouseUp:
if (GUIUtility.hotControl == id && (evt.button == 0 || evt.button == 2))
{
GUIUtility.hotControl = 0;
evt.Use();
EditorGUIUtility.SetWantsMouseJumping(0);
}
break;
case EventType.keyDown:
case EventType.KeyDown:
if (GUIUtility.hotControl == id)
{
if (evt.keyCode == KeyCode.Escape)
Expand All @@ -98,7 +98,7 @@ static private Vector2 ScaleSlider(int id, Vector2 pos, MouseCursor cursor, Rect
}
}
break;
case EventType.repaint:
case EventType.Repaint:
EditorGUIUtility.AddCursorRect(cursorRect, cursor, id);
break;
}
Expand All @@ -124,7 +124,7 @@ static internal Vector2 PivotSlider(Rect sprite, Vector2 pos, GUIStyle pivotDot,
Event evt = Event.current;
switch (evt.GetTypeForControl(id))
{
case EventType.mouseDown:
case EventType.MouseDown:
// am I closest to the thingy?
if (evt.button == 0 && handleScreenPos.Contains(Event.current.mousePosition) && !evt.alt)
{
Expand All @@ -137,7 +137,7 @@ static internal Vector2 PivotSlider(Rect sprite, Vector2 pos, GUIStyle pivotDot,
EditorGUIUtility.SetWantsMouseJumping(1);
}
break;
case EventType.mouseDrag:
case EventType.MouseDrag:
if (GUIUtility.hotControl == id)
{
s_CurrentMousePosition += evt.delta;
Expand All @@ -149,15 +149,15 @@ static internal Vector2 PivotSlider(Rect sprite, Vector2 pos, GUIStyle pivotDot,
evt.Use();
}
break;
case EventType.mouseUp:
case EventType.MouseUp:
if (GUIUtility.hotControl == id && (evt.button == 0 || evt.button == 2))
{
GUIUtility.hotControl = 0;
evt.Use();
EditorGUIUtility.SetWantsMouseJumping(0);
}
break;
case EventType.keyDown:
case EventType.KeyDown:
if (GUIUtility.hotControl == id)
{
if (evt.keyCode == KeyCode.Escape)
Expand All @@ -169,7 +169,7 @@ static internal Vector2 PivotSlider(Rect sprite, Vector2 pos, GUIStyle pivotDot,
}
}
break;
case EventType.repaint:
case EventType.Repaint:
EditorGUIUtility.AddCursorRect(handleScreenPos, MouseCursor.Arrow, id);

if (GUIUtility.hotControl == id)
Expand Down Expand Up @@ -201,15 +201,15 @@ static internal Rect SliderRect(Rect pos)

switch (evt.GetTypeForControl(id))
{
case EventType.mouseDown:
case EventType.MouseDown:
// am I closest to the thingy?
if (evt.button == 0 && pos.Contains(Handles.inverseMatrix.MultiplyPoint(Event.current.mousePosition)) && !evt.alt)
{
HandleSliderRectMouseDown(id, evt, pos);
evt.Use();
}
break;
case EventType.mouseDrag:
case EventType.MouseDrag:
if (GUIUtility.hotControl == id)
{
s_CurrentMousePosition += evt.delta;
Expand All @@ -222,15 +222,15 @@ static internal Rect SliderRect(Rect pos)
evt.Use();
}
break;
case EventType.mouseUp:
case EventType.MouseUp:
if (GUIUtility.hotControl == id && (evt.button == 0 || evt.button == 2))
{
GUIUtility.hotControl = 0;
evt.Use();
EditorGUIUtility.SetWantsMouseJumping(0);
}
break;
case EventType.keyDown:
case EventType.KeyDown:
if (GUIUtility.hotControl == id)
{
if (evt.keyCode == KeyCode.Escape)
Expand All @@ -242,7 +242,7 @@ static internal Rect SliderRect(Rect pos)
}
}
break;
case EventType.repaint:
case EventType.Repaint:
Vector2 topleft = Handles.inverseMatrix.MultiplyPoint(new Vector2(pos.xMin, pos.yMin));
Vector2 bottomright = Handles.inverseMatrix.MultiplyPoint(new Vector2(pos.xMax, pos.yMax));
EditorGUIUtility.AddCursorRect(new Rect(topleft.x, topleft.y, bottomright.x - topleft.x, bottomright.y - topleft.y), MouseCursor.Arrow, id);
Expand Down Expand Up @@ -275,7 +275,7 @@ static internal Rect RectCreator(Rect textureArea, GUIStyle rectStyle)

switch (evt.GetTypeForControl(id))
{
case EventType.mouseDown:
case EventType.MouseDown:
if (evt.button == 0)
{
GUIUtility.hotControl = id;
Expand All @@ -295,15 +295,15 @@ static internal Rect RectCreator(Rect textureArea, GUIStyle rectStyle)
evt.Use();
}
break;
case EventType.mouseDrag:
case EventType.MouseDrag:
if (GUIUtility.hotControl == id)
{
s_CurrentMousePosition = new Vector2(mousePos.x, mousePos.y);
evt.Use();
}
break;

case EventType.repaint:
case EventType.Repaint:
if (GUIUtility.hotControl == id && ValidRect(s_DragStartScreenPosition, s_CurrentMousePosition))
{
// TODO: use rectstyle
Expand All @@ -314,7 +314,7 @@ static internal Rect RectCreator(Rect textureArea, GUIStyle rectStyle)
}
break;

case EventType.mouseUp:
case EventType.MouseUp:
if (GUIUtility.hotControl == id && evt.button == 0)
{
if (ValidRect(s_DragStartScreenPosition, s_CurrentMousePosition))
Expand All @@ -327,7 +327,7 @@ static internal Rect RectCreator(Rect textureArea, GUIStyle rectStyle)
GUIUtility.hotControl = 0;
}
break;
case EventType.keyDown:
case EventType.KeyDown:
if (GUIUtility.hotControl == id)
{
if (evt.keyCode == KeyCode.Escape)
Expand Down
6 changes: 3 additions & 3 deletions Editor/Mono/SpriteEditor/SpriteEditorUtility.cs
Expand Up @@ -127,14 +127,14 @@ public static void DrawBox(Rect position)

public static void DrawLine(Vector3 p1, Vector3 p2)
{
Assert.IsTrue(Event.current.type == EventType.repaint);
Assert.IsTrue(Event.current.type == EventType.Repaint);
GL.Vertex(p1);
GL.Vertex(p2);
}

public static void BeginLines(Color color)
{
Assert.IsTrue(Event.current.type == EventType.repaint);
Assert.IsTrue(Event.current.type == EventType.Repaint);
HandleUtility.ApplyWireMaterial();
GL.PushMatrix();
GL.MultMatrix(Handles.matrix);
Expand All @@ -144,7 +144,7 @@ public static void BeginLines(Color color)

public static void EndLines()
{
Assert.IsTrue(Event.current.type == EventType.repaint);
Assert.IsTrue(Event.current.type == EventType.Repaint);
GL.End();
GL.PopMatrix();
}
Expand Down
2 changes: 1 addition & 1 deletion Editor/Mono/SpriteEditor/SpriteEditorWindow.cs
Expand Up @@ -444,7 +444,7 @@ private void DoToolbarGUI()
GUIStyle toolBarStyle = EditorStyles.toolbar;

Rect toolbarRect = new Rect(0, 0, position.width, k_ToolbarHeight);
if (m_EventSystem.current.type == EventType.repaint)
if (m_EventSystem.current.type == EventType.Repaint)
{
toolBarStyle.Draw(toolbarRect, false, false, false, false);
}
Expand Down
2 changes: 1 addition & 1 deletion Editor/Mono/Sprites/SpritePackerWindow.cs
Expand Up @@ -143,7 +143,7 @@ private Rect DoToolbarGUI()
{
Rect toolbarRect = new Rect(0 , 0, position.width, k_ToolbarHeight);

if (Event.current.type == EventType.repaint)
if (Event.current.type == EventType.Repaint)
{
EditorStyles.toolbar.Draw(toolbarRect, false, false, false, false);
}
Expand Down
28 changes: 14 additions & 14 deletions Editor/Mono/StyleSheets/StyleSheetImporter.cs
Expand Up @@ -102,7 +102,7 @@ void VisitSheet(ParserStyleSheet styleSheet)
m_Builder.BeginProperty(property.Name);

// Note: we must rely on recursion to correctly handle parser types here
VisitValue(property.Term);
VisitValue(m_Errors, m_Builder, property.Term);

m_Builder.EndProperty();
}
Expand All @@ -111,7 +111,7 @@ void VisitSheet(ParserStyleSheet styleSheet)
}
}

void VisitValue(Term term)
internal static void VisitValue(StyleSheetImportErrors errors, StyleSheetBuilder ssb, Term term)
{
var primitiveTerm = term as PrimitiveTerm;
var colorTerm = term as HtmlColor;
Expand All @@ -120,7 +120,7 @@ void VisitValue(Term term)

if (term == PrimitiveTerm.Inherit)
{
m_Builder.AddValue(StyleValueKeyword.Inherit);
ssb.AddValue(StyleValueKeyword.Inherit);
}
else if (primitiveTerm != null)
{
Expand All @@ -131,57 +131,57 @@ void VisitValue(Term term)
case UnitType.Pixel:
case UnitType.Number:
float? floatValue = primitiveTerm.GetFloatValue(UnitType.Pixel);
m_Builder.AddValue(floatValue.Value);
ssb.AddValue(floatValue.Value);
break;
case UnitType.Ident:
StyleValueKeyword keyword;
if (TryParseKeyword(rawStr, out keyword))
{
m_Builder.AddValue(keyword);
ssb.AddValue(keyword);
}
else
{
m_Builder.AddValue(rawStr, StyleValueType.Enum);
ssb.AddValue(rawStr, StyleValueType.Enum);
}
break;
case UnitType.String:
string unquotedStr = rawStr.Trim('\'', '\"');
m_Builder.AddValue(unquotedStr, StyleValueType.String);
ssb.AddValue(unquotedStr, StyleValueType.String);
break;
default:
m_Errors.AddSemanticError(StyleSheetImportErrorCode.UnsupportedUnit, primitiveTerm.ToString());
errors.AddSemanticError(StyleSheetImportErrorCode.UnsupportedUnit, primitiveTerm.ToString());
return;
}
}
else if (colorTerm != null)
{
var color = new Color((float)colorTerm.R / 255.0f, (float)colorTerm.G / 255.0f, (float)colorTerm.B / 255.0f, (float)colorTerm.A / 255.0f);
m_Builder.AddValue(color);
ssb.AddValue(color);
}
else if (funcTerm != null)
{
primitiveTerm = funcTerm.Arguments.FirstOrDefault() as PrimitiveTerm;
if (funcTerm.Name == k_ResourcePathFunctionName && primitiveTerm != null)
{
string path = primitiveTerm.Value as string;
m_Builder.AddValue(path, StyleValueType.ResourcePath);
ssb.AddValue(path, StyleValueType.ResourcePath);
}
else
{
m_Errors.AddSemanticError(StyleSheetImportErrorCode.UnsupportedFunction, funcTerm.Name);
errors.AddSemanticError(StyleSheetImportErrorCode.UnsupportedFunction, funcTerm.Name);
}
}
else if (termList != null)
{
foreach (Term childTerm in termList)
{
VisitValue(childTerm);
VisitValue(errors, ssb, childTerm);
}
return;
}
else
{
m_Errors.AddInternalError(term.GetType().Name);
errors.AddInternalError(term.GetType().Name);
}
}

Expand Down Expand Up @@ -325,7 +325,7 @@ string ExtractSimpleSelector(BaseSelector selector)

static Dictionary<string, StyleValueKeyword> s_NameCache;

bool TryParseKeyword(string rawStr, out StyleValueKeyword value)
static bool TryParseKeyword(string rawStr, out StyleValueKeyword value)
{
if (s_NameCache == null)
{
Expand Down
124 changes: 75 additions & 49 deletions Editor/Mono/TerrainEditor/TerrainInspector.cs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Editor/Mono/Tutorial/Highlighter.cs
Expand Up @@ -58,7 +58,7 @@ public static bool Highlight(string windowTitle, string text, HighlightSearchMod
{
Debug.LogWarning("Highlighter recursion detected. You are calling Highlighter.Highlight() with too much abandon. Avoid highlighting during layout and repaint events.");
}
else if (Event.current != null && Event.current.type == EventType.layout)
else if (Event.current != null && Event.current.type == EventType.Layout)
{
Debug.LogWarning("You are calling Highlighter.Highlight() inorrectly. Avoid highlighting during layout and repaint events.");
}
Expand Down