Skip to content

Commit eb33413

Browse files
author
Unity Technologies
committed
Unity 2019.1.0a13 C# reference source code
1 parent bec1fad commit eb33413

364 files changed

Lines changed: 4555 additions & 1713 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/Animation/AnimationMode.bindings.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ public class AnimationMode
3737
static private bool s_InAnimationPlaybackMode = false;
3838
static private bool s_InAnimationRecordMode = false;
3939

40+
static internal event Action onAnimationRecordingStart;
41+
static internal event Action onAnimationRecordingStop;
42+
4043
static private PrefColor s_AnimatedPropertyColor = new PrefColor("Animation/Property Animated", 0.82f, 0.97f, 1.00f, 1.00f, 0.54f, 0.85f, 1.00f, 1.00f);
4144
static private PrefColor s_RecordedPropertyColor = new PrefColor("Animation/Property Recorded", 1.00f, 0.60f, 0.60f, 1.00f, 1.00f, 0.50f, 0.50f, 1.00f);
4245
static private PrefColor s_CandidatePropertyColor = new PrefColor("Animation/Property Candidate", 1.00f, 0.70f, 0.60f, 1.00f, 1.00f, 0.67f, 0.43f, 1.00f);
@@ -110,6 +113,8 @@ internal static void StartAnimationPlaybackMode()
110113
internal static void StopAnimationRecording()
111114
{
112115
s_InAnimationRecordMode = false;
116+
117+
onAnimationRecordingStop?.Invoke();
113118
}
114119

115120
internal static bool InAnimationRecording()
@@ -120,6 +125,8 @@ internal static bool InAnimationRecording()
120125
internal static void StartAnimationRecording()
121126
{
122127
s_InAnimationRecordMode = true;
128+
129+
onAnimationRecordingStart?.Invoke();
123130
}
124131

125132
[NativeThrows]

Editor/Mono/Animation/AnimationWindow/AnimationWindowControl.cs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ private static bool HasFlag(ResampleFlags flags, ResampleFlags flag)
128128
private IAnimationWindowPostProcess[] m_PostProcessComponents;
129129
private PlayableGraph m_Graph;
130130
private Playable m_GraphRoot;
131+
private AnimationClipPlayable m_ClipPlayable;
132+
private AnimationClipPlayable m_CandidateClipPlayable;
131133

132134
private static ProfilerMarker s_ResampleAnimationMarker = new ProfilerMarker("AnimationWindowControl.ResampleAnimation");
133135

@@ -506,7 +508,7 @@ private void DestroyGraph()
506508
return;
507509

508510
m_Graph.Destroy();
509-
m_GraphRoot.Destroy();
511+
m_GraphRoot = Playable.Null;
510512
}
511513

512514
private void RebuildGraph(Animator animator)
@@ -516,21 +518,21 @@ private void RebuildGraph(Animator animator)
516518
m_Graph = PlayableGraph.Create("PreviewGraph");
517519
m_Graph.SetTimeUpdateMode(DirectorUpdateMode.Manual);
518520

519-
var clipPlayable = AnimationClipPlayable.Create(m_Graph, state.activeAnimationClip);
520-
clipPlayable.SetOverrideLoopTime(true);
521-
clipPlayable.SetLoopTime(false);
522-
clipPlayable.SetApplyFootIK(false);
521+
m_ClipPlayable = AnimationClipPlayable.Create(m_Graph, state.activeAnimationClip);
522+
m_ClipPlayable.SetOverrideLoopTime(true);
523+
m_ClipPlayable.SetLoopTime(false);
524+
m_ClipPlayable.SetApplyFootIK(false);
523525

524-
m_GraphRoot = (Playable)clipPlayable;
526+
m_GraphRoot = (Playable)m_ClipPlayable;
525527

526528
if (m_CandidateClip != null)
527529
{
528530
var mixer = AnimationLayerMixerPlayable.Create(m_Graph, 2);
529531

530-
var candidateClipPlayable = AnimationClipPlayable.Create(m_Graph, m_CandidateClip);
532+
m_CandidateClipPlayable = AnimationClipPlayable.Create(m_Graph, m_CandidateClip);
531533

532534
m_Graph.Connect(m_GraphRoot, 0, mixer, 0);
533-
m_Graph.Connect(candidateClipPlayable, 0, mixer, 1);
535+
m_Graph.Connect(m_CandidateClipPlayable, 0, mixer, 1);
534536

535537
mixer.SetInputWeight(0, 1.0f);
536538
mixer.SetInputWeight(1, 1.0f);
@@ -605,6 +607,8 @@ private void ResampleAnimation(ResampleFlags flags)
605607
if (m_CandidateClip != null)
606608
AnimationMode.AddCandidates(state.activeRootGameObject, m_CandidateClip);
607609

610+
m_ClipPlayable.SetSampleRate(playing ? -1 : state.activeAnimationClip.frameRate);
611+
608612
AnimationMode.SamplePlayableGraph(state.activeRootGameObject, m_Graph, 0, time.time);
609613

610614
// This will cover euler/quaternion matching in basic playable graphs only (animation clip + candidate clip).

Editor/Mono/AssetStore/AssetStoreWindow.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,19 @@ public void Refresh()
193193
webView.Show();
194194
}
195195

196+
public void OnAddedAsTab()
197+
{
198+
// Make sure the parent window is set correctly for CEF if this instance is being moved from a different DockArea.
199+
SetFocus(true);
200+
}
201+
202+
public void OnBeforeRemovedAsTab()
203+
{
204+
// Set the CEF parent window as if the tab were becoming invisible prior to tab removal. This will keep CEF from cleaning up the AssetStoreWindow browser
205+
// window if the AssetStoreWindow is being dragged to a new DockArea and was the last tab in it's old DockArea.
206+
OnBecameInvisible();
207+
}
208+
196209
protected virtual void OnGotFocus()
197210
{
198211
m_GotFocus = true;

Editor/Mono/Audio/Mixer/AudioMixerDescription.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ public static void Refresh()
6161
ClearDefinitions();
6262

6363
RegisterAudioMixerEffect("Attenuation", new MixerParameterDefinition[0]);
64+
6465
RegisterAudioMixerEffect("Send", new MixerParameterDefinition[0]);
66+
6567
RegisterAudioMixerEffect("Receive", new MixerParameterDefinition[0]);
6668

6769
var duckVolDef = new MixerParameterDefinition[7];

Editor/Mono/Audio/Mixer/Bindings/AudioMixerController.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ public override string ResolveStringPath(bool getOnlyBasePath)
4545
{
4646
return "Pitch" + GetBasePath(group.GetDisplayString(), null);
4747
}
48+
else if (group.GetGUIDForSend() == parameter)
49+
{
50+
return "Send" + GetBasePath(group.GetDisplayString(), null);
51+
}
4852
else
4953
{
5054
return "Error finding Parameter path.";
@@ -218,7 +222,8 @@ public string ResolveExposedParameterPath(GUID parameter, bool getOnlyBasePath)
218222
foreach (AudioMixerGroupController group in groups)
219223
{
220224
if (group.GetGUIDForVolume() == parameter ||
221-
group.GetGUIDForPitch() == parameter)
225+
group.GetGUIDForPitch() == parameter ||
226+
group.GetGUIDForSend() == parameter)
222227
{
223228
AudioGroupParameterPath newPath = new AudioGroupParameterPath(group, parameter);
224229
exposedParamCache[parameter] = newPath;
@@ -362,7 +367,7 @@ private void DestroyExposedParametersContainedInGroup(AudioMixerGroupController
362367
var exposedParams = exposedParameters;
363368
foreach (var param in exposedParams)
364369
{
365-
if (group.GetGUIDForVolume() == param.guid || group.GetGUIDForPitch() == param.guid)
370+
if (group.GetGUIDForVolume() == param.guid || group.GetGUIDForPitch() == param.guid || group.GetGUIDForSend() == param.guid)
366371
RemoveExposedParameter(param.guid);
367372
}
368373
}
@@ -595,6 +600,8 @@ private AudioMixerGroupController DuplicateGroupRecurse(AudioMixerGroupControlle
595600
s.SetValue(targetGroup.GetGUIDForVolume(), value);
596601
if (s.GetValue(sourceGroup.GetGUIDForPitch(), out value))
597602
s.SetValue(targetGroup.GetGUIDForPitch(), value);
603+
if (s.GetValue(sourceGroup.GetGUIDForSend(), out value))
604+
s.SetValue(targetGroup.GetGUIDForSend(), value);
598605
}
599606

600607
AssetDatabase.AddObjectToAsset(targetGroup, this);

Editor/Mono/Audio/Mixer/GUI/AudioMixerEffectView.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,11 +283,11 @@ public void DoEffectGUI(int effectIndex, AudioMixerGroupController group, List<A
283283

284284
if (effect.sendTarget != null)
285285
{
286-
float wetLevel = effect.GetValueForMixLevel(controller, controller.TargetSnapshot);
287-
if (AudioMixerEffectGUI.Slider(Texts.sendLevel, ref wetLevel, 1.0f, 1.0f, Texts.dB, AudioMixerController.kMinVolume, AudioMixerController.kMaxEffect, controller, new AudioEffectParameterPath(group, effect, effect.GetGUIDForMixLevel())))
286+
float wetLevel = group.GetValueForSend(controller, controller.TargetSnapshot);
287+
if (AudioMixerEffectGUI.Slider(Texts.sendLevel, ref wetLevel, 1.0f, 1.0f, Texts.dB, AudioMixerController.kMinVolume, AudioMixerController.kMaxEffect, controller, new AudioGroupParameterPath(group, group.GetGUIDForSend())))
288288
{
289289
Undo.RecordObject(controller.TargetSnapshot, "Change Send Level");
290-
effect.SetValueForMixLevel(controller, controller.TargetSnapshot, wetLevel);
290+
group.SetValueForSend(controller, controller.TargetSnapshot, wetLevel);
291291
AudioMixerUtility.RepaintAudioMixerAndInspectors();
292292
}
293293
}

Editor/Mono/BuildPlayerWindow.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,12 @@ static bool IsColorSpaceValid(BuildPlatform platform)
409409
{
410410
hasMinGraphicsAPI = !apis.Contains(GraphicsDeviceType.OpenGLES3) && !apis.Contains(GraphicsDeviceType.OpenGLES2);
411411
}
412+
else if (platform.targetGroup == BuildTargetGroup.WebGL)
413+
{
414+
// must have OpenGLES3-only
415+
hasMinGraphicsAPI = apis.Contains(GraphicsDeviceType.OpenGLES3) && !apis.Contains(GraphicsDeviceType.OpenGLES2);
416+
}
417+
412418
return hasMinGraphicsAPI && hasMinOSVersion;
413419
}
414420
else
@@ -459,7 +465,7 @@ static bool IsLightmapEncodingValid(BuildPlatform platform)
459465
{ "WindowsStandalone", "Windows" },
460466
{ "LinuxStandalone", "Linux" },
461467
{ "Facebook", "Facebook-Games"},
462-
{ "Metro", "Universal-Windows-Platform"}
468+
{ "UWP", "Universal-Windows-Platform"}
463469
};
464470
static public string GetPlaybackEngineDownloadURL(string moduleName)
465471
{

Editor/Mono/Camera/BuiltinBakedReflectionSystem.bindings.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using UnityEngine.Assertions;
99
using UnityEngine.Bindings;
1010
using UnityEngine.Scripting;
11+
using System.Collections.Generic;
1112

1213
namespace UnityEditor.Experimental.Rendering
1314
{
@@ -21,9 +22,12 @@ class BuiltinBakedReflectionSystem : IScriptableBakedReflectionSystem
2122
IScriptableBakedReflectionSystemStageNotifier m_Handle;
2223

2324
public int stageCount { get { return 3; } }
24-
[NativeProperty("StateHash")]
25-
extern Hash128 _stateHash { get; }
26-
public Hash128 stateHash { get { return _stateHash; } }
25+
26+
[NativeName("StateHashes")]
27+
extern public Hash128[] stateHashes
28+
{
29+
get;
30+
}
2731

2832
bool disposed { get { return m_Ptr == IntPtr.Zero; } }
2933

Editor/Mono/Camera/IScriptableBakedReflectionSystem.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace UnityEditor.Experimental.Rendering
1010
public interface IScriptableBakedReflectionSystem : IDisposable
1111
{
1212
int stageCount { get; }
13-
Hash128 stateHash { get; }
13+
Hash128[] stateHashes { get; }
1414

1515
void Tick(SceneStateHash sceneStateHash, IScriptableBakedReflectionSystemStageNotifier handle);
1616
void SynchronizeReflectionProbes();

Editor/Mono/Camera/ScriptableBakedReflectionSystem.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ namespace UnityEditor.Experimental.Rendering
1010
public abstract class ScriptableBakedReflectionSystem : IScriptableBakedReflectionSystem
1111
{
1212
public int stageCount { get; }
13-
public Hash128 stateHash { get; protected set; }
13+
14+
public Hash128[] stateHashes { get; protected set; }
1415

1516
protected ScriptableBakedReflectionSystem(int stageCount)
1617
{

0 commit comments

Comments
 (0)