Skip to content

Commit bdf9337

Browse files
author
Unity Technologies
committed
Unity 2017.1.0a5 C# reference source code
1 parent 8a91bd6 commit bdf9337

81 files changed

Lines changed: 1989 additions & 273 deletions

File tree

Some content is hidden

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

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

Lines changed: 449 additions & 0 deletions
Large diffs are not rendered by default.

Editor/Mono/Animation/AnimationWindow/AddCurvesPopup.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,14 @@ void Init(Rect buttonRect)
3333
ShowAsDropDown(buttonRect, windowSize, new[] { PopupLocationHelper.PopupLocation.Right });
3434
}
3535

36+
void OnEnable()
37+
{
38+
AssemblyReloadEvents.beforeAssemblyReload += Close;
39+
}
40+
3641
void OnDisable()
3742
{
43+
AssemblyReloadEvents.beforeAssemblyReload -= Close;
3844
s_LastClosedTime = System.DateTime.Now.Ticks / System.TimeSpan.TicksPerMillisecond;
3945
s_AddCurvesPopup = null;
4046
s_Hierarchy = null;
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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 Unity.Bindings;
6+
using UnityEngine;
7+
using UnityEditor;
8+
using Object = UnityEngine.Object;
9+
10+
namespace UnityEditor.Experimental.Animations
11+
{
12+
[NativeInclude(Header = "Runtime/Animation/EditorCurveBinding.bindings.h")]
13+
[NativeInclude(Header = "Runtime/Animation/AnimationClip.h")]
14+
[NativeInclude(Header = "Editor/Src/Animation/GameObjectRecorder.h")]
15+
[NativeType]
16+
public class GameObjectRecorder : Object
17+
{
18+
public GameObjectRecorder()
19+
{
20+
Internal_Create(this);
21+
}
22+
23+
extern private static void Internal_Create([Writable] GameObjectRecorder notSelf);
24+
25+
// Root.
26+
extern public GameObject root { set; get; }
27+
28+
// Bindings.
29+
extern public void Bind(EditorCurveBinding binding);
30+
extern public void BindAllProperties(GameObject target, bool recursive);
31+
extern public void BindTransform(GameObject target, bool recursive);
32+
extern public EditorCurveBinding[] GetBindings();
33+
34+
// Recording.
35+
extern public void TakeSnapshot(float dt);
36+
extern public float currentTime { get; }
37+
extern public bool isRecording { get; }
38+
39+
extern public void SaveToClip(AnimationClip clip);
40+
extern public void ResetRecording();
41+
}
42+
}

Editor/Mono/Animation/TransitionPreview.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace UnityEditor
1313
internal class TransitionPreview
1414
{
1515
private AvatarPreview m_AvatarPreview;
16-
private Timeline m_Timeline;
16+
private TimelineControl m_Timeline;
1717

1818
private AnimatorController m_Controller;
1919
private AnimatorStateMachine m_StateMachine;
@@ -152,8 +152,8 @@ private void CopyTransitionForPreview(AnimatorStateTransition src, ref AnimatorS
152152
float m_RightStateTimeA = 0;
153153
float m_RightStateTimeB = 1;
154154

155-
List<Timeline.PivotSample> m_SrcPivotList = new List<Timeline.PivotSample>();
156-
List<Timeline.PivotSample> m_DstPivotList = new List<Timeline.PivotSample>();
155+
List<TimelineControl.PivotSample> m_SrcPivotList = new List<TimelineControl.PivotSample>();
156+
List<TimelineControl.PivotSample> m_DstPivotList = new List<TimelineControl.PivotSample>();
157157

158158
private bool MustResample(TransitionInfo info)
159159
{
@@ -351,7 +351,7 @@ private void ResampleTransition(AnimatorStateTransition transition, AvatarMask l
351351
currentTime = 0.0f;
352352
while (currentTime <= rightDuration)
353353
{
354-
Timeline.PivotSample sample = new Timeline.PivotSample();
354+
TimelineControl.PivotSample sample = new TimelineControl.PivotSample();
355355
sample.m_Time = currentTime;
356356
sample.m_Weight = m_AvatarPreview.Animator.pivotWeight;
357357
m_DstPivotList.Add(sample);
@@ -369,7 +369,7 @@ private void ResampleTransition(AnimatorStateTransition transition, AvatarMask l
369369
currentTime = 0.0f;
370370
while (currentTime <= leftDuration)
371371
{
372-
Timeline.PivotSample sample = new Timeline.PivotSample();
372+
TimelineControl.PivotSample sample = new TimelineControl.PivotSample();
373373
sample.m_Time = currentTime;
374374
sample.m_Weight = m_AvatarPreview.Animator.pivotWeight;
375375
m_SrcPivotList.Add(sample);
@@ -589,7 +589,7 @@ private void Init(Animator scenePreviewObject, Motion motion)
589589

590590
if (m_Timeline == null)
591591
{
592-
m_Timeline = new Timeline();
592+
m_Timeline = new TimelineControl();
593593
m_MustSampleMotions = true;
594594
}
595595

Editor/Mono/Annotation/AnnotationWindow.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,13 @@ float GetTopSectionHeight()
137137

138138
void OnEnable()
139139
{
140+
AssemblyReloadEvents.beforeAssemblyReload += Close;
140141
hideFlags = HideFlags.DontSave;
141142
}
142143

143144
void OnDisable()
144145
{
146+
AssemblyReloadEvents.beforeAssemblyReload -= Close;
145147
// When window closes we copy all changes to monoimporters (reimport monoScripts)
146148
foreach (MonoScript monoScript in m_MonoScriptIconsChanged)
147149
MonoImporter.CopyMonoScriptIconToImporters(monoScript);

Editor/Mono/Annotation/SceneRenderModeWindow.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@ bool IsModeDisabled(DrawCameraMode mode)
311311
{
312312
return (mode == DrawCameraMode.BakedLightmap && !m_EnableBakedGI.boolValue) ||
313313
(mode == DrawCameraMode.BakedAlbedo && (!m_EnableBakedGI.boolValue || !m_PathTracerBackend)) ||
314+
(mode == DrawCameraMode.BakedEmissive && (!m_EnableBakedGI.boolValue || !m_PathTracerBackend)) ||
314315
(mode == DrawCameraMode.BakedTexelValidity && (!m_EnableBakedGI.boolValue || !m_PathTracerBackend)) ||
315316
(mode >= DrawCameraMode.RealtimeCharting && mode < DrawCameraMode.BakedLightmap && !m_EnableRealtimeGI.boolValue && (!m_EnableBakedGI.boolValue || (m_EnableBakedGI.boolValue && m_PathTracerBackend)));
316317
}

Editor/Mono/AssemblyReloadEvents.cs

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,28 @@
22
// Copyright (c) Unity Technologies. For terms of use, see
33
// https://unity3d.com/legal/licenses/Unity_Reference_Only_License
44

5-
using UnityEditorInternal;
6-
using UnityEngine;
5+
using UnityEngine.Scripting;
76

87
namespace UnityEditor
98
{
10-
internal class AssemblyReloadEvents
9+
public static class AssemblyReloadEvents
1110
{
12-
// Called from C++
13-
public static void OnBeforeAssemblyReload()
11+
public delegate void AssemblyReloadCallback();
12+
public static event AssemblyReloadCallback beforeAssemblyReload;
13+
public static event AssemblyReloadCallback afterAssemblyReload;
14+
15+
[RequiredByNativeCode]
16+
static void OnBeforeAssemblyReload()
1417
{
15-
InternalEditorUtility.AuxWindowManager_OnAssemblyReload();
18+
if (beforeAssemblyReload != null)
19+
beforeAssemblyReload();
1620
}
1721

18-
// Called from C++
19-
public static void OnAfterAssemblyReload()
22+
[RequiredByNativeCode]
23+
static void OnAfterAssemblyReload()
2024
{
21-
// Repaint to ensure ProjectBrowser UI is initialized. This fixes the issue where a new script is created from the application menu
22-
// bar while the project browser ui was not initialized.
23-
foreach (ProjectBrowser pb in ProjectBrowser.GetAllProjectBrowsers())
24-
pb.Repaint();
25+
if (afterAssemblyReload != null)
26+
afterAssemblyReload();
2527
}
2628
}
2729
}

Editor/Mono/BuildPipeline/DesktopStandalonePostProcessor.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using UnityEditor.Modules;
99
using UnityEditorInternal;
1010
using UnityEditor.Scripting.Serialization;
11+
using UnityEngine;
1112

1213
internal abstract class DesktopStandalonePostProcessor
1314
{
@@ -29,6 +30,12 @@ public void PostProcess()
2930
CopyStagingAreaIntoDestination();
3031
}
3132

33+
public void UpdateBootConfig(BuildTarget target, BootConfigData config, BuildOptions options)
34+
{
35+
if (PlayerSettings.forceSingleInstance)
36+
config.AddKey("single-instance");
37+
}
38+
3239
private void CopyNativePlugins()
3340
{
3441
string buildTargetName = BuildPipeline.GetBuildTargetName(m_PostProcessArgs.target);

Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,13 @@ static public bool SupportsInstallInBuildFolder(BuildTargetGroup targetGroup, Bu
129129
}
130130
}
131131

132+
static public void UpdateBootConfig(BuildTargetGroup targetGroup, BuildTarget target, BootConfigData config, BuildOptions options)
133+
{
134+
IBuildPostprocessor postprocessor = ModuleManager.GetBuildPostProcessor(targetGroup, target);
135+
if (postprocessor != null)
136+
postprocessor.UpdateBootConfig(target, config, options);
137+
}
138+
132139
static public void Launch(BuildTargetGroup targetGroup, BuildTarget target, string path, string productName, BuildOptions options)
133140
{
134141
IBuildPostprocessor postprocessor = ModuleManager.GetBuildPostProcessor(targetGroup, target);

Editor/Mono/BuildPlayerWindow.cs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ public GUIContent GetDownloadErrorForTarget(BuildTarget target)
120120
public GUIContent explicitDivideByZeroChecks = EditorGUIUtility.TextContent("Divide By Zero Checks");
121121
public GUIContent enableHeadlessMode = EditorGUIUtility.TextContent("Headless Mode");
122122
public GUIContent buildScriptsOnly = EditorGUIUtility.TextContent("Scripts Only Build");
123-
public GUIContent forceOptimizeScriptCompilation = EditorGUIUtility.TextContent("Build Optimized Scripts|Compile IL2CPP using full compiler optimizations. Note this will obfuscate callstack output.");
124123
public GUIContent learnAboutUnityCloudBuild = EditorGUIUtility.TextContent("Learn about Unity Cloud Build");
125124

126125
public Styles()
@@ -246,9 +245,6 @@ static bool BuildPlayerWithDefaultSettings(bool askForBuildLocation, BuildOption
246245
if (EditorUserBuildSettings.buildScriptsOnly)
247246
options |= BuildOptions.BuildScriptsOnly;
248247

249-
if (EditorUserBuildSettings.forceOptimizeScriptCompilation)
250-
options |= BuildOptions.ForceOptimizeScriptCompilation;
251-
252248
if (installInBuildFolder)
253249
options |= BuildOptions.InstallInBuildFolder;
254250

@@ -1046,16 +1042,6 @@ void ShowBuildTargetSettings()
10461042
if (shouldDrawDebuggingToggle)
10471043
EditorUserBuildSettings.allowDebugging = EditorGUILayout.Toggle(styles.allowDebugging, EditorUserBuildSettings.allowDebugging);
10481044

1049-
// Get current il2cpp setting. Used to decide if optimized checkbox should be drawn.
1050-
// It doesn't make any sense for optimization to be available with anything other than il2cpp.
1051-
bool useIl2cpp = PlayerSettings.GetScriptingBackend(platform.targetGroup) == ScriptingImplementation.IL2CPP;
1052-
1053-
// Only show when optimize checkbox when development build is active and il2cpp player setting is used.
1054-
bool shouldDrawForceOptimizeScriptsCheckbox = buildWindowExtension != null && developmentBuild == true && useIl2cpp == true ? buildWindowExtension.ShouldDrawForceOptimizeScriptsCheckbox() : false;
1055-
1056-
if (shouldDrawForceOptimizeScriptsCheckbox)
1057-
EditorUserBuildSettings.forceOptimizeScriptCompilation = EditorGUILayout.Toggle(styles.forceOptimizeScriptCompilation, EditorUserBuildSettings.forceOptimizeScriptCompilation);
1058-
10591045
if (shouldDrawExplicitNullChecksToggle)
10601046
{
10611047
// Force 'ExplicitNullChecks' to true if it's a development build.

0 commit comments

Comments
 (0)