Revert previous checks, revert switch intend
This commit is contained in:
@@ -59,11 +59,13 @@ namespace FlaxEditor.Content.Thumbnails
|
||||
}
|
||||
|
||||
// We cache previews only for items with 'ID', for now we support only AssetItems
|
||||
if (!(item is AssetItem assetItem))
|
||||
var assetItem = item as AssetItem;
|
||||
if (assetItem == null)
|
||||
return;
|
||||
|
||||
// Ensure that there is valid proxy for that item
|
||||
if (!(Editor.ContentDatabase.GetProxy(item) is AssetProxy proxy))
|
||||
var proxy = Editor.ContentDatabase.GetProxy(item) as AssetProxy;
|
||||
if (proxy == null)
|
||||
{
|
||||
Editor.LogWarning($"Cannot generate preview for item {item.Path}. Cannot find proxy for it.");
|
||||
return;
|
||||
@@ -103,7 +105,8 @@ namespace FlaxEditor.Content.Thumbnails
|
||||
throw new ArgumentNullException();
|
||||
|
||||
// We cache previews only for items with 'ID', for now we support only AssetItems
|
||||
if (!(item is AssetItem assetItem))
|
||||
var assetItem = item as AssetItem;
|
||||
if (assetItem == null)
|
||||
return;
|
||||
|
||||
lock (_requests)
|
||||
|
||||
@@ -1236,7 +1236,8 @@ namespace FlaxEditor
|
||||
result = IntPtr.Zero;
|
||||
if (Windows.GameWin != null && (forceGet || Windows.GameWin.ContainsFocus))
|
||||
{
|
||||
if (Windows.GameWin.Root is WindowRootControl win)
|
||||
var win = Windows.GameWin.Root as WindowRootControl;
|
||||
if (win != null)
|
||||
result = FlaxEngine.Object.GetUnmanagedPtr(win.Window);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,11 +242,11 @@ namespace FlaxEditor.GUI
|
||||
MainMenuButton b = null;
|
||||
foreach (var control in Children)
|
||||
{
|
||||
if (b == null && control is MainMenuButton button)
|
||||
b = button;
|
||||
if (b == null && control is MainMenuButton)
|
||||
b = (MainMenuButton)control;
|
||||
|
||||
if (control is MainMenuButton button1 && control.Right > b.Right)
|
||||
b = button1;
|
||||
if (control is MainMenuButton && control.Right > b.Right)
|
||||
b = (MainMenuButton)control;
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
@@ -56,107 +56,107 @@ namespace FlaxEditor.Gizmo
|
||||
_activeAxis = Axis.None;
|
||||
switch (_activeMode)
|
||||
{
|
||||
case Mode.Translate:
|
||||
case Mode.Translate:
|
||||
{
|
||||
// Axis boxes collision
|
||||
if (XAxisBox.Intersects(ref localRay, out intersection) && intersection < closestintersection)
|
||||
{
|
||||
// Axis boxes collision
|
||||
if (XAxisBox.Intersects(ref localRay, out intersection) && intersection < closestintersection)
|
||||
{
|
||||
_activeAxis = Axis.X;
|
||||
closestintersection = intersection;
|
||||
}
|
||||
|
||||
if (YAxisBox.Intersects(ref localRay, out intersection) && intersection < closestintersection)
|
||||
{
|
||||
_activeAxis = Axis.Y;
|
||||
closestintersection = intersection;
|
||||
}
|
||||
|
||||
if (ZAxisBox.Intersects(ref localRay, out intersection) && intersection < closestintersection)
|
||||
{
|
||||
_activeAxis = Axis.Z;
|
||||
closestintersection = intersection;
|
||||
}
|
||||
|
||||
// Quad planes collision
|
||||
if (closestintersection >= float.MaxValue)
|
||||
closestintersection = float.MinValue;
|
||||
if (XYBox.Intersects(ref localRay, out intersection) && intersection > closestintersection)
|
||||
{
|
||||
_activeAxis = Axis.XY;
|
||||
closestintersection = intersection;
|
||||
}
|
||||
|
||||
if (XZBox.Intersects(ref localRay, out intersection) && intersection > closestintersection)
|
||||
{
|
||||
_activeAxis = Axis.ZX;
|
||||
closestintersection = intersection;
|
||||
}
|
||||
if (YZBox.Intersects(ref localRay, out intersection) && intersection > closestintersection)
|
||||
{
|
||||
_activeAxis = Axis.YZ;
|
||||
closestintersection = intersection;
|
||||
}
|
||||
|
||||
break;
|
||||
_activeAxis = Axis.X;
|
||||
closestintersection = intersection;
|
||||
}
|
||||
|
||||
case Mode.Rotate:
|
||||
if (YAxisBox.Intersects(ref localRay, out intersection) && intersection < closestintersection)
|
||||
{
|
||||
// Circles
|
||||
if (IntersectsRotateCircle(Vector3.UnitX, ref localRay, out intersection) && intersection < closestintersection)
|
||||
{
|
||||
_activeAxis = Axis.X;
|
||||
closestintersection = intersection;
|
||||
}
|
||||
if (IntersectsRotateCircle(Vector3.UnitY, ref localRay, out intersection) && intersection < closestintersection)
|
||||
{
|
||||
_activeAxis = Axis.Y;
|
||||
closestintersection = intersection;
|
||||
}
|
||||
if (IntersectsRotateCircle(Vector3.UnitZ, ref localRay, out intersection) && intersection < closestintersection)
|
||||
{
|
||||
_activeAxis = Axis.Z;
|
||||
closestintersection = intersection;
|
||||
}
|
||||
|
||||
// Center
|
||||
/*if (CenterSphere.Intersects(ref ray, out intersection) && intersection < closestintersection)
|
||||
{
|
||||
_activeAxis = Axis.Center;
|
||||
closestintersection = intersection;
|
||||
}*/
|
||||
|
||||
break;
|
||||
_activeAxis = Axis.Y;
|
||||
closestintersection = intersection;
|
||||
}
|
||||
|
||||
case Mode.Scale:
|
||||
if (ZAxisBox.Intersects(ref localRay, out intersection) && intersection < closestintersection)
|
||||
{
|
||||
// Spheres collision
|
||||
if (ScaleXSphere.Intersects(ref ray, out intersection) && intersection < closestintersection)
|
||||
{
|
||||
_activeAxis = Axis.X;
|
||||
closestintersection = intersection;
|
||||
}
|
||||
if (ScaleYSphere.Intersects(ref ray, out intersection) && intersection < closestintersection)
|
||||
{
|
||||
_activeAxis = Axis.Y;
|
||||
closestintersection = intersection;
|
||||
}
|
||||
if (ScaleZSphere.Intersects(ref ray, out intersection) && intersection < closestintersection)
|
||||
{
|
||||
_activeAxis = Axis.Z;
|
||||
closestintersection = intersection;
|
||||
}
|
||||
|
||||
// Center
|
||||
if (CenterBox.Intersects(ref ray, out intersection) && intersection < closestintersection)
|
||||
{
|
||||
_activeAxis = Axis.Center;
|
||||
closestintersection = intersection;
|
||||
}
|
||||
|
||||
break;
|
||||
_activeAxis = Axis.Z;
|
||||
closestintersection = intersection;
|
||||
}
|
||||
|
||||
// Quad planes collision
|
||||
if (closestintersection >= float.MaxValue)
|
||||
closestintersection = float.MinValue;
|
||||
if (XYBox.Intersects(ref localRay, out intersection) && intersection > closestintersection)
|
||||
{
|
||||
_activeAxis = Axis.XY;
|
||||
closestintersection = intersection;
|
||||
}
|
||||
|
||||
if (XZBox.Intersects(ref localRay, out intersection) && intersection > closestintersection)
|
||||
{
|
||||
_activeAxis = Axis.ZX;
|
||||
closestintersection = intersection;
|
||||
}
|
||||
if (YZBox.Intersects(ref localRay, out intersection) && intersection > closestintersection)
|
||||
{
|
||||
_activeAxis = Axis.YZ;
|
||||
closestintersection = intersection;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case Mode.Rotate:
|
||||
{
|
||||
// Circles
|
||||
if (IntersectsRotateCircle(Vector3.UnitX, ref localRay, out intersection) && intersection < closestintersection)
|
||||
{
|
||||
_activeAxis = Axis.X;
|
||||
closestintersection = intersection;
|
||||
}
|
||||
if (IntersectsRotateCircle(Vector3.UnitY, ref localRay, out intersection) && intersection < closestintersection)
|
||||
{
|
||||
_activeAxis = Axis.Y;
|
||||
closestintersection = intersection;
|
||||
}
|
||||
if (IntersectsRotateCircle(Vector3.UnitZ, ref localRay, out intersection) && intersection < closestintersection)
|
||||
{
|
||||
_activeAxis = Axis.Z;
|
||||
closestintersection = intersection;
|
||||
}
|
||||
|
||||
// Center
|
||||
/*if (CenterSphere.Intersects(ref ray, out intersection) && intersection < closestintersection)
|
||||
{
|
||||
_activeAxis = Axis.Center;
|
||||
closestintersection = intersection;
|
||||
}*/
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case Mode.Scale:
|
||||
{
|
||||
// Spheres collision
|
||||
if (ScaleXSphere.Intersects(ref ray, out intersection) && intersection < closestintersection)
|
||||
{
|
||||
_activeAxis = Axis.X;
|
||||
closestintersection = intersection;
|
||||
}
|
||||
if (ScaleYSphere.Intersects(ref ray, out intersection) && intersection < closestintersection)
|
||||
{
|
||||
_activeAxis = Axis.Y;
|
||||
closestintersection = intersection;
|
||||
}
|
||||
if (ScaleZSphere.Intersects(ref ray, out intersection) && intersection < closestintersection)
|
||||
{
|
||||
_activeAxis = Axis.Z;
|
||||
closestintersection = intersection;
|
||||
}
|
||||
|
||||
// Center
|
||||
if (CenterBox.Intersects(ref ray, out intersection) && intersection < closestintersection)
|
||||
{
|
||||
_activeAxis = Axis.Center;
|
||||
closestintersection = intersection;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -690,7 +690,8 @@ namespace FlaxEditor.SceneGraph.GUI
|
||||
var item = _dragActorType.Objects[i];
|
||||
|
||||
// Create actor
|
||||
if (!(item.CreateInstance() is Actor actor))
|
||||
var actor = item.CreateInstance() as Actor;
|
||||
if (actor == null)
|
||||
{
|
||||
Editor.LogWarning("Failed to spawn actor of type " + item.TypeName);
|
||||
continue;
|
||||
|
||||
@@ -547,10 +547,12 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
{
|
||||
var context = _context.Get(_surface);
|
||||
|
||||
if (!(context.FindNode(_srcStateId) is StateMachineState src))
|
||||
var src = context.FindNode(_srcStateId) as StateMachineState;
|
||||
if (src == null)
|
||||
throw new Exception("Missing source state.");
|
||||
|
||||
if (!(context.FindNode(_dstStateId) is StateMachineState dst))
|
||||
var dst = context.FindNode(_dstStateId) as StateMachineState;
|
||||
if (dst == null)
|
||||
throw new Exception("Missing destination state.");
|
||||
|
||||
var transition = new StateMachineTransition(src, dst, ref _data);
|
||||
@@ -870,7 +872,8 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
if (ruleSize != 0)
|
||||
rule = reader.ReadBytes(ruleSize);
|
||||
|
||||
if (!(Context.FindNode(data.Destination) is StateMachineState destination))
|
||||
var destination = Context.FindNode(data.Destination) as StateMachineState;
|
||||
if (destination == null)
|
||||
{
|
||||
Editor.LogWarning("Missing state machine state destination node.");
|
||||
continue;
|
||||
|
||||
@@ -766,7 +766,8 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
{
|
||||
var signature = new SignatureInfo();
|
||||
|
||||
if (!(Values[4] is byte[] data) || data.Length == 0)
|
||||
var data = Values[4] as byte[];
|
||||
if (data == null || data.Length == 0)
|
||||
return signature;
|
||||
|
||||
if (data[0] == 4)
|
||||
|
||||
@@ -686,9 +686,10 @@ namespace FlaxEditor.Surface.Elements
|
||||
public bool CanConnectWith(IConnectionInstigator other)
|
||||
{
|
||||
var start = this;
|
||||
var end = other as Box;
|
||||
|
||||
// Allow only box with box connection
|
||||
if (!(other is Box end))
|
||||
if (end == null)
|
||||
{
|
||||
// Cannot
|
||||
return false;
|
||||
|
||||
@@ -744,7 +744,8 @@ namespace FlaxEditor.Surface
|
||||
if (!CanEdit)
|
||||
return;
|
||||
|
||||
if (!(control is SurfaceNode node))
|
||||
var node = control as SurfaceNode;
|
||||
if (node == null)
|
||||
{
|
||||
Context.OnControlDeleted(control);
|
||||
MarkAsEdited();
|
||||
|
||||
@@ -968,7 +968,8 @@ namespace FlaxEditor.Viewport
|
||||
|
||||
private void Spawn(ScriptType item, SceneGraphNode hit, ref Vector2 location, ref Vector3 hitLocation)
|
||||
{
|
||||
if (!(item.CreateInstance() is Actor actor))
|
||||
var actor = item.CreateInstance() as Actor;
|
||||
if (actor == null)
|
||||
{
|
||||
Editor.LogWarning("Failed to spawn actor of type " + item.TypeName);
|
||||
return;
|
||||
|
||||
@@ -749,7 +749,8 @@ namespace FlaxEditor.Viewport
|
||||
|
||||
private void Spawn(ScriptType item, SceneGraphNode hit, ref Vector3 hitLocation)
|
||||
{
|
||||
if (!(item.CreateInstance() is Actor actor))
|
||||
var actor = item.CreateInstance() as Actor;
|
||||
if (actor == null)
|
||||
{
|
||||
Editor.LogWarning("Failed to spawn actor of type " + item.TypeName);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user