Cleanup 5
This commit is contained in:
@@ -26,8 +26,7 @@ namespace FlaxEditor.Content
|
||||
{
|
||||
if (reader.TokenType == JsonToken.String)
|
||||
{
|
||||
Guid id;
|
||||
FlaxEngine.Json.JsonSerializer.ParseID((string)reader.Value, out id);
|
||||
FlaxEngine.Json.JsonSerializer.ParseID((string)reader.Value, out Guid id);
|
||||
return Editor.Instance.ContentDatabase.Find(id);
|
||||
}
|
||||
|
||||
|
||||
@@ -113,8 +113,7 @@ namespace FlaxEditor.Content.Import
|
||||
extension = extension.ToLower();
|
||||
|
||||
// Check if use overriden type
|
||||
ImportFileEntryHandler createDelegate;
|
||||
if (FileTypes.TryGetValue(extension, out createDelegate))
|
||||
if (FileTypes.TryGetValue(extension, out ImportFileEntryHandler createDelegate))
|
||||
return createDelegate(ref request);
|
||||
|
||||
// Use default type
|
||||
|
||||
@@ -26,8 +26,7 @@ namespace FlaxEditor.CustomEditors.Editors
|
||||
|
||||
private void OnEditEnd()
|
||||
{
|
||||
Guid value;
|
||||
if (Guid.TryParse(_element.Text, out value))
|
||||
if (Guid.TryParse(_element.Text, out Guid value))
|
||||
{
|
||||
SetValue(value);
|
||||
}
|
||||
|
||||
@@ -63,8 +63,7 @@ namespace FlaxEditor.CustomEditors.Editors
|
||||
float z = ZElement.FloatValue.Value;
|
||||
var isSliding = XElement.IsSliding || YElement.IsSliding || ZElement.IsSliding;
|
||||
var token = isSliding ? this : null;
|
||||
Quaternion value;
|
||||
Quaternion.Euler(x, y, z, out value);
|
||||
Quaternion.Euler(x, y, z, out Quaternion value);
|
||||
SetValue(value, token);
|
||||
}
|
||||
|
||||
|
||||
@@ -251,8 +251,7 @@ namespace FlaxEditor.GUI.Dialogs
|
||||
if (_disableEvents)
|
||||
return;
|
||||
|
||||
Color color;
|
||||
if (Color.TryParseHex(_cHex.Text, out color))
|
||||
if (Color.TryParseHex(_cHex.Text, out Color color))
|
||||
SelectedColor = color;
|
||||
}
|
||||
|
||||
|
||||
@@ -402,8 +402,7 @@ namespace FlaxEditor.GUI.Docking
|
||||
else if (MouseDownWindow != null && _panel.TabsCount > 1)
|
||||
{
|
||||
// Check if mouse left current tab rect
|
||||
Rectangle currWinRect;
|
||||
GetTabRect(MouseDownWindow, out currWinRect);
|
||||
GetTabRect(MouseDownWindow, out Rectangle currWinRect);
|
||||
if (!currWinRect.Contains(location))
|
||||
{
|
||||
int index = _panel.GetTabIndex(MouseDownWindow);
|
||||
|
||||
@@ -112,8 +112,7 @@ namespace FlaxEditor.GUI.Drag
|
||||
for (int i = 0; i < ids.Length; i++)
|
||||
{
|
||||
// Find element
|
||||
Guid id;
|
||||
if (Guid.TryParse(ids[i], out id))
|
||||
if (Guid.TryParse(ids[i], out Guid id))
|
||||
{
|
||||
var obj = Editor.Instance.Scene.GetActorNode(id);
|
||||
|
||||
|
||||
@@ -98,8 +98,7 @@ namespace FlaxEditor.GUI.Drag
|
||||
for (int i = 0; i < ids.Length; i++)
|
||||
{
|
||||
// Find element
|
||||
Guid id;
|
||||
if (Guid.TryParse(ids[i], out id))
|
||||
if (Guid.TryParse(ids[i], out Guid id))
|
||||
{
|
||||
var obj = FlaxEngine.Object.Find<Script>(ref id);
|
||||
|
||||
@@ -129,8 +128,7 @@ namespace FlaxEditor.GUI.Drag
|
||||
for (int i = 0; i < ids.Length; i++)
|
||||
{
|
||||
// Find element
|
||||
Guid id;
|
||||
if (Guid.TryParse(ids[i], out id))
|
||||
if (Guid.TryParse(ids[i], out Guid id))
|
||||
{
|
||||
var obj = FlaxEngine.Object.Find<Script>(ref id);
|
||||
|
||||
|
||||
@@ -117,8 +117,7 @@ namespace FlaxEditor.GUI.Input
|
||||
protected override void TryGetValue()
|
||||
{
|
||||
// Try to parse long
|
||||
long value;
|
||||
if (long.TryParse(Text, out value))
|
||||
if (long.TryParse(Text, out long value))
|
||||
{
|
||||
// Set value
|
||||
Value = value;
|
||||
|
||||
@@ -46,8 +46,7 @@ namespace FlaxEditor.Gizmo
|
||||
|
||||
// Transform ray into local space of the gizmo
|
||||
Ray localRay;
|
||||
Matrix invGizmoWorld;
|
||||
Matrix.Invert(ref _gizmoWorld, out invGizmoWorld);
|
||||
Matrix.Invert(ref _gizmoWorld, out Matrix invGizmoWorld);
|
||||
Vector3.TransformNormal(ref ray.Direction, ref invGizmoWorld, out localRay.Direction);
|
||||
Vector3.Transform(ref ray.Position, ref invGizmoWorld, out localRay.Position);
|
||||
|
||||
|
||||
@@ -157,9 +157,8 @@ namespace FlaxEditor.Gizmo
|
||||
_screenScale = vLength.Length / GizmoScaleFactor * gizmoSize;
|
||||
Matrix.Scaling(_screenScale, out _screenScaleMatrix);
|
||||
|
||||
Matrix rotation;
|
||||
Quaternion orientation = GetSelectedObject(0).Orientation;
|
||||
Matrix.RotationQuaternion(ref orientation, out rotation);
|
||||
Matrix.RotationQuaternion(ref orientation, out Matrix rotation);
|
||||
_localForward = rotation.Forward;
|
||||
_localUp = rotation.Up;
|
||||
|
||||
|
||||
@@ -124,8 +124,7 @@ namespace FlaxEditor.Modules
|
||||
/// <param name="skipSettingsDialog">True if skip any popup dialogs showing for import options adjusting. Can be used when importing files from code.</param>
|
||||
public void Reimport(BinaryAssetItem item, object settings = null, bool skipSettingsDialog = false)
|
||||
{
|
||||
string importPath;
|
||||
if (item != null && !item.GetImportPath(out importPath))
|
||||
if (item != null && !item.GetImportPath(out string importPath))
|
||||
{
|
||||
// Check if input file is missing
|
||||
if (!System.IO.File.Exists(importPath))
|
||||
|
||||
@@ -415,8 +415,7 @@ namespace FlaxEditor.Modules
|
||||
|
||||
writer.WriteStartElement("Panel");
|
||||
|
||||
float splitterValue;
|
||||
DockState state = p.TryGetDockState(out splitterValue);
|
||||
DockState state = p.TryGetDockState(out float splitterValue);
|
||||
|
||||
writer.WriteAttributeString("DockState", ((int)state).ToString());
|
||||
writer.WriteAttributeString("SplitterValue", splitterValue.ToString(CultureInfo.InvariantCulture));
|
||||
@@ -684,8 +683,7 @@ namespace FlaxEditor.Modules
|
||||
}
|
||||
|
||||
// Check if it's an asset ID
|
||||
Guid id;
|
||||
if (Guid.TryParse(typename, out id))
|
||||
if (Guid.TryParse(typename, out Guid id))
|
||||
{
|
||||
var el = Editor.ContentDatabase.Find(id);
|
||||
if (el != null)
|
||||
|
||||
@@ -125,9 +125,8 @@ namespace FlaxEditor.SceneGraph.GUI
|
||||
}
|
||||
else
|
||||
{
|
||||
QueryFilterHelper.Range[] ranges;
|
||||
var text = Text;
|
||||
if (QueryFilterHelper.Match(filterText, text, out ranges))
|
||||
if (QueryFilterHelper.Match(filterText, text, out QueryFilterHelper.Range[] ranges))
|
||||
{
|
||||
// Update highlights
|
||||
if (_highlights == null)
|
||||
|
||||
@@ -76,8 +76,7 @@ namespace FlaxEditor.SceneGraph
|
||||
if (id == Guid.Empty)
|
||||
return null;
|
||||
|
||||
SceneGraphNode result;
|
||||
Nodes.TryGetValue(id, out result);
|
||||
Nodes.TryGetValue(id, out SceneGraphNode result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -88,8 +87,7 @@ namespace FlaxEditor.SceneGraph
|
||||
/// <returns>The result node.</returns>
|
||||
public static SceneGraphNode GetNode(Guid id)
|
||||
{
|
||||
SceneGraphNode result;
|
||||
Nodes.TryGetValue(id, out result);
|
||||
Nodes.TryGetValue(id, out SceneGraphNode result);
|
||||
if (result == null)
|
||||
{
|
||||
var actor = Object.TryFind<Actor>(ref id);
|
||||
|
||||
@@ -37,8 +37,7 @@ namespace FlaxEditor.Surface
|
||||
// Push clipping mask
|
||||
if (ClipChildren)
|
||||
{
|
||||
Rectangle clientArea;
|
||||
GetDesireClientArea(out clientArea);
|
||||
GetDesireClientArea(out Rectangle clientArea);
|
||||
Render2D.PushClip(ref clientArea);
|
||||
}
|
||||
|
||||
|
||||
@@ -54,8 +54,7 @@ namespace FlaxEditor.Surface
|
||||
return;
|
||||
|
||||
// Get or create context
|
||||
VisjectSurfaceContext surfaceContext;
|
||||
if (!_contextCache.TryGetValue(context, out surfaceContext))
|
||||
if (!_contextCache.TryGetValue(context, out VisjectSurfaceContext surfaceContext))
|
||||
{
|
||||
surfaceContext = CreateContext(_context, context);
|
||||
_context?.Children.Add(surfaceContext);
|
||||
@@ -119,8 +118,7 @@ namespace FlaxEditor.Surface
|
||||
}
|
||||
|
||||
// Check if has context in cache
|
||||
VisjectSurfaceContext surfaceContext;
|
||||
if (_contextCache.TryGetValue(context, out surfaceContext))
|
||||
if (_contextCache.TryGetValue(context, out VisjectSurfaceContext surfaceContext))
|
||||
{
|
||||
// Remove from navigation path
|
||||
while (ContextStack.Contains(surfaceContext))
|
||||
@@ -149,8 +147,7 @@ namespace FlaxEditor.Surface
|
||||
return;
|
||||
|
||||
// Check if already in a path
|
||||
VisjectSurfaceContext surfaceContext;
|
||||
if (_contextCache.TryGetValue(context, out surfaceContext) && ContextStack.Contains(surfaceContext))
|
||||
if (_contextCache.TryGetValue(context, out VisjectSurfaceContext surfaceContext) && ContextStack.Contains(surfaceContext))
|
||||
{
|
||||
// Change stack
|
||||
do
|
||||
|
||||
@@ -980,10 +980,10 @@ namespace FlaxEditor.Surface
|
||||
/// <inheritdoc />
|
||||
public override void OnLayoutDeserialize(XmlElement node)
|
||||
{
|
||||
float value1;
|
||||
|
||||
if (float.TryParse(node.GetAttribute("Split1"), out value1))
|
||||
if (float.TryParse(node.GetAttribute("Split1"), out float value1))
|
||||
_split1.SplitterValue = value1;
|
||||
|
||||
if (float.TryParse(node.GetAttribute("Split2"), out value1))
|
||||
_split2.SplitterValue = value1;
|
||||
}
|
||||
|
||||
@@ -282,8 +282,7 @@ namespace FlaxEditor.Tools.Foliage
|
||||
};
|
||||
|
||||
// Try restore painting with the given model ID
|
||||
bool itemChecked;
|
||||
if (!Tab.FoliageTypeModelIdsToPaint.TryGetValue(model.ID, out itemChecked))
|
||||
if (!Tab.FoliageTypeModelIdsToPaint.TryGetValue(model.ID, out bool itemChecked))
|
||||
{
|
||||
// Enable by default
|
||||
itemChecked = true;
|
||||
|
||||
@@ -310,10 +310,9 @@ namespace FlaxEditor.Tools.Terrain
|
||||
throw new InvalidOperationException("Cannot set cursor then no terrain is selected.");
|
||||
var brushBounds = CursorBrushBounds;
|
||||
var patchesCount = terrain.PatchesCount;
|
||||
BoundingBox tmp;
|
||||
for (int patchIndex = 0; patchIndex < patchesCount; patchIndex++)
|
||||
{
|
||||
terrain.GetPatchBounds(patchIndex, out tmp);
|
||||
terrain.GetPatchBounds(patchIndex, out BoundingBox tmp);
|
||||
if (!tmp.Intersects(ref brushBounds))
|
||||
continue;
|
||||
|
||||
|
||||
@@ -329,10 +329,9 @@ namespace FlaxEditor.Tools.Terrain
|
||||
throw new InvalidOperationException("Cannot set cursor then no terrain is selected.");
|
||||
var brushBounds = CursorBrushBounds;
|
||||
var patchesCount = terrain.PatchesCount;
|
||||
BoundingBox tmp;
|
||||
for (int patchIndex = 0; patchIndex < patchesCount; patchIndex++)
|
||||
{
|
||||
terrain.GetPatchBounds(patchIndex, out tmp);
|
||||
terrain.GetPatchBounds(patchIndex, out BoundingBox tmp);
|
||||
if (!tmp.Intersects(ref brushBounds))
|
||||
continue;
|
||||
|
||||
|
||||
@@ -1691,8 +1691,7 @@ namespace FlaxEditor.Utilities
|
||||
orientation = Quaternion.LookRotation(dir, Vector3.Cross(Vector3.Cross(dir, Vector3.Up), dir));
|
||||
Vector3 up = Vector3.Up * orientation;
|
||||
box.Transformation = Matrix.CreateWorld(min + vec * 0.5f, dir, up);
|
||||
Matrix inv;
|
||||
Matrix.Invert(ref box.Transformation, out inv);
|
||||
Matrix.Invert(ref box.Transformation, out Matrix inv);
|
||||
Vector3 vecLocal = Vector3.TransformNormal(vec * 0.5f, inv);
|
||||
box.Extents.X = margin;
|
||||
box.Extents.Y = margin;
|
||||
|
||||
@@ -99,8 +99,7 @@ namespace FlaxEditor.Viewport.Cameras
|
||||
{
|
||||
centerMouse = true;
|
||||
|
||||
EditorViewport.Input input;
|
||||
Viewport.GetInput(out input);
|
||||
Viewport.GetInput(out EditorViewport.Input input);
|
||||
|
||||
// Rotate
|
||||
Viewport.YawPitch += mouseDelta;
|
||||
|
||||
@@ -85,8 +85,7 @@ namespace FlaxEditor.Viewport.Cameras
|
||||
/// <param name="actor">The actor to preview.</param>
|
||||
public void ShowActor(Actor actor)
|
||||
{
|
||||
BoundingSphere sphere;
|
||||
Editor.GetActorEditorSphere(actor, out sphere);
|
||||
Editor.GetActorEditorSphere(actor, out BoundingSphere sphere);
|
||||
ShowSphere(ref sphere);
|
||||
}
|
||||
|
||||
@@ -104,8 +103,7 @@ namespace FlaxEditor.Viewport.Cameras
|
||||
{
|
||||
if (actors[i] is ActorNode actor)
|
||||
{
|
||||
BoundingSphere sphere;
|
||||
Editor.GetActorEditorSphere(actor.Actor, out sphere);
|
||||
Editor.GetActorEditorSphere(actor.Actor, out BoundingSphere sphere);
|
||||
BoundingSphere.Merge(ref mergesSphere, ref sphere, out mergesSphere);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user