Merge branch 'FlaxEngine:master' into flax-msdf-font

This commit is contained in:
fibref
2026-02-16 22:48:19 +08:00
committed by GitHub
185 changed files with 3363 additions and 1242 deletions

View File

@@ -99,7 +99,14 @@ namespace FlaxEditor.Windows.Assets
Window = window;
var surfaceParam = window.Surface.GetParameter(BaseModelId);
if (surfaceParam != null)
BaseModel = FlaxEngine.Content.LoadAsync<SkinnedModel>((Guid)surfaceParam.Value);
{
if (surfaceParam.Value is Guid asGuid)
BaseModel = FlaxEngine.Content.LoadAsync<SkinnedModel>(asGuid);
else if (surfaceParam.Value is SkinnedModel asModel)
BaseModel = asModel;
else
BaseModel = null;
}
else
BaseModel = window.PreviewActor.GetParameterValue(BaseModelId) as SkinnedModel;
}

View File

@@ -2,7 +2,6 @@
using System;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Xml;
using FlaxEditor.Content;
@@ -25,7 +24,7 @@ namespace FlaxEditor.Windows.Assets
/// </summary>
/// <seealso cref="Animation" />
/// <seealso cref="FlaxEditor.Windows.Assets.AssetEditorWindow" />
public sealed class AnimationWindow : AssetEditorWindowBase<Animation>
public sealed class AnimationWindow : ClonedAssetEditorWindowBase<Animation>
{
private sealed class Preview : AnimationPreview
{
@@ -255,6 +254,7 @@ namespace FlaxEditor.Windows.Assets
private bool _isWaitingForTimelineLoad;
private SkinnedModel _initialPreviewModel, _initialBaseModel;
private float _initialPanel2Splitter = 0.6f;
private bool _timelineIsDirty;
/// <summary>
/// Gets the animation timeline editor.
@@ -295,7 +295,7 @@ namespace FlaxEditor.Windows.Assets
Parent = _panel1.Panel1,
Enabled = false
};
_timeline.Modified += MarkAsEdited;
_timeline.Modified += OnTimelineModified;
_timeline.SetNoTracksText("Loading...");
// Asset properties
@@ -321,11 +321,31 @@ namespace FlaxEditor.Windows.Assets
{
MarkAsEdited();
UpdateToolstrip();
_propertiesPresenter.BuildLayout();
}
private void OnTimelineModified()
{
_timelineIsDirty = true;
MarkAsEdited();
}
private bool RefreshTempAsset()
{
if (_asset == null || _isWaitingForTimelineLoad)
return true;
if (_timeline.IsModified)
{
_timeline.Save(_asset);
}
_propertiesPresenter.BuildLayoutOnUpdate();
return false;
}
private string GetPreviewModelCacheName()
{
return _asset.ID + ".PreviewModel";
return _item.ID + ".PreviewModel";
}
/// <inheritdoc />
@@ -361,7 +381,11 @@ namespace FlaxEditor.Windows.Assets
if (!IsEdited)
return;
_timeline.Save(_asset);
if (RefreshTempAsset())
return;
if (SaveToOriginal())
return;
ClearEditedFlag();
_item.RefreshThumbnail();
}
@@ -414,10 +438,18 @@ namespace FlaxEditor.Windows.Assets
{
base.Update(deltaTime);
// Check if temporary asset need to be updated
if (_timelineIsDirty)
{
_timelineIsDirty = false;
RefreshTempAsset();
}
// Check if need to load timeline
if (_isWaitingForTimelineLoad && _asset.IsLoaded)
{
_isWaitingForTimelineLoad = false;
_timeline._id = _asset.ID;
_timeline._id = _item.ID;
_timeline.Load(_asset);
_undo.Clear();
_timeline.Enabled = true;

View File

@@ -70,6 +70,13 @@ namespace FlaxEditor.Windows.Assets
return;
var nodes = proxy.Asset.Nodes;
var bones = proxy.Asset.Bones;
var blendShapes = proxy.Asset.BlendShapes;
// Info
{
var group = layout.Group("Info");
group.Label($"Nodes: {nodes.Length}\nBones: {bones.Length}\nBlend Shapes: {blendShapes.Length}").AddCopyContextMenu().Label.Height *= 2.5f;
}
// Skeleton Bones
{
@@ -109,7 +116,6 @@ namespace FlaxEditor.Windows.Assets
}
// Blend Shapes
var blendShapes = proxy.Asset.BlendShapes;
if (blendShapes.Length != 0)
{
var group = layout.Group("Blend Shapes");

View File

@@ -429,6 +429,7 @@ namespace FlaxEditor.Windows
writer.WriteAttributeString("FarPlane", Viewport.FarPlane.ToString());
writer.WriteAttributeString("FieldOfView", Viewport.FieldOfView.ToString());
writer.WriteAttributeString("MovementSpeed", Viewport.MovementSpeed.ToString());
writer.WriteAttributeString("ViewportIconsScale", ViewportIconsRenderer.Scale.ToString());
writer.WriteAttributeString("OrthographicScale", Viewport.OrthographicScale.ToString());
writer.WriteAttributeString("UseOrthographicProjection", Viewport.UseOrthographicProjection.ToString());
writer.WriteAttributeString("ViewFlags", ((ulong)Viewport.Task.View.Flags).ToString());
@@ -439,31 +440,24 @@ namespace FlaxEditor.Windows
{
if (bool.TryParse(node.GetAttribute("GridEnabled"), out bool value1))
Viewport.Grid.Enabled = value1;
if (bool.TryParse(node.GetAttribute("ShowFpsCounter"), out value1))
Viewport.ShowFpsCounter = value1;
if (bool.TryParse(node.GetAttribute("ShowNavigation"), out value1))
Viewport.ShowNavigation = value1;
if (float.TryParse(node.GetAttribute("NearPlane"), out float value2))
Viewport.NearPlane = value2;
if (float.TryParse(node.GetAttribute("FarPlane"), out value2))
Viewport.FarPlane = value2;
if (float.TryParse(node.GetAttribute("FieldOfView"), out value2))
Viewport.FieldOfView = value2;
if (float.TryParse(node.GetAttribute("MovementSpeed"), out value2))
Viewport.MovementSpeed = value2;
if (float.TryParse(node.GetAttribute("ViewportIconsScale"), out value2))
ViewportIconsRenderer.Scale = value2;
if (float.TryParse(node.GetAttribute("OrthographicScale"), out value2))
Viewport.OrthographicScale = value2;
if (bool.TryParse(node.GetAttribute("UseOrthographicProjection"), out value1))
Viewport.UseOrthographicProjection = value1;
if (ulong.TryParse(node.GetAttribute("ViewFlags"), out ulong value3))
Viewport.Task.ViewFlags = (ViewFlags)value3;