Skip to content

Commit bec1fad

Browse files
author
Unity Technologies
committed
Unity 2019.1.0a12 C# reference source code
1 parent 7a37dcd commit bec1fad

File tree

188 files changed

+4222
-7944
lines changed

Some content is hidden

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

188 files changed

+4222
-7944
lines changed

Editor/Mono/2D/SpriteEditorModule/SpriteFrameModule/SpriteFrameModuleBaseView.cs

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -68,21 +68,21 @@ protected static Styles styles
6868
private GizmoMode m_GizmoMode;
6969

7070
private VisualElement m_NameElement;
71-
private PropertyControl<string> m_NameField;
71+
private TextField m_NameField;
7272
private VisualElement m_PositionElement;
73-
private PropertyControl<long> m_PositionFieldX;
74-
private PropertyControl<long> m_PositionFieldY;
75-
private PropertyControl<long> m_PositionFieldW;
76-
private PropertyControl<long> m_PositionFieldH;
77-
private PropertyControl<long> m_BorderFieldL;
78-
private PropertyControl<long> m_BorderFieldT;
79-
private PropertyControl<long> m_BorderFieldR;
80-
private PropertyControl<long> m_BorderFieldB;
73+
private IntegerField m_PositionFieldX;
74+
private IntegerField m_PositionFieldY;
75+
private IntegerField m_PositionFieldW;
76+
private IntegerField m_PositionFieldH;
77+
private IntegerField m_BorderFieldL;
78+
private IntegerField m_BorderFieldT;
79+
private IntegerField m_BorderFieldR;
80+
private IntegerField m_BorderFieldB;
8181
private EnumField m_PivotField;
8282
private EnumField m_PivotUnitModeField;
8383
private VisualElement m_CustomPivotElement;
84-
private PropertyControl<double> m_CustomPivotFieldX;
85-
private PropertyControl<double> m_CustomPivotFieldY;
84+
private FloatField m_CustomPivotFieldX;
85+
private FloatField m_CustomPivotFieldY;
8686
private VisualElement m_SelectedFrameInspector;
8787

8888
private bool ShouldShowRectScaling()
@@ -110,10 +110,10 @@ private void RemoveMainUI(VisualElement mainView)
110110

111111
private void UpdatePositionField(Rect rect)
112112
{
113-
m_PositionFieldX.SetValueWithoutNotify((long)selectedSpriteRect.x);
114-
m_PositionFieldY.SetValueWithoutNotify((long)selectedSpriteRect.y);
115-
m_PositionFieldW.SetValueWithoutNotify((long)selectedSpriteRect.width);
116-
m_PositionFieldH.SetValueWithoutNotify((long)selectedSpriteRect.height);
113+
m_PositionFieldX.SetValueWithoutNotify((int)selectedSpriteRect.x);
114+
m_PositionFieldY.SetValueWithoutNotify((int)selectedSpriteRect.y);
115+
m_PositionFieldW.SetValueWithoutNotify((int)selectedSpriteRect.width);
116+
m_PositionFieldH.SetValueWithoutNotify((int)selectedSpriteRect.height);
117117
}
118118

119119
private void AddMainUI(VisualElement mainView)
@@ -122,7 +122,7 @@ private void AddMainUI(VisualElement mainView)
122122
m_SelectedFrameInspector = visualTree.CloneTree().Q("spriteFrameModuleInspector");
123123

124124
m_NameElement = m_SelectedFrameInspector.Q("name");
125-
m_NameField = m_SelectedFrameInspector.Q<PropertyControl<string>>("spriteName");
125+
m_NameField = m_SelectedFrameInspector.Q<TextField>("spriteName");
126126
m_NameField.RegisterValueChangedCallback((evt) =>
127127
{
128128
if (hasSelected)
@@ -141,7 +141,7 @@ private void AddMainUI(VisualElement mainView)
141141

142142

143143
m_PositionElement = m_SelectedFrameInspector.Q("position");
144-
m_PositionFieldX = m_PositionElement.Q<PropertyControl<long>>("positionX");
144+
m_PositionFieldX = m_PositionElement.Q<IntegerField>("positionX");
145145
m_PositionFieldX.RegisterValueChangedCallback((evt) =>
146146
{
147147
if (hasSelected)
@@ -153,7 +153,7 @@ private void AddMainUI(VisualElement mainView)
153153
}
154154
});
155155

156-
m_PositionFieldY = m_PositionElement.Q<PropertyControl<long>>("positionY");
156+
m_PositionFieldY = m_PositionElement.Q<IntegerField>("positionY");
157157
m_PositionFieldY.RegisterValueChangedCallback((evt) =>
158158
{
159159
if (hasSelected)
@@ -165,7 +165,7 @@ private void AddMainUI(VisualElement mainView)
165165
}
166166
});
167167

168-
m_PositionFieldW = m_PositionElement.Q<PropertyControl<long>>("positionW");
168+
m_PositionFieldW = m_PositionElement.Q<IntegerField>("positionW");
169169
m_PositionFieldW.RegisterValueChangedCallback((evt) =>
170170
{
171171
if (hasSelected)
@@ -177,7 +177,7 @@ private void AddMainUI(VisualElement mainView)
177177
}
178178
});
179179

180-
m_PositionFieldH = m_PositionElement.Q<PropertyControl<long>>("positionH");
180+
m_PositionFieldH = m_PositionElement.Q<IntegerField>("positionH");
181181
m_PositionFieldH.RegisterValueChangedCallback((evt) =>
182182
{
183183
if (hasSelected)
@@ -190,57 +190,58 @@ private void AddMainUI(VisualElement mainView)
190190
});
191191

192192
var borderElement = m_SelectedFrameInspector.Q("border");
193-
m_BorderFieldL = borderElement.Q<PropertyControl<long>>("borderL");
193+
m_BorderFieldL = borderElement.Q<IntegerField>("borderL");
194194
m_BorderFieldL.RegisterValueChangedCallback((evt) =>
195195
{
196196
if (hasSelected)
197197
{
198198
var border = selectedSpriteBorder;
199199
border.x = evt.newValue;
200200
selectedSpriteBorder = border;
201-
m_BorderFieldL.SetValueWithoutNotify((long)selectedSpriteBorder.x);
201+
m_BorderFieldL.SetValueWithoutNotify((int)selectedSpriteBorder.x);
202202
}
203203
});
204204

205-
m_BorderFieldT = borderElement.Q<PropertyControl<long>>("borderT");
205+
m_BorderFieldT = borderElement.Q<IntegerField>("borderT");
206206
m_BorderFieldT.RegisterValueChangedCallback((evt) =>
207207
{
208208
if (hasSelected)
209209
{
210210
var border = selectedSpriteBorder;
211211
border.w = evt.newValue;
212212
selectedSpriteBorder = border;
213-
m_BorderFieldT.SetValueWithoutNotify((long)selectedSpriteBorder.w);
213+
m_BorderFieldT.SetValueWithoutNotify((int)selectedSpriteBorder.w);
214214
evt.StopPropagation();
215215
}
216216
});
217217

218-
m_BorderFieldR = borderElement.Q<PropertyControl<long>>("borderR");
218+
m_BorderFieldR = borderElement.Q<IntegerField>("borderR");
219219
m_BorderFieldR.RegisterValueChangedCallback((evt) =>
220220
{
221221
if (hasSelected)
222222
{
223223
var border = selectedSpriteBorder;
224224
border.z = evt.newValue;
225225
selectedSpriteBorder = border;
226-
m_BorderFieldR.SetValueWithoutNotify((long)selectedSpriteBorder.z);
226+
m_BorderFieldR.SetValueWithoutNotify((int)selectedSpriteBorder.z);
227227
}
228228
});
229229

230-
m_BorderFieldB = borderElement.Q<PropertyControl<long>>("borderB");
230+
m_BorderFieldB = borderElement.Q<IntegerField>("borderB");
231231
m_BorderFieldB.RegisterValueChangedCallback((evt) =>
232232
{
233233
if (hasSelected)
234234
{
235235
var border = selectedSpriteBorder;
236236
border.y = evt.newValue;
237237
selectedSpriteBorder = border;
238-
m_BorderFieldB.SetValueWithoutNotify((long)selectedSpriteBorder.y);
238+
m_BorderFieldB.SetValueWithoutNotify((int)selectedSpriteBorder.y);
239239
}
240240
});
241241

242242
m_PivotField = m_SelectedFrameInspector.Q<EnumField>("pivotField");
243243
m_PivotField.Init(SpriteAlignment.Center);
244+
m_PivotField.label = L10n.Tr("Pivot");
244245
m_PivotField.RegisterValueChangedCallback((evt) =>
245246
{
246247
if (hasSelected)
@@ -257,6 +258,7 @@ private void AddMainUI(VisualElement mainView)
257258

258259
m_PivotUnitModeField = m_SelectedFrameInspector.Q<EnumField>("pivotUnitModeField");
259260
m_PivotUnitModeField.Init(PivotUnitMode.Normalized);
261+
m_PivotUnitModeField.label = L10n.Tr("Pivot Unit Mode");
260262
m_PivotUnitModeField.RegisterValueChangedCallback((evt) =>
261263
{
262264
if (hasSelected)
@@ -271,7 +273,7 @@ private void AddMainUI(VisualElement mainView)
271273

272274

273275
m_CustomPivotElement = m_SelectedFrameInspector.Q("customPivot");
274-
m_CustomPivotFieldX = m_CustomPivotElement.Q<PropertyControl<double>>("customPivotX");
276+
m_CustomPivotFieldX = m_CustomPivotElement.Q<FloatField>("customPivotX");
275277
m_CustomPivotFieldX.RegisterValueChangedCallback((evt) =>
276278
{
277279
if (hasSelected)
@@ -287,7 +289,7 @@ private void AddMainUI(VisualElement mainView)
287289
}
288290
});
289291

290-
m_CustomPivotFieldY = m_CustomPivotElement.Q<PropertyControl<double>>("customPivotY");
292+
m_CustomPivotFieldY = m_CustomPivotElement.Q<FloatField>("customPivotY");
291293
m_CustomPivotFieldY.RegisterValueChangedCallback((evt) =>
292294
{
293295
if (hasSelected)

Editor/Mono/2D/SpriteEditorModule/SpriteFrameModule/SpritePolygonModeModuleView.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,15 @@ private void DrawGizmos()
8888

8989
private void ViewUpdateSideCountField()
9090
{
91-
var sidesField = m_PolygonShapeView.Q<PropertyControl<long>>("labelIntegerField");
91+
var sidesField = m_PolygonShapeView.Q<IntegerField>("labelIntegerField");
9292
sidesField.value = polygonSides;
9393
}
9494

9595
private void SetupPolygonChangeShapeWindowElements(VisualElement moduleView)
9696
{
97-
var sidesField = moduleView.Q<PropertyControl<long>>("labelIntegerField");
97+
var sidesField = moduleView.Q<IntegerField>("labelIntegerField");
9898
sidesField.SetValueWithoutNotify(polygonSides);
99-
sidesField.RegisterValueChangedCallback((evt) =>
99+
sidesField.RegisterCallback<ChangeEvent<int>>((evt) =>
100100
{
101101
polygonSides = (int)evt.newValue;
102102
ShowHideWarningMessage();

Editor/Mono/Annotation/SceneViewCameraWindow.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ public static void Init()
3333
GUIContent[] m_CameraSpeedMinMax;
3434
GUIContent m_FieldOfView;
3535
GUIContent m_DynamicClip;
36+
GUIContent m_OcclusionCulling;
3637

37-
const int k_FieldCount = 9;
38+
const int k_FieldCount = 10;
3839
const int k_WindowWidth = 300;
3940
const int k_WindowHeight = ((int)EditorGUI.kSingleLineHeight) * k_FieldCount + kFrameWidth * 2;
4041
const int kFrameWidth = 10;
@@ -60,8 +61,8 @@ public SceneViewCameraWindow(SceneView sceneView)
6061
EditorGUIUtility.TrTextContent("Max", "The maximum speed of the camera in the Scene view. Valid values are between [0.02, 99].")
6162
};
6263
m_FieldOfView = EditorGUIUtility.TrTextContent("Field of View", "The height of the Camera's view angle. Measured in degrees vertically, or along the local Y axis.");
63-
m_DynamicClip = EditorGUIUtility.TrTextContent("Dynamic Clipping",
64-
"Check this to enable camera's near and far clipping planes to be calculated relative to the viewport size of the Scene.");
64+
m_DynamicClip = EditorGUIUtility.TrTextContent("Dynamic Clipping", "Check this to enable camera's near and far clipping planes to be calculated relative to the viewport size of the Scene.");
65+
m_OcclusionCulling = EditorGUIUtility.TrTextContent("Occlusion Culling", "Check this to enable occlusion culling in the Scene view. Occlusion culling disables rendering of objects when they\'re not currently seen by the Camera because they\'re hidden (occluded) by other objects.");
6566
}
6667

6768
public override void OnGUI(Rect rect)
@@ -97,7 +98,7 @@ private void Draw(Rect rect)
9798

9899
EditorGUIUtility.labelWidth = k_PrefixLabelWidth;
99100

100-
GUILayout.Label("Camera", EditorStyles.boldLabel);
101+
GUILayout.Label(EditorGUIUtility.TrTextContent("Scene Camera"), EditorStyles.boldLabel);
101102

102103
// fov isn't applicable in orthographic mode, and orthographic size is controlled by the user zoom
103104
using (new EditorGUI.DisabledScope(m_SceneView.orthographic))
@@ -118,11 +119,12 @@ private void Draw(Rect rect)
118119
settings.farClip = settings.nearClip + k_NearClipMin;
119120
}
120121

122+
settings.occlusionCulling = EditorGUILayout.Toggle(m_OcclusionCulling, settings.occlusionCulling);
121123

122124
if (EditorGUI.EndChangeCheck())
123125
m_SceneView.Repaint();
124126

125-
GUILayout.Label("Navigation", EditorStyles.boldLabel);
127+
GUILayout.Label(EditorGUIUtility.TrTextContent("Navigation"), EditorStyles.boldLabel);
126128

127129
settings.speed = EditorGUILayout.Slider(m_CameraSpeedSliderContent, settings.speed, settings.speedMin, settings.speedMax);
128130

@@ -171,7 +173,7 @@ internal static void ClipPlanesField(GUIContent label, ref float near, ref float
171173
void ShowContextMenu()
172174
{
173175
var menu = new GenericMenu();
174-
menu.AddItem(GUIContent.Temp("Reset"), false, Reset);
176+
menu.AddItem(EditorGUIUtility.TrTextContent("Reset"), false, Reset);
175177
menu.ShowAsContext();
176178
}
177179

Editor/Mono/Annotation/SceneViewSettingsProvider.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ class Styles
1313
{
1414
static bool s_Initialized;
1515

16-
public static GUIContent cameraMovementEasingEnabled = new GUIContent("Camera Easing", "Check this to enable camera movement easing. This makes the Camera ease in when it starts moving, and ease out when it stops.");
17-
public static GUIContent cameraMovementEasingDuration = new GUIContent("Duration", "How long it takes for the Camera speed to accelerate to full speed. Measured in seconds.");
16+
public static GUIContent cameraMovementEasingEnabled = EditorGUIUtility.TrTextContent("Camera Easing", "Check this to enable camera movement easing. This makes the Camera ease in when it starts moving, and ease out when it stops.");
17+
public static GUIContent cameraMovementEasingDuration = EditorGUIUtility.TrTextContent("Duration", "How long it takes for the Camera speed to accelerate to full speed. Measured in seconds.");
1818

1919
public static GUIStyle settings;
2020

@@ -53,7 +53,7 @@ public override void OnGUI(string searchContext)
5353
GUILayout.BeginVertical(Styles.settings, GUILayout.MaxWidth(SettingsWindow.s_DefaultLayoutMaxWidth));
5454

5555
if (!searching)
56-
GUILayout.Label("Navigation", EditorStyles.boldLabel);
56+
GUILayout.Label(EditorGUIUtility.TrTextContent("Navigation"), EditorStyles.boldLabel);
5757

5858
if (!searching || SearchUtils.MatchSearch(searchContext, Styles.cameraMovementEasingEnabled.text))
5959
SceneViewMotion.movementEasingEnabled = EditorGUILayout.Toggle(
@@ -64,7 +64,7 @@ public override void OnGUI(string searchContext)
6464
{
6565
EditorGUI.indentLevel += 1;
6666
if (!searching || SearchUtils.MatchSearch(searchContext, Styles.cameraMovementEasingDuration.text))
67-
SceneViewMotion.movementEasingDuration = EditorGUILayout.Slider(Styles.cameraMovementEasingDuration, SceneViewMotion.movementEasingDuration, 0.001f, 3f);
67+
SceneViewMotion.movementEasingDuration = EditorGUILayout.Slider(Styles.cameraMovementEasingDuration, SceneViewMotion.movementEasingDuration, .1f, 3f);
6868
EditorGUI.indentLevel -= 1;
6969
}
7070

Editor/Mono/AssetDatabase/AssetDatabase.bindings.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public enum ForceReserializeAssetsOptions
1919
ReserializeAssetsAndMetadata = ReserializeAssets | ReserializeMetadata
2020
}
2121

22+
[NativeHeader("Modules/AssetDatabase/Editor/Public/AssetDatabase.h")]
2223
[NativeHeader("Modules/AssetDatabase/Editor/Public/AssetDatabaseUtility.h")]
2324
public partial class AssetDatabase
2425
{
@@ -106,5 +107,8 @@ public static void ForceReserializeAssets()
106107

107108
[FreeFunction("AssetDatabase::RemoveObjectFromAsset")]
108109
extern public static void RemoveObjectFromAsset([NotNull] UnityEngine.Object objectToRemove);
110+
111+
[FreeFunction("AssetDatabase::GUIDFromExistingAssetPath")]
112+
extern internal static GUID GUIDFromExistingAssetPath(string path);
109113
}
110114
}

0 commit comments

Comments
 (0)