Skip to content

Commit

Permalink
com.unity.render-pipelines.core@10.2.1
Browse files Browse the repository at this point in the history
## [10.2.1] - 2020-11-30

Version Updated
The version number for this package has increased due to a version update of a related graphics package.
  • Loading branch information
Unity Technologies committed Nov 30, 2020
1 parent 3f444e5 commit 24cc2c4
Show file tree
Hide file tree
Showing 11 changed files with 168 additions and 144 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this package will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [10.2.1] - 2020-11-30

Version Updated
The version number for this package has increased due to a version update of a related graphics package.

## [10.2.0] - 2020-10-19

Version Updated
Expand Down
56 changes: 41 additions & 15 deletions Editor/LookDev/CameraController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,24 @@ enum Direction
bool m_InFlyMotion;

bool m_IsDragging;
ViewTool m_BehaviorState;
static TimeHelper s_Timer = new TimeHelper();

ViewTool m_BehaviorState;
ViewTool behaviorState
{
get { return m_BehaviorState; }
set
{
if (value != m_BehaviorState && m_BehaviorState == ViewTool.FPS)
{
isDragging = false;
inFlyMotion = false;
m_DirectionKeyPressed = Direction.None;
}
m_BehaviorState = value;
}
}

protected CameraState m_CameraState;
DisplayWindow m_Window;
protected Action m_Focused;
Expand Down Expand Up @@ -125,13 +140,13 @@ private void ResetCameraControl()
{
isDragging = false;
inFlyMotion = false;
m_BehaviorState = ViewTool.None;
behaviorState = ViewTool.None;
}

protected virtual void OnScrollWheel(WheelEvent evt)
{
// See UnityEditor.SceneViewMotion.HandleScrollWheel
switch (m_BehaviorState)
switch (behaviorState)
{
case ViewTool.FPS: OnChangeFPSCameraSpeed(evt); break;
default: OnZoom(evt); break;
Expand All @@ -140,7 +155,7 @@ protected virtual void OnScrollWheel(WheelEvent evt)

void OnMouseDrag(MouseMoveEvent evt)
{
switch (m_BehaviorState)
switch (behaviorState)
{
case ViewTool.Orbit: OnMouseDragOrbit(evt); break;
case ViewTool.FPS: OnMouseDragFPS(evt); break;
Expand Down Expand Up @@ -241,7 +256,7 @@ void OnKeyDownReset(KeyDownEvent evt)
void OnKeyUpOrDownFPS<T>(KeyboardEventBase<T> evt)
where T : KeyboardEventBase<T>, new()
{
if (m_BehaviorState != ViewTool.FPS)
if (behaviorState != ViewTool.FPS)
return;

//Note: Keydown is called in loop but between first occurence of the
Expand Down Expand Up @@ -318,30 +333,41 @@ bool GetKeyCombinationByID(string ID, out KeyCombination combination)
return false;
}
}


ViewTool GetBehaviorTool<T>(MouseEventBase<T> evt, bool onMac) where T : MouseEventBase<T>, new()
{
if (evt.button == 2)
return ViewTool.Pan;
else if (evt.button == 0 && evt.ctrlKey && onMac || evt.button == 1 && evt.altKey)
return ViewTool.Zoom;
else if (evt.button == 0)
return ViewTool.Orbit;
else if (evt.button == 1 && !evt.altKey)
return ViewTool.FPS;
return ViewTool.None;
}

void OnMouseUp(MouseUpEvent evt)
{
ResetCameraControl();
bool onMac = Application.platform == RuntimePlatform.OSXEditor;
var state = GetBehaviorTool(evt, onMac);

if (state == behaviorState)
ResetCameraControl();
evt.StopPropagation();
}

void OnMouseDown(MouseDownEvent evt)
{
bool onMac = Application.platform == RuntimePlatform.OSXEditor;
behaviorState = GetBehaviorTool(evt, onMac);

if (evt.button == 2)
m_BehaviorState = ViewTool.Pan;
else if (evt.button == 0 && evt.ctrlKey && onMac || evt.button == 1 && evt.altKey)
if (behaviorState == ViewTool.Zoom)
{
m_BehaviorState = ViewTool.Zoom;
m_StartZoom = m_CameraState.viewSize;
m_ZoomSpeed = Mathf.Max(Mathf.Abs(m_StartZoom), .3f);
m_TotalMotion = 0;
}
else if (evt.button == 0)
m_BehaviorState = ViewTool.Orbit;
else if (evt.button == 1 && !evt.altKey)
m_BehaviorState = ViewTool.FPS;

// see also SceneView.HandleClickAndDragToFocus()
if (evt.button == 1 && onMac)
Expand Down
33 changes: 15 additions & 18 deletions Editor/LookDev/Compositor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,25 +200,22 @@ public void Render()
if (UnityEditorInternal.RenderDoc.IsLoaded() && UnityEditorInternal.RenderDoc.IsSupported() && m_RenderDocAcquisitionRequested)
UnityEditorInternal.RenderDoc.BeginCaptureRenderDoc(m_Displayer as EditorWindow);

using (new UnityEngine.Rendering.VolumeIsolationScope(true))
switch (m_Contexts.layout.viewLayout)
{
switch (m_Contexts.layout.viewLayout)
{
case Layout.FullFirstView:
RenderSingleAndOutput(ViewIndex.First);
break;
case Layout.FullSecondView:
RenderSingleAndOutput(ViewIndex.Second);
break;
case Layout.HorizontalSplit:
case Layout.VerticalSplit:
RenderSingleAndOutput(ViewIndex.First);
RenderSingleAndOutput(ViewIndex.Second);
break;
case Layout.CustomSplit:
RenderCompositeAndOutput();
break;
}
case Layout.FullFirstView:
RenderSingleAndOutput(ViewIndex.First);
break;
case Layout.FullSecondView:
RenderSingleAndOutput(ViewIndex.Second);
break;
case Layout.HorizontalSplit:
case Layout.VerticalSplit:
RenderSingleAndOutput(ViewIndex.First);
RenderSingleAndOutput(ViewIndex.Second);
break;
case Layout.CustomSplit:
RenderCompositeAndOutput();
break;
}

//TODO: make integration EditorWindow agnostic!
Expand Down
69 changes: 6 additions & 63 deletions Editor/LookDev/DisplayWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -249,16 +249,10 @@ void ReloadStyleSheets()
rootVisualElement.styleSheets.Add(styleSheetLight);
}
}

void OnEnable()
void CreateGUI()
{
//Stylesheet
// Try to load stylesheet. Timing can be odd while upgrading packages (case 1219692).
// In this case, it will be fixed in OnGUI. Though it can spawn error while reimporting assets.
// Waiting for filter on stylesheet (case 1228706) to remove last error.
// On Editor Skin change, OnEnable is called and stylesheets need to be reloaded (case 1278802).
if(EditorApplication.isUpdating)
ReloadStyleSheets();
ReloadStyleSheets();

//Call the open function to configure LookDev
// in case the window where open when last editor session finished.
Expand All @@ -284,7 +278,10 @@ void OnEnable()

ApplyLayout(viewLayout);
ApplySidePanelChange(layout.showedSidePanel);
}

void OnEnable()
{
Undo.undoRedoPerformed += FullRefreshEnvironmentList;
}

Expand Down Expand Up @@ -672,60 +669,6 @@ void Update()

void OnGUI()
{
//Stylesheet
// [case 1219692] if LookDev is open while reimporting CoreRP package,
// stylesheet can be null. In this case, we can have a null stylesheet
// registered as it got destroyed. Reloading it. As we cannot just
// remove a null entry, we must filter and reconstruct the while list.
if (styleSheet == null || styleSheet.Equals(null)
|| (!EditorGUIUtility.isProSkin && (styleSheetLight == null || styleSheetLight.Equals(null))))
{
// While (case 1228706) is still on going, we sill close and reopen the look dev.
// This will prevent spawning error at frame.
// Note 2: This actually causes the lookdev to break completely with light theme.
// Until the actual issue is fixed, we'll comment this fix out as it only concerns an upgrade problem.
//LookDev.Close();
//LookDev.Open();
//return;

// Following lines is the correct fix if UIElement filter garbage collected Stylesheet.

//System.Collections.Generic.List<StyleSheet> usedStyleSheets = new System.Collections.Generic.List<StyleSheet>();
//int currentCount = rootVisualElement.styleSheets.count;
//for (int i = 0; i < currentCount; ++i)
//{
// StyleSheet sheet = rootVisualElement.styleSheets[i];
// if (sheet != null && !sheet.Equals(null))
// usedStyleSheets.Add(sheet);
//}
//rootVisualElement.styleSheets.Clear();
//foreach (StyleSheet sheet in usedStyleSheets)
// rootVisualElement.styleSheets.Add(sheet);

//styleSheet = AssetDatabase.LoadAssetAtPath<StyleSheet>(Style.k_uss);
//if (styleSheet != null && !styleSheet.Equals(null))
//{
// rootVisualElement.styleSheets.Add(styleSheet);
// if (!EditorGUIUtility.isProSkin)
// {
// rootVisualElement.styleSheets.Add(
// AssetDatabase.LoadAssetAtPath<StyleSheet>(Style.k_uss_personal_overload));
// }
//}

//if (styleSheet == null || styleSheet.Equals(null))
//{
// styleSheet = AssetDatabase.LoadAssetAtPath<StyleSheet>(Style.k_uss);
// if (styleSheet != null && !styleSheet.Equals(null))
// rootVisualElement.styleSheets.Add(styleSheet);
//}
//if (!EditorGUIUtility.isProSkin && styleSheetLight != null && !styleSheetLight.Equals(null))
//{
// styleSheetLight = AssetDatabase.LoadAssetAtPath<StyleSheet>(Style.k_uss_personal_overload);
// if (styleSheetLight != null && !styleSheetLight.Equals(null))
// rootVisualElement.styleSheets.Add(styleSheetLight);
//}
}
if(EditorApplication.isUpdating)
return;

Expand Down
Loading

0 comments on commit 24cc2c4

Please sign in to comment.