Skip to content

Commit 3417c31

Browse files
author
Unity Technologies
committed
Unity 2020.2.0a7 C# reference source code
1 parent c5523a8 commit 3417c31

File tree

414 files changed

+15088
-8521
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

414 files changed

+15088
-8521
lines changed

Editor/Mono/2D/SpriteAtlas/EditorSpriteAtlas.bindings.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,5 +96,8 @@ public static class SpriteAtlasExtensions
9696
extern internal static TextureFormat GetTextureFormat(this SpriteAtlas spriteAtlas, BuildTarget target);
9797
extern internal static Sprite[] GetPackedSprites(this SpriteAtlas spriteAtlas);
9898
extern internal static Hash128 GetStoredHash(this SpriteAtlas spriteAtlas);
99+
extern internal static TextureImporterPlatformSettings GetSecondaryPlatformSettings(this SpriteAtlas spriteAtlas, string buildTarget, string secondaryTextureName);
100+
extern internal static void SetSecondaryPlatformSettings(this SpriteAtlas spriteAtlas, TextureImporterPlatformSettings src, string secondaryTextureName);
101+
extern internal static void DeleteSecondaryPlatformSettings(this SpriteAtlas spriteAtlas, string secondaryTextureName);
99102
}
100103
}

Editor/Mono/2D/SpriteAtlas/SpriteAtlasAsset.bindings.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,8 @@ public class SpriteAtlasAsset : UnityEngine.Object
4040

4141
extern internal TextureFormat GetTextureFormat(BuildTarget target);
4242
extern internal void CopyMasterAtlasSettings();
43+
extern internal TextureImporterPlatformSettings GetSecondaryPlatformSettings(string buildTarget, string secondaryTextureName);
44+
extern internal void SetSecondaryPlatformSettings(TextureImporterPlatformSettings src, string secondaryTextureName);
45+
extern internal void DeleteSecondaryPlatformSettings(string secondaryTextureName);
4346
}
4447
};

Editor/Mono/2D/SpriteAtlas/SpriteAtlasImporterInspector.cs

Lines changed: 179 additions & 10 deletions
Large diffs are not rendered by default.

Editor/Mono/2D/SpriteAtlas/SpriteAtlasInspector.cs

Lines changed: 192 additions & 17 deletions
Large diffs are not rendered by default.

Editor/Mono/Animation/AnimationWindow/AnimationWindowState.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,9 @@ private void Refresh()
302302
m_SelectedKeysCache = null;
303303
m_SelectionBoundsCache = null;
304304

305+
if (animEditor != null && animEditor.curveEditor != null)
306+
animEditor.curveEditor.InvalidateSelectionBounds();
307+
305308
ClearCurveWrapperCache();
306309

307310
if (hierarchyData != null)
@@ -323,6 +326,9 @@ private void Refresh()
323326
m_SelectedKeysCache = null;
324327
m_SelectionBoundsCache = null;
325328

329+
if (animEditor != null && animEditor.curveEditor != null)
330+
animEditor.curveEditor.InvalidateSelectionBounds();
331+
326332
ReloadModifiedAnimationCurveCache();
327333
ReloadModifiedDopelineCache();
328334
ReloadModifiedCurveWrapperCache();
@@ -465,6 +471,8 @@ void CurveWasModified(AnimationClip clip, EditorCurveBinding binding, AnimationU
465471
// Otherwise do a full reload
466472
refresh = RefreshType.Everything;
467473
}
474+
// Force repaint to display live animation curve changes from other editor window (like timeline).
475+
Repaint();
468476
}
469477

470478
public void SaveKeySelection(string undoLabel)

Editor/Mono/Animation/AnimationWindow/CurveEditor.cs

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ public int MoveKey(int index, ref Keyframe key)
131131
return curve.MoveKey(index, key);
132132
}
133133

134+
internal Bounds ComputeBoundsBetweenTime(float start, float end) => renderer.GetBounds(start, end);
135+
134136
// An additional vertical min / max range clamp when editing multiple curves with different ranges
135137
public float vRangeMin = -Mathf.Infinity;
136138
public float vRangeMax = Mathf.Infinity;
@@ -520,6 +522,7 @@ internal Keyframe GetKeyframeFromSelection(CurveSelection curveSelection)
520522

521523
private bool m_BoundsAreDirty = true;
522524
private bool m_SelectionBoundsAreDirty = true;
525+
private bool m_SelectionWithCurvesBoundsAreDirty = true;
523526

524527
private bool m_EnableCurveGroups = false;
525528

@@ -533,6 +536,16 @@ public Bounds selectionBounds
533536
}
534537
}
535538

539+
Bounds m_SelectionWithCurvesBounds = new Bounds(Vector3.zero, Vector3.zero);
540+
public Bounds selectionWithCurvesBounds
541+
{
542+
get
543+
{
544+
RecalculateSelectionWithCurvesBounds();
545+
return m_SelectionWithCurvesBounds;
546+
}
547+
}
548+
536549
Bounds m_CurveBounds = new Bounds(Vector3.zero, Vector3.zero);
537550
public Bounds curveBounds
538551
{
@@ -830,6 +843,7 @@ private void RecalculateBounds()
830843
public void InvalidateSelectionBounds()
831844
{
832845
m_SelectionBoundsAreDirty = true;
846+
m_SelectionWithCurvesBoundsAreDirty = true;
833847
}
834848

835849
private void RecalculateSelectionBounds()
@@ -858,6 +872,37 @@ private void RecalculateSelectionBounds()
858872
m_SelectionBoundsAreDirty = false;
859873
}
860874

875+
private void RecalculateSelectionWithCurvesBounds()
876+
{
877+
if (!m_SelectionWithCurvesBoundsAreDirty)
878+
return;
879+
880+
m_SelectionWithCurvesBounds = m_SelectionBounds;
881+
882+
//Aggregate selected key in between curves.
883+
if (hasSelection)
884+
{
885+
CurveSelection[] selected = selectedCurves.OrderBy(p => p.curveID).ThenBy(p => p.key).ToArray();
886+
int currentCurveId = selected.First().curveID;
887+
CurveWrapper currentCurveWrapper = GetCurveWrapperFromID(currentCurveId);
888+
for (int i = 0; i < selected.Length - 1; i++)
889+
{
890+
if (currentCurveId != selected[i + 1].curveID)
891+
{
892+
currentCurveId = selected[i + 1].curveID;
893+
currentCurveWrapper = GetCurveWrapperFromID(currentCurveId);
894+
continue;
895+
}
896+
Keyframe keyframeStart = GetKeyframeFromSelection(selected[i]);
897+
Keyframe keyframeEnd = GetKeyframeFromSelection(selected[i + 1]);
898+
Bounds inBetweenBounds = currentCurveWrapper.ComputeBoundsBetweenTime(keyframeStart.time, keyframeEnd.time);
899+
m_SelectionWithCurvesBounds.Encapsulate(inBetweenBounds);
900+
}
901+
}
902+
903+
m_SelectionWithCurvesBoundsAreDirty = false;
904+
}
905+
861906
public Bounds GetClipBounds()
862907
{
863908
return curveBounds;
@@ -884,10 +929,16 @@ public Bounds GetSelectionBounds()
884929
frameBounds.Encapsulate(new Vector2(cw.curve[cs.key - 1].time, cw.curve[cs.key - 1].value));
885930
if (cs.key + 1 < cw.curve.length)
886931
frameBounds.Encapsulate(new Vector2(cw.curve[cs.key + 1].time, cw.curve[cs.key + 1].value));
932+
933+
//Include neighboring curves in bounds
934+
if (cs.key - 1 >= 0)
935+
frameBounds.Encapsulate(cw.ComputeBoundsBetweenTime(cw.curve[cs.key - 1].time, cw.curve[cs.key].time));
936+
if (cs.key + 1 < cw.curve.length)
937+
frameBounds.Encapsulate(cw.ComputeBoundsBetweenTime(cw.curve[cs.key].time, cw.curve[cs.key + 1].time));
887938
}
888939
else
889940
{
890-
frameBounds = selectionBounds;
941+
frameBounds = selectionWithCurvesBounds;
891942
}
892943

893944
// Enforce minimum size of bounds

Editor/Mono/Annotation/AnnotationUtility.bindings.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ internal sealed partial class AnnotationUtility
3333

3434
extern internal static void SetIconEnabled(int classID, string scriptClass, int iconEnabled);
3535

36+
[StaticAccessor("GizmoManager::Get()", StaticAccessorType.Dot)]
37+
extern internal static int SetGizmosDirty();
38+
3639
[StaticAccessor("GetAnnotationManager()", StaticAccessorType.Dot)]
3740
extern internal static string[] GetPresetList();
3841

Editor/Mono/Annotation/AnnotationWindow.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,15 @@ internal static bool ShowAtPosition(Rect buttonRect, bool isGameView)
173173
Event.current.Use();
174174
if (s_AnnotationWindow == null)
175175
s_AnnotationWindow = ScriptableObject.CreateInstance<AnnotationWindow>();
176+
else
177+
{
178+
// We are treating AnnotationWindow like a PopupWindow which has logic to reclose it when opened,
179+
// AuxWindows derived from EditorWindow reset/reopen when repeatedly clicking the open button by design.
180+
// Call Cancel() here if it is already open.
181+
s_AnnotationWindow.Cancel();
182+
return false;
183+
}
184+
176185
s_AnnotationWindow.Init(buttonRect, isGameView);
177186
return true;
178187
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Unity C# reference source
2+
// Copyright (c) Unity Technologies. For terms of use, see
3+
// https://unity3d.com/legal/licenses/Unity_Reference_Only_License
4+
5+
using UnityEngine;
6+
using UnityEngine.Bindings;
7+
8+
namespace UnityEditor
9+
{
10+
[NativeHeader("Editor/Src/AssetPipeline/ComputeShaderImporter.h")]
11+
public sealed partial class ComputeShaderImporter : AssetImporter
12+
{
13+
[NativeProperty("PreprocessorOverride")] extern public PreprocessorOverride preprocessorOverride { get; set; }
14+
}
15+
}

Editor/Mono/AssetPipeline/ShaderImporter.bindings.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
namespace UnityEditor
99
{
1010
[NativeHeader("Editor/Src/AssetPipeline/ShaderImporter.h")]
11-
12-
1311
public sealed partial class ShaderImporter : AssetImporter
1412
{
1513
public extern Shader GetShader();
@@ -21,5 +19,7 @@ public sealed partial class ShaderImporter : AssetImporter
2119
public extern void SetNonModifiableTextures(string[] name, Texture[] textures);
2220

2321
public extern Texture GetNonModifiableTexture(string name);
22+
23+
[NativeProperty("PreprocessorOverride")] extern public PreprocessorOverride preprocessorOverride { get; set; }
2424
}
2525
}

0 commit comments

Comments
 (0)