Merge remote-tracking branch 'origin/master' into 1.7
This commit is contained in:
@@ -25,6 +25,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
private DragHandlers _dragHandlers;
|
||||
private DragScriptItems _dragScripts;
|
||||
private DragAssets _dragAssets;
|
||||
private Button _addScriptsButton;
|
||||
|
||||
/// <summary>
|
||||
/// The parent scripts editor.
|
||||
@@ -40,16 +41,19 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
AutoFocus = false;
|
||||
|
||||
// Add script button
|
||||
float addScriptButtonWidth = 60.0f;
|
||||
var addScriptButton = new Button
|
||||
var buttonText = "Add script";
|
||||
var textSize = Style.Current.FontMedium.MeasureText(buttonText);
|
||||
float addScriptButtonWidth = (textSize.X < 60.0f) ? 60.0f : textSize.X + 4;
|
||||
var buttonHeight = (textSize.Y < 18) ? 18 : textSize.Y + 4;
|
||||
_addScriptsButton = new Button
|
||||
{
|
||||
TooltipText = "Add new scripts to the actor",
|
||||
AnchorPreset = AnchorPresets.MiddleCenter,
|
||||
Text = "Add script",
|
||||
Text = buttonText,
|
||||
Parent = this,
|
||||
Bounds = new Rectangle((Width - addScriptButtonWidth) / 2, 1, addScriptButtonWidth, 18),
|
||||
Bounds = new Rectangle((Width - addScriptButtonWidth) / 2, 1, addScriptButtonWidth, buttonHeight),
|
||||
};
|
||||
addScriptButton.ButtonClicked += OnAddScriptButtonClicked;
|
||||
_addScriptsButton.ButtonClicked += OnAddScriptButtonClicked;
|
||||
}
|
||||
|
||||
private void OnAddScriptButtonClicked(Button button)
|
||||
@@ -82,7 +86,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
var size = Size;
|
||||
|
||||
// Info
|
||||
Render2D.DrawText(style.FontSmall, "Drag scripts here", new Rectangle(2, 22, size.X - 4, size.Y - 4 - 20), style.ForegroundDisabled, TextAlignment.Center, TextAlignment.Center);
|
||||
Render2D.DrawText(style.FontSmall, "Drag scripts here", new Rectangle(2, _addScriptsButton.Height + 4, size.X - 4, size.Y - 4 - 20), style.ForegroundDisabled, TextAlignment.Center, TextAlignment.Center);
|
||||
|
||||
// Check if drag is over
|
||||
if (IsDragOver && _dragHandlers != null && _dragHandlers.HasValidDrag)
|
||||
@@ -554,8 +558,8 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
return;
|
||||
for (int j = 0; j < e.Length; j++)
|
||||
{
|
||||
var t1 = scripts[j]?.TypeName;
|
||||
var t2 = e[j]?.TypeName;
|
||||
var t1 = scripts[j] != null ? scripts[j].TypeName : null;
|
||||
var t2 = e[j] != null ? e[j].TypeName : null;
|
||||
if (t1 != t2)
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -422,12 +422,14 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
|
||||
// Set control type button
|
||||
var space = layout.Space(20);
|
||||
float setTypeButtonWidth = 60.0f;
|
||||
var buttonText = "Set Type";
|
||||
var textSize = FlaxEngine.GUI.Style.Current.FontMedium.MeasureText(buttonText);
|
||||
float setTypeButtonWidth = (textSize.X < 60.0f) ? 60.0f : textSize.X + 4;
|
||||
var setTypeButton = new Button
|
||||
{
|
||||
TooltipText = "Sets the control to the given type",
|
||||
AnchorPreset = AnchorPresets.MiddleCenter,
|
||||
Text = "Set Type",
|
||||
Text = buttonText,
|
||||
Parent = space.Spacer,
|
||||
Bounds = new Rectangle((space.Spacer.Width - setTypeButtonWidth) / 2, 1, setTypeButtonWidth, 18),
|
||||
};
|
||||
|
||||
@@ -88,20 +88,20 @@ namespace FlaxEditor.CustomEditors.Editors
|
||||
LinkValues = Editor.Instance.Windows.PropertiesWin.ScaleLinked;
|
||||
|
||||
// Add button with the link icon
|
||||
|
||||
_linkButton = new Button
|
||||
{
|
||||
BackgroundBrush = new SpriteBrush(Editor.Instance.Icons.Link32),
|
||||
Parent = LinkedLabel,
|
||||
Width = 18,
|
||||
Height = 18,
|
||||
AnchorPreset = AnchorPresets.TopLeft,
|
||||
AnchorPreset = AnchorPresets.MiddleLeft,
|
||||
};
|
||||
_linkButton.Clicked += ToggleLink;
|
||||
ToggleEnabled();
|
||||
SetLinkStyle();
|
||||
var x = LinkedLabel.Text.Value.Length * 7 + 5;
|
||||
_linkButton.LocalX += x;
|
||||
_linkButton.LocalY += 1;
|
||||
var textSize = FlaxEngine.GUI.Style.Current.FontMedium.MeasureText(LinkedLabel.Text.Value);
|
||||
_linkButton.LocalX += textSize.X + 10;
|
||||
LinkedLabel.SetupContextMenu += (label, menu, editor) =>
|
||||
{
|
||||
menu.AddSeparator();
|
||||
|
||||
@@ -34,7 +34,9 @@ namespace FlaxEditor.CustomEditors.Editors
|
||||
}
|
||||
else
|
||||
{
|
||||
element.CheckBox.Checked = (bool)Values[0];
|
||||
var value = (bool?)Values[0];
|
||||
if (value != null)
|
||||
element.CheckBox.Checked = value.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -623,13 +623,18 @@ namespace FlaxEditor.CustomEditors.Editors
|
||||
{
|
||||
_label = layout.ClickableLabel(GetText(out _)).CustomControl;
|
||||
_label.RightClick += ShowPicker;
|
||||
var buttonText = "...";
|
||||
var button = new Button
|
||||
{
|
||||
Size = new Float2(16.0f),
|
||||
Text = "...",
|
||||
Text = buttonText,
|
||||
TooltipText = "Edit...",
|
||||
Parent = _label,
|
||||
};
|
||||
var textSize = FlaxEngine.GUI.Style.Current.FontMedium.MeasureText(buttonText);
|
||||
if (textSize.Y > button.Width)
|
||||
button.Width = textSize.Y + 2;
|
||||
|
||||
button.SetAnchorPreset(AnchorPresets.MiddleRight, false, true);
|
||||
button.Clicked += ShowPicker;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,9 @@ namespace FlaxEditor
|
||||
|
||||
public static void OnEditorOptionsChanged(Options.EditorOptions options)
|
||||
{
|
||||
var param = _highlightMaterial?.GetParameter("Color");
|
||||
if (!_highlightMaterial)
|
||||
return;
|
||||
var param = _highlightMaterial.GetParameter("Color");
|
||||
if (param != null)
|
||||
param.Value = options.Visual.HighlightColor;
|
||||
}
|
||||
|
||||
@@ -37,6 +37,9 @@ namespace FlaxEditor.GUI
|
||||
: base(0, 0, 100, height)
|
||||
{
|
||||
Depth = -1;
|
||||
|
||||
if (Height < Style.Current.FontMedium.Height)
|
||||
Height = Style.Current.FontMedium.Height + 4;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace FlaxEditor.GUI.Timeline
|
||||
/// </summary>
|
||||
public SceneAnimationPlayer Player
|
||||
{
|
||||
get => _player;
|
||||
get => _player != null ? _player : null;
|
||||
set
|
||||
{
|
||||
if (_player == value)
|
||||
@@ -268,7 +268,7 @@ namespace FlaxEditor.GUI.Timeline
|
||||
/// <inheritdoc />
|
||||
public override void OnSeek(int frame)
|
||||
{
|
||||
if (_player?.Animation)
|
||||
if (_player != null && _player.Animation)
|
||||
{
|
||||
_player.Animation.WaitForLoaded();
|
||||
_player.Time = frame / _player.Animation.FramesPerSecond;
|
||||
|
||||
@@ -129,6 +129,7 @@ namespace FlaxEditor.Modules
|
||||
else
|
||||
{
|
||||
Editor.UI.UpdateProgress(string.Empty, 0);
|
||||
Editor.UI.UpdateStatusBar();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -285,7 +285,7 @@ namespace FlaxEditor.Modules
|
||||
|
||||
Color color;
|
||||
if (Editor.StateMachine.IsPlayMode)
|
||||
color = Color.OrangeRed;
|
||||
color = Style.Current.Statusbar.PlayMode;
|
||||
else
|
||||
color = Style.Current.BackgroundSelected;
|
||||
|
||||
@@ -299,6 +299,11 @@ namespace FlaxEditor.Modules
|
||||
else
|
||||
text = "Ready";
|
||||
|
||||
if(ProgressVisible)
|
||||
{
|
||||
color = Style.Current.Statusbar.Loading;
|
||||
}
|
||||
|
||||
StatusBar.Text = text;
|
||||
StatusBar.StatusColor = color;
|
||||
_contentStats = contentStats;
|
||||
@@ -344,7 +349,7 @@ namespace FlaxEditor.Modules
|
||||
internal void ProgressFailed(string message)
|
||||
{
|
||||
_progressFailed = true;
|
||||
StatusBar.StatusColor = Color.Red;
|
||||
StatusBar.StatusColor = Style.Current.Statusbar.Failed;
|
||||
StatusBar.Text = message;
|
||||
_outputLogButton.Visible = true;
|
||||
}
|
||||
@@ -397,6 +402,10 @@ namespace FlaxEditor.Modules
|
||||
{
|
||||
UpdateStatusBar();
|
||||
}
|
||||
else if(ProgressVisible)
|
||||
{
|
||||
UpdateStatusBar();
|
||||
}
|
||||
}
|
||||
|
||||
private class CustomWindowBorderControl : Control
|
||||
@@ -778,7 +787,7 @@ namespace FlaxEditor.Modules
|
||||
HorizontalAlignment = TextAlignment.Far,
|
||||
AnchorPreset = AnchorPresets.HorizontalStretchMiddle,
|
||||
Parent = progressPanel,
|
||||
Offsets = new Margin(progressBarRightMargin, progressBarWidth + progressBarLeftMargin + progressBarRightMargin, 0, 0),
|
||||
Offsets = new Margin(progressBarRightMargin, progressBarWidth + progressBarLeftMargin + progressBarRightMargin, 0, 0)
|
||||
};
|
||||
|
||||
UpdateStatusBar();
|
||||
|
||||
@@ -721,7 +721,7 @@ namespace FlaxEditor.Modules
|
||||
// Create main window
|
||||
var settings = CreateWindowSettings.Default;
|
||||
settings.Title = "Flax Editor";
|
||||
//settings.Size = Platform.DesktopSize;
|
||||
settings.Size = Platform.DesktopSize * 0.75f;
|
||||
settings.StartPosition = WindowStartPosition.CenterScreen;
|
||||
settings.ShowAfterFirstPaint = true;
|
||||
|
||||
|
||||
@@ -244,6 +244,13 @@ namespace FlaxEditor.Options
|
||||
CollectionBackgroundColor = Color.FromBgra(0x14CCCCCC),
|
||||
ProgressNormal = Color.FromBgra(0xFF0ad328),
|
||||
|
||||
Statusbar = new Style.StatusbarStyle()
|
||||
{
|
||||
PlayMode = Color.FromBgra(0xFF2F9135),
|
||||
Failed = Color.FromBgra(0xFF9C2424),
|
||||
Loading = Color.FromBgra(0xFF2D2D30)
|
||||
},
|
||||
|
||||
// Fonts
|
||||
FontTitle = options.Interface.TitleFont.GetFont(),
|
||||
FontLarge = options.Interface.LargeFont.GetFont(),
|
||||
|
||||
@@ -41,10 +41,8 @@ namespace FlaxEditor.Surface.Elements
|
||||
}
|
||||
|
||||
// Calculate control points
|
||||
var dst = (end - start) * new Float2(0.5f, 0.05f);
|
||||
var control1 = new Float2(start.X + dst.X, start.Y + dst.Y);
|
||||
var control2 = new Float2(end.X - dst.X, end.Y + dst.Y);
|
||||
|
||||
CalculateBezierControlPoints(start, end, out var control1, out var control2);
|
||||
|
||||
// Draw line
|
||||
Render2D.DrawBezier(start, control1, control2, end, color, thickness);
|
||||
|
||||
@@ -56,6 +54,23 @@ namespace FlaxEditor.Surface.Elements
|
||||
*/
|
||||
}
|
||||
|
||||
private static void CalculateBezierControlPoints(Float2 start, Float2 end, out Float2 control1, out Float2 control2)
|
||||
{
|
||||
// Control points parameters
|
||||
const float minControlLength = 100f;
|
||||
const float maxControlLength = 150f;
|
||||
var dst = (end - start).Length;
|
||||
var yDst = Mathf.Abs(start.Y - end.Y);
|
||||
|
||||
// Calculate control points
|
||||
var minControlDst = dst * 0.5f;
|
||||
var maxControlDst = Mathf.Max(Mathf.Min(maxControlLength, dst), minControlLength);
|
||||
var controlDst = Mathf.Lerp(minControlDst, maxControlDst, Mathf.Clamp(yDst / minControlLength, 0f, 1f));
|
||||
|
||||
control1 = new Float2(start.X + controlDst, start.Y);
|
||||
control2 = new Float2(end.X - controlDst, end.Y);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if a point intersects a connection
|
||||
/// </summary>
|
||||
@@ -82,13 +97,9 @@ namespace FlaxEditor.Surface.Elements
|
||||
|
||||
float offset = Mathf.Sign(end.Y - start.Y) * distance;
|
||||
if ((point.Y - (start.Y - offset)) * ((end.Y + offset) - point.Y) < 0) return false;
|
||||
|
||||
// Taken from the Render2D.DrawBezier code
|
||||
|
||||
float squaredDistance = distance;
|
||||
|
||||
var dst = (end - start) * new Float2(0.5f, 0.05f);
|
||||
var control1 = new Float2(start.X + dst.X, start.Y + dst.Y);
|
||||
var control2 = new Float2(end.X - dst.X, end.Y + dst.Y);
|
||||
CalculateBezierControlPoints(start, end, out var control1, out var control2);
|
||||
|
||||
var d1 = control1 - start;
|
||||
var d2 = control2 - control1;
|
||||
|
||||
@@ -137,14 +137,23 @@ namespace FlaxEditor.Tools.Foliage
|
||||
Offsets = Margin.Zero,
|
||||
Parent = _noFoliagePanel
|
||||
};
|
||||
|
||||
var buttonText = "Create new foliage";
|
||||
_createNewFoliage = new Button
|
||||
{
|
||||
Text = "Create new foliage",
|
||||
Text = buttonText,
|
||||
AnchorPreset = AnchorPresets.MiddleCenter,
|
||||
Offsets = new Margin(-60, 120, -12, 24),
|
||||
Parent = _noFoliagePanel,
|
||||
Enabled = false
|
||||
};
|
||||
var textSize = Style.Current.FontMedium.MeasureText(buttonText);
|
||||
if (_createNewFoliage.Width < textSize.X)
|
||||
{
|
||||
_createNewFoliage.LocalX -= (textSize.X - _createNewFoliage.Width) / 2;
|
||||
_createNewFoliage.Width = textSize.X + 6;
|
||||
}
|
||||
|
||||
_createNewFoliage.Clicked += OnCreateNewFoliageClicked;
|
||||
}
|
||||
|
||||
|
||||
@@ -375,7 +375,7 @@ namespace FlaxEditor.Tools.Foliage
|
||||
|
||||
private void OnModified()
|
||||
{
|
||||
Editor.Instance.Scene.MarkSceneEdited(_proxy.Foliage?.Scene);
|
||||
Editor.Instance.Scene.MarkSceneEdited(_proxy.Foliage != null ? _proxy.Foliage.Scene : null);
|
||||
}
|
||||
|
||||
private void OnSelectedFoliageChanged()
|
||||
|
||||
@@ -218,7 +218,7 @@ namespace FlaxEditor.Tools.Foliage
|
||||
|
||||
private void OnModified()
|
||||
{
|
||||
Editor.Instance.Scene.MarkSceneEdited(_proxy.Foliage?.Scene);
|
||||
Editor.Instance.Scene.MarkSceneEdited(_proxy.Foliage != null ? _proxy.Foliage.Scene : null);
|
||||
}
|
||||
|
||||
private void OnSelectedFoliageChanged()
|
||||
|
||||
@@ -95,14 +95,23 @@ namespace FlaxEditor.Tools.Terrain
|
||||
Offsets = Margin.Zero,
|
||||
Parent = _noTerrainPanel
|
||||
};
|
||||
|
||||
var buttonText = "Create new terrain";
|
||||
_createTerrainButton = new Button
|
||||
{
|
||||
Text = "Create new terrain",
|
||||
Text = buttonText,
|
||||
AnchorPreset = AnchorPresets.MiddleCenter,
|
||||
Offsets = new Margin(-60, 120, -12, 24),
|
||||
Parent = _noTerrainPanel,
|
||||
Enabled = false
|
||||
};
|
||||
var textSize = Style.Current.FontMedium.MeasureText(buttonText);
|
||||
if (_createTerrainButton.Width < textSize.X)
|
||||
{
|
||||
_createTerrainButton.LocalX -= (textSize.X - _createTerrainButton.Width) / 2;
|
||||
_createTerrainButton.Width = textSize.X + 6;
|
||||
}
|
||||
|
||||
_createTerrainButton.Clicked += OnCreateNewTerrainClicked;
|
||||
}
|
||||
|
||||
|
||||
@@ -545,7 +545,7 @@ namespace FlaxEditor.Tools
|
||||
public override bool IsControllingMouse => IsPainting;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override BoundingSphere FocusBounds => _selectedModel?.Sphere ?? base.FocusBounds;
|
||||
public override BoundingSphere FocusBounds => _selectedModel != null ? _selectedModel.Sphere : base.FocusBounds;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Update(float dt)
|
||||
|
||||
@@ -144,7 +144,7 @@ namespace FlaxEditor.Actions
|
||||
{
|
||||
var node = nodeParents[i];
|
||||
var actor = node.Actor;
|
||||
var parent = actor?.Parent;
|
||||
var parent = actor != null ? actor.Parent : null;
|
||||
if (parent != null)
|
||||
{
|
||||
bool IsNameValid(string name)
|
||||
|
||||
@@ -441,6 +441,9 @@ namespace FlaxEditor.Viewport
|
||||
|
||||
if (useWidgets)
|
||||
{
|
||||
var largestText = "Invert Panning";
|
||||
var textSize = Style.Current.FontMedium.MeasureText(largestText);
|
||||
var xLocationForExtras = textSize.X + 5;
|
||||
// Camera speed widget
|
||||
var camSpeed = new ViewportWidgetsContainer(ViewportWidgetLocation.UpperRight);
|
||||
var camSpeedCM = new ContextMenu();
|
||||
@@ -541,7 +544,7 @@ namespace FlaxEditor.Viewport
|
||||
{
|
||||
var ortho = ViewWidgetButtonMenu.AddButton("Orthographic");
|
||||
ortho.CloseMenuOnClick = false;
|
||||
var orthoValue = new CheckBox(90, 2, _isOrtho)
|
||||
var orthoValue = new CheckBox(xLocationForExtras, 2, _isOrtho)
|
||||
{
|
||||
Parent = ortho
|
||||
};
|
||||
@@ -581,7 +584,7 @@ namespace FlaxEditor.Viewport
|
||||
{
|
||||
var fov = ViewWidgetButtonMenu.AddButton("Field Of View");
|
||||
fov.CloseMenuOnClick = false;
|
||||
var fovValue = new FloatValueBox(1, 90, 2, 70.0f, 35.0f, 160.0f, 0.1f)
|
||||
var fovValue = new FloatValueBox(1, xLocationForExtras, 2, 70.0f, 35.0f, 160.0f, 0.1f)
|
||||
{
|
||||
Parent = fov
|
||||
};
|
||||
@@ -598,7 +601,7 @@ namespace FlaxEditor.Viewport
|
||||
{
|
||||
var orthoSize = ViewWidgetButtonMenu.AddButton("Ortho Scale");
|
||||
orthoSize.CloseMenuOnClick = false;
|
||||
var orthoSizeValue = new FloatValueBox(_orthoSize, 90, 2, 70.0f, 0.001f, 100000.0f, 0.01f)
|
||||
var orthoSizeValue = new FloatValueBox(_orthoSize, xLocationForExtras, 2, 70.0f, 0.001f, 100000.0f, 0.01f)
|
||||
{
|
||||
Parent = orthoSize
|
||||
};
|
||||
@@ -615,7 +618,7 @@ namespace FlaxEditor.Viewport
|
||||
{
|
||||
var nearPlane = ViewWidgetButtonMenu.AddButton("Near Plane");
|
||||
nearPlane.CloseMenuOnClick = false;
|
||||
var nearPlaneValue = new FloatValueBox(2.0f, 90, 2, 70.0f, 0.001f, 1000.0f)
|
||||
var nearPlaneValue = new FloatValueBox(2.0f, xLocationForExtras, 2, 70.0f, 0.001f, 1000.0f)
|
||||
{
|
||||
Parent = nearPlane
|
||||
};
|
||||
@@ -627,7 +630,7 @@ namespace FlaxEditor.Viewport
|
||||
{
|
||||
var farPlane = ViewWidgetButtonMenu.AddButton("Far Plane");
|
||||
farPlane.CloseMenuOnClick = false;
|
||||
var farPlaneValue = new FloatValueBox(1000, 90, 2, 70.0f, 10.0f)
|
||||
var farPlaneValue = new FloatValueBox(1000, xLocationForExtras, 2, 70.0f, 10.0f)
|
||||
{
|
||||
Parent = farPlane
|
||||
};
|
||||
@@ -639,7 +642,7 @@ namespace FlaxEditor.Viewport
|
||||
{
|
||||
var brightness = ViewWidgetButtonMenu.AddButton("Brightness");
|
||||
brightness.CloseMenuOnClick = false;
|
||||
var brightnessValue = new FloatValueBox(1.0f, 90, 2, 70.0f, 0.001f, 10.0f, 0.001f)
|
||||
var brightnessValue = new FloatValueBox(1.0f, xLocationForExtras, 2, 70.0f, 0.001f, 10.0f, 0.001f)
|
||||
{
|
||||
Parent = brightness
|
||||
};
|
||||
@@ -651,7 +654,7 @@ namespace FlaxEditor.Viewport
|
||||
{
|
||||
var resolution = ViewWidgetButtonMenu.AddButton("Resolution");
|
||||
resolution.CloseMenuOnClick = false;
|
||||
var resolutionValue = new FloatValueBox(1.0f, 90, 2, 70.0f, 0.1f, 4.0f, 0.001f)
|
||||
var resolutionValue = new FloatValueBox(1.0f, xLocationForExtras, 2, 70.0f, 0.1f, 4.0f, 0.001f)
|
||||
{
|
||||
Parent = resolution
|
||||
};
|
||||
@@ -663,7 +666,7 @@ namespace FlaxEditor.Viewport
|
||||
{
|
||||
var invert = ViewWidgetButtonMenu.AddButton("Invert Panning");
|
||||
invert.CloseMenuOnClick = false;
|
||||
var invertValue = new CheckBox(90, 2, _invertPanning)
|
||||
var invertValue = new CheckBox(xLocationForExtras, 2, _invertPanning)
|
||||
{
|
||||
Parent = invert
|
||||
};
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace FlaxEditor.Viewport.Previews
|
||||
/// </summary>
|
||||
public bool ShowBounds
|
||||
{
|
||||
get => _boundsModel?.IsActive ?? false;
|
||||
get => _boundsModel != null ? _boundsModel.IsActive : false;
|
||||
set
|
||||
{
|
||||
if (value == ShowBounds)
|
||||
@@ -110,7 +110,7 @@ namespace FlaxEditor.Viewport.Previews
|
||||
/// </summary>
|
||||
public bool ShowOrigin
|
||||
{
|
||||
get => _originModel?.IsActive ?? false;
|
||||
get => _originModel != null ? _originModel.IsActive : false;
|
||||
set
|
||||
{
|
||||
if (value == ShowOrigin)
|
||||
|
||||
@@ -500,7 +500,7 @@ namespace FlaxEditor.Viewport.Previews
|
||||
/// <inheritdoc />
|
||||
protected override void CalculateTextureRect(out Rectangle rect)
|
||||
{
|
||||
CalculateTextureRect(_asset?.Size ?? new Float2(100), Size, out rect);
|
||||
CalculateTextureRect(_asset != null ? _asset.Size : new Float2(100), Size, out rect);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -549,7 +549,7 @@ namespace FlaxEditor.Viewport.Previews
|
||||
/// <inheritdoc />
|
||||
protected override void CalculateTextureRect(out Rectangle rect)
|
||||
{
|
||||
CalculateTextureRect(_asset?.Size ?? new Float2(100), Size, out rect);
|
||||
CalculateTextureRect(_asset != null ? _asset.Size : new Float2(100), Size, out rect);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -604,7 +604,7 @@ namespace FlaxEditor.Viewport.Previews
|
||||
/// <inheritdoc />
|
||||
protected override void CalculateTextureRect(out Rectangle rect)
|
||||
{
|
||||
CalculateTextureRect(_asset?.Size ?? new Float2(100), Size, out rect);
|
||||
CalculateTextureRect(_asset != null ? _asset.Size : new Float2(100), Size, out rect);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -659,7 +659,7 @@ namespace FlaxEditor.Viewport.Previews
|
||||
/// <inheritdoc />
|
||||
protected override void CalculateTextureRect(out Rectangle rect)
|
||||
{
|
||||
CalculateTextureRect(_asset?.Size ?? new Float2(100), Size, out rect);
|
||||
CalculateTextureRect(_asset != null ? _asset.Size : new Float2(100), Size, out rect);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -52,9 +52,11 @@ namespace FlaxEditor.Windows
|
||||
VerticalAlignment = TextAlignment.Near,
|
||||
Parent = this
|
||||
};
|
||||
var copyVersionButton = new Button(Width - 104, 6, 100, 20)
|
||||
var buttonText = "Copy version info";
|
||||
var fontSize = Style.Current.FontMedium.MeasureText(buttonText);
|
||||
var copyVersionButton = new Button(Width - fontSize.X - 8, 6, fontSize.X + 4, 20)
|
||||
{
|
||||
Text = "Copy version info",
|
||||
Text = buttonText,
|
||||
TooltipText = "Copies the current engine version information to system clipboard.",
|
||||
Parent = this
|
||||
};
|
||||
|
||||
@@ -200,6 +200,7 @@ namespace FlaxEditor.Windows.Assets
|
||||
ViewportCamera = new FPSCamera(),
|
||||
Parent = _split.Panel1
|
||||
};
|
||||
_preview.Task.ViewFlags &= ~ViewFlags.Sky & ~ViewFlags.Bloom;
|
||||
|
||||
// Asset properties
|
||||
_propertiesPresenter = new CustomEditorPresenter(null);
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace FlaxEditor.Windows.Assets
|
||||
[EditorDisplay("General"), Tooltip("The base material used to override it's properties")]
|
||||
public MaterialBase BaseMaterial
|
||||
{
|
||||
get => Window?.Asset?.BaseMaterial;
|
||||
get => Window?.Asset != null ? Window?.Asset.BaseMaterial : null;
|
||||
set
|
||||
{
|
||||
var asset = Window?.Asset;
|
||||
@@ -101,10 +101,12 @@ namespace FlaxEditor.Windows.Assets
|
||||
[HideInEditor]
|
||||
public object[] Values
|
||||
{
|
||||
get => Window?.Asset?.Parameters.Select(x => x.Value).ToArray();
|
||||
get => Window?.Asset != null ? Window?.Asset.Parameters.Select(x => x.Value).ToArray() : null;
|
||||
set
|
||||
{
|
||||
var parameters = Window?.Asset?.Parameters;
|
||||
if (Window?.Asset == null)
|
||||
return;
|
||||
var parameters = Window?.Asset.Parameters;
|
||||
if (value != null && parameters != null)
|
||||
{
|
||||
if (value.Length != parameters.Length)
|
||||
@@ -131,9 +133,11 @@ namespace FlaxEditor.Windows.Assets
|
||||
[HideInEditor]
|
||||
public FlaxEngine.Object[] ValuesRef
|
||||
{
|
||||
get => Window?.Asset?.Parameters.Select(x => x.Value as FlaxEngine.Object).ToArray();
|
||||
get => Window?.Asset != null ? Window?.Asset.Parameters.Select(x => x.Value as FlaxEngine.Object).ToArray() : null;
|
||||
set
|
||||
{
|
||||
if (Window?.Asset == null)
|
||||
return;
|
||||
var parameters = Window?.Asset?.Parameters;
|
||||
if (value != null && parameters != null)
|
||||
{
|
||||
@@ -293,7 +297,7 @@ namespace FlaxEditor.Windows.Assets
|
||||
var p = (MaterialParameter)e.Tag;
|
||||
|
||||
// Try to get default value (from the base material)
|
||||
var pBase = baseMaterial?.GetParameter(p.Name);
|
||||
var pBase = baseMaterial != null ? baseMaterial.GetParameter(p.Name) : null;
|
||||
if (pBase != null && pBase.ParameterType == p.ParameterType)
|
||||
{
|
||||
valueContainer.SetDefaultValue(pBase.Value);
|
||||
|
||||
@@ -134,7 +134,7 @@ namespace FlaxEditor.Windows.Assets
|
||||
if (Window._skipEffectsGuiEvents)
|
||||
return;
|
||||
|
||||
Window._isolateIndex = mesh?.MaterialSlotIndex ?? -1;
|
||||
Window._isolateIndex = mesh != null ? mesh.MaterialSlotIndex : -1;
|
||||
Window.UpdateEffectsOnAsset();
|
||||
UpdateEffectsOnUI();
|
||||
}
|
||||
@@ -144,7 +144,7 @@ namespace FlaxEditor.Windows.Assets
|
||||
if (Window._skipEffectsGuiEvents)
|
||||
return;
|
||||
|
||||
Window._highlightIndex = mesh?.MaterialSlotIndex ?? -1;
|
||||
Window._highlightIndex = mesh != null ? mesh.MaterialSlotIndex : -1;
|
||||
Window.UpdateEffectsOnAsset();
|
||||
UpdateEffectsOnUI();
|
||||
}
|
||||
@@ -326,7 +326,7 @@ namespace FlaxEditor.Windows.Assets
|
||||
[EditorOrder(10), EditorDisplay("Materials", EditorDisplayAttribute.InlineStyle)]
|
||||
public MaterialSlot[] MaterialSlots
|
||||
{
|
||||
get => Asset?.MaterialSlots;
|
||||
get => Asset != null ? Asset.MaterialSlots : null;
|
||||
set
|
||||
{
|
||||
if (Asset != null)
|
||||
|
||||
@@ -187,7 +187,7 @@ namespace FlaxEditor.Windows.Assets
|
||||
base.Initialize(layout);
|
||||
|
||||
var emitterTrack = Values[0] as EmitterTrackProxy;
|
||||
if (emitterTrack?._effect?.Parameters == null)
|
||||
if (emitterTrack?._effect == null || emitterTrack?._effect.Parameters == null)
|
||||
return;
|
||||
|
||||
var group = layout.Group("Parameters");
|
||||
|
||||
@@ -792,7 +792,7 @@ namespace FlaxEditor.Windows.Assets
|
||||
{
|
||||
if (_previewButton.Checked)
|
||||
return;
|
||||
_previewPlayerPicker.Value = _timeline.Player;
|
||||
_previewPlayerPicker.Value = _timeline.Player != null ? _timeline.Player : null;
|
||||
_cachedPlayerId = _timeline.Player?.ID ?? Guid.Empty;
|
||||
}
|
||||
|
||||
@@ -821,7 +821,7 @@ namespace FlaxEditor.Windows.Assets
|
||||
if (_timeline.IsModified)
|
||||
{
|
||||
var time = _timeline.CurrentTime;
|
||||
var isPlaying = _previewPlayer?.IsPlaying ?? false;
|
||||
var isPlaying = _previewPlayer != null ? _previewPlayer.IsPlaying : false;
|
||||
_timeline.Save(_asset);
|
||||
if (_previewButton.Checked && _previewPlayer != null)
|
||||
{
|
||||
|
||||
@@ -151,7 +151,7 @@ namespace FlaxEditor.Windows.Assets
|
||||
if (Window._skipEffectsGuiEvents)
|
||||
return;
|
||||
|
||||
Window._isolateIndex = mesh?.MaterialSlotIndex ?? -1;
|
||||
Window._isolateIndex = mesh != null ? mesh.MaterialSlotIndex : -1;
|
||||
Window.UpdateEffectsOnAsset();
|
||||
UpdateEffectsOnUI();
|
||||
}
|
||||
@@ -165,7 +165,7 @@ namespace FlaxEditor.Windows.Assets
|
||||
if (Window._skipEffectsGuiEvents)
|
||||
return;
|
||||
|
||||
Window._highlightIndex = mesh?.MaterialSlotIndex ?? -1;
|
||||
Window._highlightIndex = mesh != null ? mesh.MaterialSlotIndex : -1;
|
||||
Window.UpdateEffectsOnAsset();
|
||||
UpdateEffectsOnUI();
|
||||
}
|
||||
@@ -415,7 +415,7 @@ namespace FlaxEditor.Windows.Assets
|
||||
[EditorOrder(10), EditorDisplay("Materials", EditorDisplayAttribute.InlineStyle)]
|
||||
public MaterialSlot[] MaterialSlots
|
||||
{
|
||||
get => Asset?.MaterialSlots;
|
||||
get => Asset != null ? Asset.MaterialSlots : null;
|
||||
set
|
||||
{
|
||||
if (Asset != null)
|
||||
|
||||
@@ -160,7 +160,7 @@ namespace FlaxEditor.Windows
|
||||
Parent = this,
|
||||
};
|
||||
_viewDropdown.Clicked += OnViewButtonClicked;
|
||||
_searchBox = new SearchBox(false, _viewDropdown.Right + 2, 2, Width - _viewDropdown.Right - 2 - _scrollSize)
|
||||
_searchBox = new SearchBox(false, _viewDropdown.Right + 2, 2, Width - _viewDropdown.Right - 4)
|
||||
{
|
||||
Parent = this,
|
||||
};
|
||||
@@ -171,11 +171,12 @@ namespace FlaxEditor.Windows
|
||||
Maximum = 0,
|
||||
};
|
||||
_hScroll.ValueChanged += OnHScrollValueChanged;
|
||||
_vScroll = new VScrollBar(this, Width - _scrollSize, Height, _scrollSize)
|
||||
_vScroll = new VScrollBar(this, Width - _scrollSize, Height - _viewDropdown.Height - 2, _scrollSize)
|
||||
{
|
||||
ThumbThickness = 10,
|
||||
Maximum = 0,
|
||||
};
|
||||
_vScroll.Y += _viewDropdown.Height + 2;
|
||||
_vScroll.ValueChanged += OnVScrollValueChanged;
|
||||
_output = new OutputTextBox
|
||||
{
|
||||
@@ -409,7 +410,7 @@ namespace FlaxEditor.Windows
|
||||
|
||||
if (_output != null)
|
||||
{
|
||||
_searchBox.Width = Width - _viewDropdown.Right - 2 - _scrollSize;
|
||||
_searchBox.Width = Width - _viewDropdown.Right - 4;
|
||||
_output.Size = new Float2(_vScroll.X - 2, _hScroll.Y - 4 - _viewDropdown.Bottom);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,6 +173,9 @@ namespace FlaxEditor.Windows
|
||||
|
||||
// Spawn it
|
||||
Editor.SceneEditing.Spawn(actor, parentActor);
|
||||
|
||||
Editor.SceneEditing.Select(actor);
|
||||
Rename();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -18,21 +18,21 @@ const Char* SplashScreenQuotes[] =
|
||||
TEXT("Loading"),
|
||||
TEXT("Unloading"),
|
||||
TEXT("Reloading"),
|
||||
TEXT("Reloading gun"),
|
||||
TEXT("Downloading more RAM"),
|
||||
TEXT("Consuming your RAM"),
|
||||
TEXT("Burning your CPU"),
|
||||
TEXT("#BetterThanUnity"),
|
||||
TEXT("Rendering buttons"),
|
||||
TEXT("Collecting crash data"),
|
||||
TEXT("Downloading porn"),
|
||||
#if PLATFORM_WINDOWS
|
||||
TEXT("Removing 'C:\\Windows\\'"),
|
||||
TEXT("We're getting everything ready for you."),
|
||||
#elif PLATFORM_LINUX
|
||||
TEXT("Time to switch to Windows?"),
|
||||
TEXT("Installing Windows 10"),
|
||||
TEXT("Try it on a Raspberry"),
|
||||
TEXT("Trying to exit vim"),
|
||||
TEXT("Sudo flax --loadproject"),
|
||||
#elif PLATFORM_MAC
|
||||
TEXT("Hacking your iPhone"),
|
||||
TEXT("don't compare Macbooks to oranges."),
|
||||
TEXT("Why does macbook heat up?\nBecause it doesn't have windows"),
|
||||
TEXT("Starting Direc... um, Vulkan renderer."),
|
||||
#endif
|
||||
TEXT("Kappa!"),
|
||||
TEXT("How you doin'?"),
|
||||
@@ -40,12 +40,10 @@ const Char* SplashScreenQuotes[] =
|
||||
TEXT("Bond. James Bond."),
|
||||
TEXT("To infinity and beyond!"),
|
||||
TEXT("Houston, we have a problem"),
|
||||
TEXT("NotImplementedEngineException"),
|
||||
TEXT("Made in Poland"),
|
||||
TEXT("We like you"),
|
||||
TEXT("Compiling the compiler"),
|
||||
TEXT("Flax it up!"),
|
||||
TEXT("Fun fact: Fortnite runs on Flax"),
|
||||
TEXT("Toss a coin to your Witcher!!!"),
|
||||
TEXT("Holy Moly!"),
|
||||
TEXT("Just Read the Instructions"),
|
||||
@@ -60,7 +58,6 @@ const Char* SplashScreenQuotes[] =
|
||||
TEXT("They see me loadin'"),
|
||||
TEXT("Loadin' loadin' and loadin' loadin'"),
|
||||
TEXT("Procedurally generating buttons"),
|
||||
TEXT("Out of Memory Exception!"),
|
||||
TEXT("Running Big Bang simulation"),
|
||||
TEXT("Calculating infinity"),
|
||||
TEXT("Dividing infinity by zero"),
|
||||
@@ -70,10 +67,7 @@ const Char* SplashScreenQuotes[] =
|
||||
TEXT("Whatever you do, do it well.\n~Walt Disney"),
|
||||
TEXT("Here's Johnny!"),
|
||||
TEXT("Did you see that? No... I don't think so"),
|
||||
TEXT("Collecting unreal power"),
|
||||
TEXT("Stay safe, friend"),
|
||||
TEXT("trolololololololololololo"),
|
||||
TEXT("xD"),
|
||||
TEXT("Come to the dark side"),
|
||||
TEXT("Flax Facts: This is a loading screen"),
|
||||
TEXT("Don't Stop Me Now"),
|
||||
@@ -81,61 +75,58 @@ const Char* SplashScreenQuotes[] =
|
||||
TEXT("Made with Flax"),
|
||||
TEXT("This is the way"),
|
||||
TEXT("The quick brown fox jumps over the lazy dog"),
|
||||
TEXT("Hit The Road Jack"),
|
||||
TEXT("You have 7 lives left"),
|
||||
TEXT("May the Force be with you"),
|
||||
TEXT("A martini. Shaken, not stirred"),
|
||||
TEXT("Hasta la vista, baby"),
|
||||
TEXT("Winter is coming"),
|
||||
TEXT("You know nothing, Jon Snow"),
|
||||
TEXT("Create something awesome!"),
|
||||
TEXT("Well Polished Engine"),
|
||||
TEXT("Error 404: Joke Not Found"),
|
||||
TEXT("Rushing B"),
|
||||
TEXT("Putting pineapple on pizza"),
|
||||
TEXT("Loading Simulation"),
|
||||
TEXT("Entering the Matrix"),
|
||||
TEXT("Get ready for a surprise!"),
|
||||
TEXT("Coffee is my fuel"),
|
||||
TEXT("Installing a free copy of Cyberpunk 2077"),
|
||||
TEXT("With great power comes great electricity bill"),
|
||||
TEXT("Flax was made in the same city as Witcher 3"),
|
||||
TEXT("So JavaScript is a scripting version of Java"),
|
||||
TEXT("Good things take time.\n~Someone"),
|
||||
TEXT("Get shit done"),
|
||||
TEXT("Hold Tight! Loading Flax"),
|
||||
TEXT("That's one small step for a man,\none giant leap for mankind"),
|
||||
TEXT("Remember to save your work frequently"),
|
||||
TEXT("In case of fire:\ngit commit, git push, leave building"),
|
||||
TEXT("Keep calm and make games"),
|
||||
TEXT("You're breathtaking!!!"),
|
||||
TEXT("Do regular dogs see police dogs & think,\nOh no it's a cop?"),
|
||||
TEXT("Dear Santa,\nDefine naughty."),
|
||||
TEXT("Blah, blah"),
|
||||
TEXT("My PRECIOUS!!!!"),
|
||||
TEXT("YOU SHALL NOT PASS!"),
|
||||
TEXT("You have my bow.\nAnd my axe!"),
|
||||
TEXT("To the bridge of Khazad-dum."),
|
||||
TEXT("One ring to rule them all.\nOne ring to find them."),
|
||||
TEXT("Ladies and gentelman, we got him"),
|
||||
TEXT("Cyberpunk of game engines"),
|
||||
TEXT("That's what she said"),
|
||||
TEXT("Compiling Shaders (93,788)"),
|
||||
TEXT("We could be compiling shaders here"),
|
||||
TEXT("Hello There"),
|
||||
TEXT("BAGUETTE"),
|
||||
TEXT("All we had to do was follow the damn train, CJ"),
|
||||
TEXT("Here we go again"),
|
||||
TEXT("@everyone"),
|
||||
TEXT("Potato"),
|
||||
TEXT("Python is a programming snek"),
|
||||
TEXT("Flax will start when pigs will fly"),
|
||||
TEXT("I'm the android sent by CyberLife"),
|
||||
TEXT("Fancy-ass ray tracing, rtx on, lighting"),
|
||||
TEXT("ZOINKS"),
|
||||
TEXT("Scooby dooby doo"),
|
||||
TEXT("You shall not load!"),
|
||||
TEXT("The roof, the roof, the roof is on fire!"),
|
||||
TEXT("I've seen better documentation...\nFrom ransomware gangs!"),
|
||||
TEXT("Slava Ukraini!"),
|
||||
TEXT("RTX off... for now!"),
|
||||
TEXT("Increasing Fiber count"),
|
||||
TEXT("Now this is podracing!"),
|
||||
TEXT("Weird flax, but ok"),
|
||||
TEXT("Reticulating Splines"),
|
||||
TEXT("Discombobulating"),
|
||||
TEXT("Who is signing all these integers?!"),
|
||||
TEXT("Flax fact: Flax was called Celelej once."),
|
||||
TEXT("Changing text overflow setti-"),
|
||||
};
|
||||
|
||||
SplashScreen::~SplashScreen()
|
||||
|
||||
Reference in New Issue
Block a user