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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,8 +52,10 @@ namespace FlaxEngine
|
||||
/// <returns>The float value</returns>
|
||||
public static float Unpack(ushort h)
|
||||
{
|
||||
var conv = new FloatToUint();
|
||||
conv.uintValue = HalfToFloatMantissaTable[HalfToFloatOffsetTable[h >> 10] + (((uint)h) & 0x3ff)] + HalfToFloatExponentTable[h >> 10];
|
||||
var conv = new FloatToUint
|
||||
{
|
||||
uintValue = HalfToFloatMantissaTable[HalfToFloatOffsetTable[h >> 10] + (((uint)h) & 0x3ff)] + HalfToFloatExponentTable[h >> 10]
|
||||
};
|
||||
return conv.floatValue;
|
||||
}
|
||||
|
||||
@@ -64,8 +66,10 @@ namespace FlaxEngine
|
||||
/// <returns>The half value</returns>
|
||||
public static ushort Pack(float f)
|
||||
{
|
||||
FloatToUint conv = new FloatToUint();
|
||||
conv.floatValue = f;
|
||||
FloatToUint conv = new FloatToUint
|
||||
{
|
||||
floatValue = f
|
||||
};
|
||||
return (ushort)(FloatToHalfBaseTable[(conv.uintValue >> 23) & 0x1ff] + ((conv.uintValue & 0x007fffff) >> FloatToHalfShiftTable[(conv.uintValue >> 23) & 0x1ff]));
|
||||
}
|
||||
|
||||
|
||||
@@ -695,20 +695,22 @@ namespace FlaxEngine
|
||||
Orthonormalize(ref temp, out Q);
|
||||
Q.Transpose();
|
||||
|
||||
R = new Matrix();
|
||||
R.M11 = Vector4.Dot(Q.Column1, Column1);
|
||||
R.M12 = Vector4.Dot(Q.Column1, Column2);
|
||||
R.M13 = Vector4.Dot(Q.Column1, Column3);
|
||||
R.M14 = Vector4.Dot(Q.Column1, Column4);
|
||||
R = new Matrix
|
||||
{
|
||||
M11 = Vector4.Dot(Q.Column1, Column1),
|
||||
M12 = Vector4.Dot(Q.Column1, Column2),
|
||||
M13 = Vector4.Dot(Q.Column1, Column3),
|
||||
M14 = Vector4.Dot(Q.Column1, Column4),
|
||||
|
||||
R.M22 = Vector4.Dot(Q.Column2, Column2);
|
||||
R.M23 = Vector4.Dot(Q.Column2, Column3);
|
||||
R.M24 = Vector4.Dot(Q.Column2, Column4);
|
||||
M22 = Vector4.Dot(Q.Column2, Column2),
|
||||
M23 = Vector4.Dot(Q.Column2, Column3),
|
||||
M24 = Vector4.Dot(Q.Column2, Column4),
|
||||
|
||||
R.M33 = Vector4.Dot(Q.Column3, Column3);
|
||||
R.M34 = Vector4.Dot(Q.Column3, Column4);
|
||||
M33 = Vector4.Dot(Q.Column3, Column3),
|
||||
M34 = Vector4.Dot(Q.Column3, Column4),
|
||||
|
||||
R.M44 = Vector4.Dot(Q.Column4, Column4);
|
||||
M44 = Vector4.Dot(Q.Column4, Column4)
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -720,20 +722,22 @@ namespace FlaxEngine
|
||||
{
|
||||
Orthonormalize(ref this, out Q);
|
||||
|
||||
L = new Matrix();
|
||||
L.M11 = Vector4.Dot(Q.Row1, Row1);
|
||||
L = new Matrix
|
||||
{
|
||||
M11 = Vector4.Dot(Q.Row1, Row1),
|
||||
|
||||
L.M21 = Vector4.Dot(Q.Row1, Row2);
|
||||
L.M22 = Vector4.Dot(Q.Row2, Row2);
|
||||
M21 = Vector4.Dot(Q.Row1, Row2),
|
||||
M22 = Vector4.Dot(Q.Row2, Row2),
|
||||
|
||||
L.M31 = Vector4.Dot(Q.Row1, Row3);
|
||||
L.M32 = Vector4.Dot(Q.Row2, Row3);
|
||||
L.M33 = Vector4.Dot(Q.Row3, Row3);
|
||||
M31 = Vector4.Dot(Q.Row1, Row3),
|
||||
M32 = Vector4.Dot(Q.Row2, Row3),
|
||||
M33 = Vector4.Dot(Q.Row3, Row3),
|
||||
|
||||
L.M41 = Vector4.Dot(Q.Row1, Row4);
|
||||
L.M42 = Vector4.Dot(Q.Row2, Row4);
|
||||
L.M43 = Vector4.Dot(Q.Row3, Row4);
|
||||
L.M44 = Vector4.Dot(Q.Row4, Row4);
|
||||
M41 = Vector4.Dot(Q.Row1, Row4),
|
||||
M42 = Vector4.Dot(Q.Row2, Row4),
|
||||
M43 = Vector4.Dot(Q.Row3, Row4),
|
||||
M44 = Vector4.Dot(Q.Row4, Row4)
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -32,8 +32,11 @@ namespace FlaxEngine.GUI
|
||||
private bool IntersectsChildContent(CanvasRootControl child, ref Ray ray, out Vector2 childSpaceLocation)
|
||||
{
|
||||
// Inline bounds calculations (it will reuse world matrix)
|
||||
OrientedBoundingBox bounds = new OrientedBoundingBox();
|
||||
bounds.Extents = new Vector3(child.Size * 0.5f, Mathf.Epsilon);
|
||||
OrientedBoundingBox bounds = new OrientedBoundingBox
|
||||
{
|
||||
Extents = new Vector3(child.Size * 0.5f, Mathf.Epsilon)
|
||||
};
|
||||
|
||||
child.Canvas.GetWorldMatrix(out var world);
|
||||
Matrix.Translation(bounds.Extents.X, bounds.Extents.Y, 0, out var offset);
|
||||
Matrix.Multiply(ref offset, ref world, out bounds.Transformation);
|
||||
|
||||
@@ -64,8 +64,10 @@ namespace FlaxEngine.GUI
|
||||
VScrollBar = GetChild<VScrollBar>();
|
||||
if (VScrollBar == null)
|
||||
{
|
||||
VScrollBar = new VScrollBar(this, Width - ScrollBar.DefaultSize, Height);
|
||||
VScrollBar.AnchorPreset = AnchorPresets.TopLeft;
|
||||
VScrollBar = new VScrollBar(this, Width - ScrollBar.DefaultSize, Height)
|
||||
{
|
||||
AnchorPreset = AnchorPresets.TopLeft
|
||||
};
|
||||
//VScrollBar.X += VScrollBar.Width;
|
||||
VScrollBar.ValueChanged += () => SetViewOffset(Orientation.Vertical, VScrollBar.Value);
|
||||
}
|
||||
@@ -82,8 +84,10 @@ namespace FlaxEngine.GUI
|
||||
HScrollBar = GetChild<HScrollBar>();
|
||||
if (HScrollBar == null)
|
||||
{
|
||||
HScrollBar = new HScrollBar(this, Height - ScrollBar.DefaultSize, Width);
|
||||
HScrollBar.AnchorPreset = AnchorPresets.TopLeft;
|
||||
HScrollBar = new HScrollBar(this, Height - ScrollBar.DefaultSize, Width)
|
||||
{
|
||||
AnchorPreset = AnchorPresets.TopLeft
|
||||
};
|
||||
//HScrollBar.Y += HScrollBar.Height;
|
||||
//HScrollBar.Offsets += new Margin(0, 0, HScrollBar.Height * 0.5f, 0);
|
||||
HScrollBar.ValueChanged += () => SetViewOffset(Orientation.Horizontal, HScrollBar.Value);
|
||||
|
||||
@@ -234,8 +234,10 @@ namespace FlaxEngine
|
||||
/// </summary>
|
||||
public UICanvas()
|
||||
{
|
||||
_guiRoot = new CanvasRootControl(this);
|
||||
_guiRoot.IsLayoutLocked = false;
|
||||
_guiRoot = new CanvasRootControl(this)
|
||||
{
|
||||
IsLayoutLocked = false
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -245,12 +247,12 @@ namespace FlaxEngine
|
||||
{
|
||||
get
|
||||
{
|
||||
OrientedBoundingBox bounds = new OrientedBoundingBox();
|
||||
bounds.Extents = new Vector3(_guiRoot.Size * 0.5f, Mathf.Epsilon);
|
||||
Matrix world;
|
||||
GetWorldMatrix(out world);
|
||||
Matrix offset;
|
||||
Matrix.Translation(bounds.Extents.X, bounds.Extents.Y, 0, out offset);
|
||||
OrientedBoundingBox bounds = new OrientedBoundingBox
|
||||
{
|
||||
Extents = new Vector3(_guiRoot.Size * 0.5f, Mathf.Epsilon)
|
||||
};
|
||||
GetWorldMatrix(out Matrix world);
|
||||
Matrix.Translation(bounds.Extents.X, bounds.Extents.Y, 0, out Matrix offset);
|
||||
Matrix.Multiply(ref offset, ref world, out bounds.Transformation);
|
||||
return bounds;
|
||||
}
|
||||
|
||||
@@ -161,9 +161,11 @@ namespace FlaxEngine
|
||||
if (!(_control is ContainerControl))
|
||||
throw new InvalidOperationException("To add child to the control it has to be ContainerControl.");
|
||||
|
||||
var child = new UIControl();
|
||||
child.Parent = this;
|
||||
child.Control = (Control)Activator.CreateInstance(typeof(T));
|
||||
var child = new UIControl
|
||||
{
|
||||
Parent = this,
|
||||
Control = (Control)Activator.CreateInstance(typeof(T))
|
||||
};
|
||||
return child;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user