Cleanup 5
This commit is contained in:
@@ -26,8 +26,7 @@ namespace FlaxEditor.Content
|
|||||||
{
|
{
|
||||||
if (reader.TokenType == JsonToken.String)
|
if (reader.TokenType == JsonToken.String)
|
||||||
{
|
{
|
||||||
Guid id;
|
FlaxEngine.Json.JsonSerializer.ParseID((string)reader.Value, out Guid id);
|
||||||
FlaxEngine.Json.JsonSerializer.ParseID((string)reader.Value, out id);
|
|
||||||
return Editor.Instance.ContentDatabase.Find(id);
|
return Editor.Instance.ContentDatabase.Find(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -113,8 +113,7 @@ namespace FlaxEditor.Content.Import
|
|||||||
extension = extension.ToLower();
|
extension = extension.ToLower();
|
||||||
|
|
||||||
// Check if use overriden type
|
// Check if use overriden type
|
||||||
ImportFileEntryHandler createDelegate;
|
if (FileTypes.TryGetValue(extension, out ImportFileEntryHandler createDelegate))
|
||||||
if (FileTypes.TryGetValue(extension, out createDelegate))
|
|
||||||
return createDelegate(ref request);
|
return createDelegate(ref request);
|
||||||
|
|
||||||
// Use default type
|
// Use default type
|
||||||
|
|||||||
@@ -26,8 +26,7 @@ namespace FlaxEditor.CustomEditors.Editors
|
|||||||
|
|
||||||
private void OnEditEnd()
|
private void OnEditEnd()
|
||||||
{
|
{
|
||||||
Guid value;
|
if (Guid.TryParse(_element.Text, out Guid value))
|
||||||
if (Guid.TryParse(_element.Text, out value))
|
|
||||||
{
|
{
|
||||||
SetValue(value);
|
SetValue(value);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,8 +63,7 @@ namespace FlaxEditor.CustomEditors.Editors
|
|||||||
float z = ZElement.FloatValue.Value;
|
float z = ZElement.FloatValue.Value;
|
||||||
var isSliding = XElement.IsSliding || YElement.IsSliding || ZElement.IsSliding;
|
var isSliding = XElement.IsSliding || YElement.IsSliding || ZElement.IsSliding;
|
||||||
var token = isSliding ? this : null;
|
var token = isSliding ? this : null;
|
||||||
Quaternion value;
|
Quaternion.Euler(x, y, z, out Quaternion value);
|
||||||
Quaternion.Euler(x, y, z, out value);
|
|
||||||
SetValue(value, token);
|
SetValue(value, token);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -251,8 +251,7 @@ namespace FlaxEditor.GUI.Dialogs
|
|||||||
if (_disableEvents)
|
if (_disableEvents)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Color color;
|
if (Color.TryParseHex(_cHex.Text, out Color color))
|
||||||
if (Color.TryParseHex(_cHex.Text, out color))
|
|
||||||
SelectedColor = color;
|
SelectedColor = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -402,8 +402,7 @@ namespace FlaxEditor.GUI.Docking
|
|||||||
else if (MouseDownWindow != null && _panel.TabsCount > 1)
|
else if (MouseDownWindow != null && _panel.TabsCount > 1)
|
||||||
{
|
{
|
||||||
// Check if mouse left current tab rect
|
// Check if mouse left current tab rect
|
||||||
Rectangle currWinRect;
|
GetTabRect(MouseDownWindow, out Rectangle currWinRect);
|
||||||
GetTabRect(MouseDownWindow, out currWinRect);
|
|
||||||
if (!currWinRect.Contains(location))
|
if (!currWinRect.Contains(location))
|
||||||
{
|
{
|
||||||
int index = _panel.GetTabIndex(MouseDownWindow);
|
int index = _panel.GetTabIndex(MouseDownWindow);
|
||||||
|
|||||||
@@ -112,8 +112,7 @@ namespace FlaxEditor.GUI.Drag
|
|||||||
for (int i = 0; i < ids.Length; i++)
|
for (int i = 0; i < ids.Length; i++)
|
||||||
{
|
{
|
||||||
// Find element
|
// Find element
|
||||||
Guid id;
|
if (Guid.TryParse(ids[i], out Guid id))
|
||||||
if (Guid.TryParse(ids[i], out id))
|
|
||||||
{
|
{
|
||||||
var obj = Editor.Instance.Scene.GetActorNode(id);
|
var obj = Editor.Instance.Scene.GetActorNode(id);
|
||||||
|
|
||||||
|
|||||||
@@ -98,8 +98,7 @@ namespace FlaxEditor.GUI.Drag
|
|||||||
for (int i = 0; i < ids.Length; i++)
|
for (int i = 0; i < ids.Length; i++)
|
||||||
{
|
{
|
||||||
// Find element
|
// Find element
|
||||||
Guid id;
|
if (Guid.TryParse(ids[i], out Guid id))
|
||||||
if (Guid.TryParse(ids[i], out id))
|
|
||||||
{
|
{
|
||||||
var obj = FlaxEngine.Object.Find<Script>(ref 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++)
|
for (int i = 0; i < ids.Length; i++)
|
||||||
{
|
{
|
||||||
// Find element
|
// Find element
|
||||||
Guid id;
|
if (Guid.TryParse(ids[i], out Guid id))
|
||||||
if (Guid.TryParse(ids[i], out id))
|
|
||||||
{
|
{
|
||||||
var obj = FlaxEngine.Object.Find<Script>(ref id);
|
var obj = FlaxEngine.Object.Find<Script>(ref id);
|
||||||
|
|
||||||
|
|||||||
@@ -117,8 +117,7 @@ namespace FlaxEditor.GUI.Input
|
|||||||
protected override void TryGetValue()
|
protected override void TryGetValue()
|
||||||
{
|
{
|
||||||
// Try to parse long
|
// Try to parse long
|
||||||
long value;
|
if (long.TryParse(Text, out long value))
|
||||||
if (long.TryParse(Text, out value))
|
|
||||||
{
|
{
|
||||||
// Set value
|
// Set value
|
||||||
Value = value;
|
Value = value;
|
||||||
|
|||||||
@@ -46,8 +46,7 @@ namespace FlaxEditor.Gizmo
|
|||||||
|
|
||||||
// Transform ray into local space of the gizmo
|
// Transform ray into local space of the gizmo
|
||||||
Ray localRay;
|
Ray localRay;
|
||||||
Matrix invGizmoWorld;
|
Matrix.Invert(ref _gizmoWorld, out Matrix invGizmoWorld);
|
||||||
Matrix.Invert(ref _gizmoWorld, out invGizmoWorld);
|
|
||||||
Vector3.TransformNormal(ref ray.Direction, ref invGizmoWorld, out localRay.Direction);
|
Vector3.TransformNormal(ref ray.Direction, ref invGizmoWorld, out localRay.Direction);
|
||||||
Vector3.Transform(ref ray.Position, ref invGizmoWorld, out localRay.Position);
|
Vector3.Transform(ref ray.Position, ref invGizmoWorld, out localRay.Position);
|
||||||
|
|
||||||
|
|||||||
@@ -157,9 +157,8 @@ namespace FlaxEditor.Gizmo
|
|||||||
_screenScale = vLength.Length / GizmoScaleFactor * gizmoSize;
|
_screenScale = vLength.Length / GizmoScaleFactor * gizmoSize;
|
||||||
Matrix.Scaling(_screenScale, out _screenScaleMatrix);
|
Matrix.Scaling(_screenScale, out _screenScaleMatrix);
|
||||||
|
|
||||||
Matrix rotation;
|
|
||||||
Quaternion orientation = GetSelectedObject(0).Orientation;
|
Quaternion orientation = GetSelectedObject(0).Orientation;
|
||||||
Matrix.RotationQuaternion(ref orientation, out rotation);
|
Matrix.RotationQuaternion(ref orientation, out Matrix rotation);
|
||||||
_localForward = rotation.Forward;
|
_localForward = rotation.Forward;
|
||||||
_localUp = rotation.Up;
|
_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>
|
/// <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)
|
public void Reimport(BinaryAssetItem item, object settings = null, bool skipSettingsDialog = false)
|
||||||
{
|
{
|
||||||
string importPath;
|
if (item != null && !item.GetImportPath(out string importPath))
|
||||||
if (item != null && !item.GetImportPath(out importPath))
|
|
||||||
{
|
{
|
||||||
// Check if input file is missing
|
// Check if input file is missing
|
||||||
if (!System.IO.File.Exists(importPath))
|
if (!System.IO.File.Exists(importPath))
|
||||||
|
|||||||
@@ -415,8 +415,7 @@ namespace FlaxEditor.Modules
|
|||||||
|
|
||||||
writer.WriteStartElement("Panel");
|
writer.WriteStartElement("Panel");
|
||||||
|
|
||||||
float splitterValue;
|
DockState state = p.TryGetDockState(out float splitterValue);
|
||||||
DockState state = p.TryGetDockState(out splitterValue);
|
|
||||||
|
|
||||||
writer.WriteAttributeString("DockState", ((int)state).ToString());
|
writer.WriteAttributeString("DockState", ((int)state).ToString());
|
||||||
writer.WriteAttributeString("SplitterValue", splitterValue.ToString(CultureInfo.InvariantCulture));
|
writer.WriteAttributeString("SplitterValue", splitterValue.ToString(CultureInfo.InvariantCulture));
|
||||||
@@ -684,8 +683,7 @@ namespace FlaxEditor.Modules
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if it's an asset ID
|
// Check if it's an asset ID
|
||||||
Guid id;
|
if (Guid.TryParse(typename, out Guid id))
|
||||||
if (Guid.TryParse(typename, out id))
|
|
||||||
{
|
{
|
||||||
var el = Editor.ContentDatabase.Find(id);
|
var el = Editor.ContentDatabase.Find(id);
|
||||||
if (el != null)
|
if (el != null)
|
||||||
|
|||||||
@@ -125,9 +125,8 @@ namespace FlaxEditor.SceneGraph.GUI
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QueryFilterHelper.Range[] ranges;
|
|
||||||
var text = Text;
|
var text = Text;
|
||||||
if (QueryFilterHelper.Match(filterText, text, out ranges))
|
if (QueryFilterHelper.Match(filterText, text, out QueryFilterHelper.Range[] ranges))
|
||||||
{
|
{
|
||||||
// Update highlights
|
// Update highlights
|
||||||
if (_highlights == null)
|
if (_highlights == null)
|
||||||
|
|||||||
@@ -76,8 +76,7 @@ namespace FlaxEditor.SceneGraph
|
|||||||
if (id == Guid.Empty)
|
if (id == Guid.Empty)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
SceneGraphNode result;
|
Nodes.TryGetValue(id, out SceneGraphNode result);
|
||||||
Nodes.TryGetValue(id, out result);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,8 +87,7 @@ namespace FlaxEditor.SceneGraph
|
|||||||
/// <returns>The result node.</returns>
|
/// <returns>The result node.</returns>
|
||||||
public static SceneGraphNode GetNode(Guid id)
|
public static SceneGraphNode GetNode(Guid id)
|
||||||
{
|
{
|
||||||
SceneGraphNode result;
|
Nodes.TryGetValue(id, out SceneGraphNode result);
|
||||||
Nodes.TryGetValue(id, out result);
|
|
||||||
if (result == null)
|
if (result == null)
|
||||||
{
|
{
|
||||||
var actor = Object.TryFind<Actor>(ref id);
|
var actor = Object.TryFind<Actor>(ref id);
|
||||||
|
|||||||
@@ -37,8 +37,7 @@ namespace FlaxEditor.Surface
|
|||||||
// Push clipping mask
|
// Push clipping mask
|
||||||
if (ClipChildren)
|
if (ClipChildren)
|
||||||
{
|
{
|
||||||
Rectangle clientArea;
|
GetDesireClientArea(out Rectangle clientArea);
|
||||||
GetDesireClientArea(out clientArea);
|
|
||||||
Render2D.PushClip(ref clientArea);
|
Render2D.PushClip(ref clientArea);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,8 +54,7 @@ namespace FlaxEditor.Surface
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Get or create context
|
// Get or create context
|
||||||
VisjectSurfaceContext surfaceContext;
|
if (!_contextCache.TryGetValue(context, out VisjectSurfaceContext surfaceContext))
|
||||||
if (!_contextCache.TryGetValue(context, out surfaceContext))
|
|
||||||
{
|
{
|
||||||
surfaceContext = CreateContext(_context, context);
|
surfaceContext = CreateContext(_context, context);
|
||||||
_context?.Children.Add(surfaceContext);
|
_context?.Children.Add(surfaceContext);
|
||||||
@@ -119,8 +118,7 @@ namespace FlaxEditor.Surface
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if has context in cache
|
// Check if has context in cache
|
||||||
VisjectSurfaceContext surfaceContext;
|
if (_contextCache.TryGetValue(context, out VisjectSurfaceContext surfaceContext))
|
||||||
if (_contextCache.TryGetValue(context, out surfaceContext))
|
|
||||||
{
|
{
|
||||||
// Remove from navigation path
|
// Remove from navigation path
|
||||||
while (ContextStack.Contains(surfaceContext))
|
while (ContextStack.Contains(surfaceContext))
|
||||||
@@ -149,8 +147,7 @@ namespace FlaxEditor.Surface
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Check if already in a path
|
// Check if already in a path
|
||||||
VisjectSurfaceContext surfaceContext;
|
if (_contextCache.TryGetValue(context, out VisjectSurfaceContext surfaceContext) && ContextStack.Contains(surfaceContext))
|
||||||
if (_contextCache.TryGetValue(context, out surfaceContext) && ContextStack.Contains(surfaceContext))
|
|
||||||
{
|
{
|
||||||
// Change stack
|
// Change stack
|
||||||
do
|
do
|
||||||
|
|||||||
@@ -980,10 +980,10 @@ namespace FlaxEditor.Surface
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnLayoutDeserialize(XmlElement node)
|
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;
|
_split1.SplitterValue = value1;
|
||||||
|
|
||||||
if (float.TryParse(node.GetAttribute("Split2"), out value1))
|
if (float.TryParse(node.GetAttribute("Split2"), out value1))
|
||||||
_split2.SplitterValue = value1;
|
_split2.SplitterValue = value1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -282,8 +282,7 @@ namespace FlaxEditor.Tools.Foliage
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Try restore painting with the given model ID
|
// Try restore painting with the given model ID
|
||||||
bool itemChecked;
|
if (!Tab.FoliageTypeModelIdsToPaint.TryGetValue(model.ID, out bool itemChecked))
|
||||||
if (!Tab.FoliageTypeModelIdsToPaint.TryGetValue(model.ID, out itemChecked))
|
|
||||||
{
|
{
|
||||||
// Enable by default
|
// Enable by default
|
||||||
itemChecked = true;
|
itemChecked = true;
|
||||||
|
|||||||
@@ -310,10 +310,9 @@ namespace FlaxEditor.Tools.Terrain
|
|||||||
throw new InvalidOperationException("Cannot set cursor then no terrain is selected.");
|
throw new InvalidOperationException("Cannot set cursor then no terrain is selected.");
|
||||||
var brushBounds = CursorBrushBounds;
|
var brushBounds = CursorBrushBounds;
|
||||||
var patchesCount = terrain.PatchesCount;
|
var patchesCount = terrain.PatchesCount;
|
||||||
BoundingBox tmp;
|
|
||||||
for (int patchIndex = 0; patchIndex < patchesCount; patchIndex++)
|
for (int patchIndex = 0; patchIndex < patchesCount; patchIndex++)
|
||||||
{
|
{
|
||||||
terrain.GetPatchBounds(patchIndex, out tmp);
|
terrain.GetPatchBounds(patchIndex, out BoundingBox tmp);
|
||||||
if (!tmp.Intersects(ref brushBounds))
|
if (!tmp.Intersects(ref brushBounds))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|||||||
@@ -329,10 +329,9 @@ namespace FlaxEditor.Tools.Terrain
|
|||||||
throw new InvalidOperationException("Cannot set cursor then no terrain is selected.");
|
throw new InvalidOperationException("Cannot set cursor then no terrain is selected.");
|
||||||
var brushBounds = CursorBrushBounds;
|
var brushBounds = CursorBrushBounds;
|
||||||
var patchesCount = terrain.PatchesCount;
|
var patchesCount = terrain.PatchesCount;
|
||||||
BoundingBox tmp;
|
|
||||||
for (int patchIndex = 0; patchIndex < patchesCount; patchIndex++)
|
for (int patchIndex = 0; patchIndex < patchesCount; patchIndex++)
|
||||||
{
|
{
|
||||||
terrain.GetPatchBounds(patchIndex, out tmp);
|
terrain.GetPatchBounds(patchIndex, out BoundingBox tmp);
|
||||||
if (!tmp.Intersects(ref brushBounds))
|
if (!tmp.Intersects(ref brushBounds))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|||||||
@@ -1691,8 +1691,7 @@ namespace FlaxEditor.Utilities
|
|||||||
orientation = Quaternion.LookRotation(dir, Vector3.Cross(Vector3.Cross(dir, Vector3.Up), dir));
|
orientation = Quaternion.LookRotation(dir, Vector3.Cross(Vector3.Cross(dir, Vector3.Up), dir));
|
||||||
Vector3 up = Vector3.Up * orientation;
|
Vector3 up = Vector3.Up * orientation;
|
||||||
box.Transformation = Matrix.CreateWorld(min + vec * 0.5f, dir, up);
|
box.Transformation = Matrix.CreateWorld(min + vec * 0.5f, dir, up);
|
||||||
Matrix inv;
|
Matrix.Invert(ref box.Transformation, out Matrix inv);
|
||||||
Matrix.Invert(ref box.Transformation, out inv);
|
|
||||||
Vector3 vecLocal = Vector3.TransformNormal(vec * 0.5f, inv);
|
Vector3 vecLocal = Vector3.TransformNormal(vec * 0.5f, inv);
|
||||||
box.Extents.X = margin;
|
box.Extents.X = margin;
|
||||||
box.Extents.Y = margin;
|
box.Extents.Y = margin;
|
||||||
|
|||||||
@@ -99,8 +99,7 @@ namespace FlaxEditor.Viewport.Cameras
|
|||||||
{
|
{
|
||||||
centerMouse = true;
|
centerMouse = true;
|
||||||
|
|
||||||
EditorViewport.Input input;
|
Viewport.GetInput(out EditorViewport.Input input);
|
||||||
Viewport.GetInput(out input);
|
|
||||||
|
|
||||||
// Rotate
|
// Rotate
|
||||||
Viewport.YawPitch += mouseDelta;
|
Viewport.YawPitch += mouseDelta;
|
||||||
|
|||||||
@@ -85,8 +85,7 @@ namespace FlaxEditor.Viewport.Cameras
|
|||||||
/// <param name="actor">The actor to preview.</param>
|
/// <param name="actor">The actor to preview.</param>
|
||||||
public void ShowActor(Actor actor)
|
public void ShowActor(Actor actor)
|
||||||
{
|
{
|
||||||
BoundingSphere sphere;
|
Editor.GetActorEditorSphere(actor, out BoundingSphere sphere);
|
||||||
Editor.GetActorEditorSphere(actor, out sphere);
|
|
||||||
ShowSphere(ref sphere);
|
ShowSphere(ref sphere);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,8 +103,7 @@ namespace FlaxEditor.Viewport.Cameras
|
|||||||
{
|
{
|
||||||
if (actors[i] is ActorNode actor)
|
if (actors[i] is ActorNode actor)
|
||||||
{
|
{
|
||||||
BoundingSphere sphere;
|
Editor.GetActorEditorSphere(actor.Actor, out BoundingSphere sphere);
|
||||||
Editor.GetActorEditorSphere(actor.Actor, out sphere);
|
|
||||||
BoundingSphere.Merge(ref mergesSphere, ref sphere, out mergesSphere);
|
BoundingSphere.Merge(ref mergesSphere, ref sphere, out mergesSphere);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,8 +52,10 @@ namespace FlaxEngine
|
|||||||
/// <returns>The float value</returns>
|
/// <returns>The float value</returns>
|
||||||
public static float Unpack(ushort h)
|
public static float Unpack(ushort h)
|
||||||
{
|
{
|
||||||
var conv = new FloatToUint();
|
var conv = new FloatToUint
|
||||||
conv.uintValue = HalfToFloatMantissaTable[HalfToFloatOffsetTable[h >> 10] + (((uint)h) & 0x3ff)] + HalfToFloatExponentTable[h >> 10];
|
{
|
||||||
|
uintValue = HalfToFloatMantissaTable[HalfToFloatOffsetTable[h >> 10] + (((uint)h) & 0x3ff)] + HalfToFloatExponentTable[h >> 10]
|
||||||
|
};
|
||||||
return conv.floatValue;
|
return conv.floatValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,8 +66,10 @@ namespace FlaxEngine
|
|||||||
/// <returns>The half value</returns>
|
/// <returns>The half value</returns>
|
||||||
public static ushort Pack(float f)
|
public static ushort Pack(float f)
|
||||||
{
|
{
|
||||||
FloatToUint conv = new FloatToUint();
|
FloatToUint conv = new FloatToUint
|
||||||
conv.floatValue = f;
|
{
|
||||||
|
floatValue = f
|
||||||
|
};
|
||||||
return (ushort)(FloatToHalfBaseTable[(conv.uintValue >> 23) & 0x1ff] + ((conv.uintValue & 0x007fffff) >> FloatToHalfShiftTable[(conv.uintValue >> 23) & 0x1ff]));
|
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);
|
Orthonormalize(ref temp, out Q);
|
||||||
Q.Transpose();
|
Q.Transpose();
|
||||||
|
|
||||||
R = new Matrix();
|
R = new Matrix
|
||||||
R.M11 = Vector4.Dot(Q.Column1, Column1);
|
{
|
||||||
R.M12 = Vector4.Dot(Q.Column1, Column2);
|
M11 = Vector4.Dot(Q.Column1, Column1),
|
||||||
R.M13 = Vector4.Dot(Q.Column1, Column3);
|
M12 = Vector4.Dot(Q.Column1, Column2),
|
||||||
R.M14 = Vector4.Dot(Q.Column1, Column4);
|
M13 = Vector4.Dot(Q.Column1, Column3),
|
||||||
|
M14 = Vector4.Dot(Q.Column1, Column4),
|
||||||
|
|
||||||
R.M22 = Vector4.Dot(Q.Column2, Column2);
|
M22 = Vector4.Dot(Q.Column2, Column2),
|
||||||
R.M23 = Vector4.Dot(Q.Column2, Column3);
|
M23 = Vector4.Dot(Q.Column2, Column3),
|
||||||
R.M24 = Vector4.Dot(Q.Column2, Column4);
|
M24 = Vector4.Dot(Q.Column2, Column4),
|
||||||
|
|
||||||
R.M33 = Vector4.Dot(Q.Column3, Column3);
|
M33 = Vector4.Dot(Q.Column3, Column3),
|
||||||
R.M34 = Vector4.Dot(Q.Column3, Column4);
|
M34 = Vector4.Dot(Q.Column3, Column4),
|
||||||
|
|
||||||
R.M44 = Vector4.Dot(Q.Column4, Column4);
|
M44 = Vector4.Dot(Q.Column4, Column4)
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -720,20 +722,22 @@ namespace FlaxEngine
|
|||||||
{
|
{
|
||||||
Orthonormalize(ref this, out Q);
|
Orthonormalize(ref this, out Q);
|
||||||
|
|
||||||
L = new Matrix();
|
L = new Matrix
|
||||||
L.M11 = Vector4.Dot(Q.Row1, Row1);
|
{
|
||||||
|
M11 = Vector4.Dot(Q.Row1, Row1),
|
||||||
|
|
||||||
L.M21 = Vector4.Dot(Q.Row1, Row2);
|
M21 = Vector4.Dot(Q.Row1, Row2),
|
||||||
L.M22 = Vector4.Dot(Q.Row2, Row2);
|
M22 = Vector4.Dot(Q.Row2, Row2),
|
||||||
|
|
||||||
L.M31 = Vector4.Dot(Q.Row1, Row3);
|
M31 = Vector4.Dot(Q.Row1, Row3),
|
||||||
L.M32 = Vector4.Dot(Q.Row2, Row3);
|
M32 = Vector4.Dot(Q.Row2, Row3),
|
||||||
L.M33 = Vector4.Dot(Q.Row3, Row3);
|
M33 = Vector4.Dot(Q.Row3, Row3),
|
||||||
|
|
||||||
L.M41 = Vector4.Dot(Q.Row1, Row4);
|
M41 = Vector4.Dot(Q.Row1, Row4),
|
||||||
L.M42 = Vector4.Dot(Q.Row2, Row4);
|
M42 = Vector4.Dot(Q.Row2, Row4),
|
||||||
L.M43 = Vector4.Dot(Q.Row3, Row4);
|
M43 = Vector4.Dot(Q.Row3, Row4),
|
||||||
L.M44 = Vector4.Dot(Q.Row4, Row4);
|
M44 = Vector4.Dot(Q.Row4, Row4)
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -32,8 +32,11 @@ namespace FlaxEngine.GUI
|
|||||||
private bool IntersectsChildContent(CanvasRootControl child, ref Ray ray, out Vector2 childSpaceLocation)
|
private bool IntersectsChildContent(CanvasRootControl child, ref Ray ray, out Vector2 childSpaceLocation)
|
||||||
{
|
{
|
||||||
// Inline bounds calculations (it will reuse world matrix)
|
// Inline bounds calculations (it will reuse world matrix)
|
||||||
OrientedBoundingBox bounds = new OrientedBoundingBox();
|
OrientedBoundingBox bounds = new OrientedBoundingBox
|
||||||
bounds.Extents = new Vector3(child.Size * 0.5f, Mathf.Epsilon);
|
{
|
||||||
|
Extents = new Vector3(child.Size * 0.5f, Mathf.Epsilon)
|
||||||
|
};
|
||||||
|
|
||||||
child.Canvas.GetWorldMatrix(out var world);
|
child.Canvas.GetWorldMatrix(out var world);
|
||||||
Matrix.Translation(bounds.Extents.X, bounds.Extents.Y, 0, out var offset);
|
Matrix.Translation(bounds.Extents.X, bounds.Extents.Y, 0, out var offset);
|
||||||
Matrix.Multiply(ref offset, ref world, out bounds.Transformation);
|
Matrix.Multiply(ref offset, ref world, out bounds.Transformation);
|
||||||
|
|||||||
@@ -64,8 +64,10 @@ namespace FlaxEngine.GUI
|
|||||||
VScrollBar = GetChild<VScrollBar>();
|
VScrollBar = GetChild<VScrollBar>();
|
||||||
if (VScrollBar == null)
|
if (VScrollBar == null)
|
||||||
{
|
{
|
||||||
VScrollBar = new VScrollBar(this, Width - ScrollBar.DefaultSize, Height);
|
VScrollBar = new VScrollBar(this, Width - ScrollBar.DefaultSize, Height)
|
||||||
VScrollBar.AnchorPreset = AnchorPresets.TopLeft;
|
{
|
||||||
|
AnchorPreset = AnchorPresets.TopLeft
|
||||||
|
};
|
||||||
//VScrollBar.X += VScrollBar.Width;
|
//VScrollBar.X += VScrollBar.Width;
|
||||||
VScrollBar.ValueChanged += () => SetViewOffset(Orientation.Vertical, VScrollBar.Value);
|
VScrollBar.ValueChanged += () => SetViewOffset(Orientation.Vertical, VScrollBar.Value);
|
||||||
}
|
}
|
||||||
@@ -82,8 +84,10 @@ namespace FlaxEngine.GUI
|
|||||||
HScrollBar = GetChild<HScrollBar>();
|
HScrollBar = GetChild<HScrollBar>();
|
||||||
if (HScrollBar == null)
|
if (HScrollBar == null)
|
||||||
{
|
{
|
||||||
HScrollBar = new HScrollBar(this, Height - ScrollBar.DefaultSize, Width);
|
HScrollBar = new HScrollBar(this, Height - ScrollBar.DefaultSize, Width)
|
||||||
HScrollBar.AnchorPreset = AnchorPresets.TopLeft;
|
{
|
||||||
|
AnchorPreset = AnchorPresets.TopLeft
|
||||||
|
};
|
||||||
//HScrollBar.Y += HScrollBar.Height;
|
//HScrollBar.Y += HScrollBar.Height;
|
||||||
//HScrollBar.Offsets += new Margin(0, 0, HScrollBar.Height * 0.5f, 0);
|
//HScrollBar.Offsets += new Margin(0, 0, HScrollBar.Height * 0.5f, 0);
|
||||||
HScrollBar.ValueChanged += () => SetViewOffset(Orientation.Horizontal, HScrollBar.Value);
|
HScrollBar.ValueChanged += () => SetViewOffset(Orientation.Horizontal, HScrollBar.Value);
|
||||||
|
|||||||
@@ -234,8 +234,10 @@ namespace FlaxEngine
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public UICanvas()
|
public UICanvas()
|
||||||
{
|
{
|
||||||
_guiRoot = new CanvasRootControl(this);
|
_guiRoot = new CanvasRootControl(this)
|
||||||
_guiRoot.IsLayoutLocked = false;
|
{
|
||||||
|
IsLayoutLocked = false
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -245,12 +247,12 @@ namespace FlaxEngine
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
OrientedBoundingBox bounds = new OrientedBoundingBox();
|
OrientedBoundingBox bounds = new OrientedBoundingBox
|
||||||
bounds.Extents = new Vector3(_guiRoot.Size * 0.5f, Mathf.Epsilon);
|
{
|
||||||
Matrix world;
|
Extents = new Vector3(_guiRoot.Size * 0.5f, Mathf.Epsilon)
|
||||||
GetWorldMatrix(out world);
|
};
|
||||||
Matrix offset;
|
GetWorldMatrix(out Matrix world);
|
||||||
Matrix.Translation(bounds.Extents.X, bounds.Extents.Y, 0, out offset);
|
Matrix.Translation(bounds.Extents.X, bounds.Extents.Y, 0, out Matrix offset);
|
||||||
Matrix.Multiply(ref offset, ref world, out bounds.Transformation);
|
Matrix.Multiply(ref offset, ref world, out bounds.Transformation);
|
||||||
return bounds;
|
return bounds;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -161,9 +161,11 @@ namespace FlaxEngine
|
|||||||
if (!(_control is ContainerControl))
|
if (!(_control is ContainerControl))
|
||||||
throw new InvalidOperationException("To add child to the control it has to be ContainerControl.");
|
throw new InvalidOperationException("To add child to the control it has to be ContainerControl.");
|
||||||
|
|
||||||
var child = new UIControl();
|
var child = new UIControl
|
||||||
child.Parent = this;
|
{
|
||||||
child.Control = (Control)Activator.CreateInstance(typeof(T));
|
Parent = this,
|
||||||
|
Control = (Control)Activator.CreateInstance(typeof(T))
|
||||||
|
};
|
||||||
return child;
|
return child;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user