Small codestyle tweaks

#2415
This commit is contained in:
Wojtek Figat
2024-09-11 13:38:31 +02:00
parent 1bc09fb962
commit 4683262cf3
4 changed files with 29 additions and 38 deletions

View File

@@ -1,7 +1,6 @@
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
using System;
using System.IO;
using FlaxEditor.Content.Create;
using FlaxEditor.Content.Thumbnails;
using FlaxEditor.Viewport.Previews;
@@ -9,7 +8,6 @@ using FlaxEditor.Windows;
using FlaxEditor.Windows.Assets;
using FlaxEngine;
using FlaxEngine.GUI;
using Object = FlaxEngine.Object;
namespace FlaxEditor.Content
{
@@ -87,6 +85,7 @@ namespace FlaxEditor.Content
/// <inheritdoc />
public override void Create(string outputPath, object arg)
{
bool resetTransform = false;
var transform = Transform.Identity;
if (!(arg is Actor actor))
{
@@ -96,12 +95,14 @@ namespace FlaxEditor.Content
else if (actor.HasScene)
{
// Create prefab with identity transform so the actor instance on a level will have it customized
resetTransform = true;
transform = actor.LocalTransform;
actor.LocalTransform = Transform.Identity;
}
PrefabManager.CreatePrefab(actor, outputPath, true);
actor.LocalTransform = transform;
if (resetTransform)
actor.LocalTransform = transform;
}
/// <inheritdoc />

View File

@@ -71,13 +71,15 @@ namespace FlaxEditor.Content
private static void OnAnimationGraphCreated(ContentItem item, BinaryAssetItem skinnedModelItem)
{
var skinnedModel = FlaxEngine.Content.LoadAsync<SkinnedModel>(skinnedModelItem.ID);
if (skinnedModel == null || skinnedModel.WaitForLoaded())
var skinnedModel = FlaxEngine.Content.Load<SkinnedModel>(skinnedModelItem.ID);
if (skinnedModel == null)
{
Editor.LogError("Failed to load base skinned model.");
return;
}
// Hack the animation graph window to modify the base model of the animation graph.
// TODO: implement it without window logic (load AnimGraphSurface and set AnimationGraphWindow.BaseModelId to model)
AnimationGraphWindow win = new AnimationGraphWindow(Editor.Instance, item as AssetItem);
win.Show();