Minor fixes

This commit is contained in:
Wojtek Figat
2026-03-28 15:13:52 +01:00
parent 76378156f7
commit 095f7277e2
4 changed files with 17 additions and 12 deletions

View File

@@ -55,9 +55,8 @@ namespace FlaxEditor.CustomEditors.Dedicated
{
// TODO: consider editing more than one instance of the same prefab asset at once
var prefab = FlaxEngine.Content.LoadAsync<Prefab>(actor.PrefabID);
// TODO: don't stall here?
if (prefab && !prefab.WaitForLoaded())
var prefab = FlaxEngine.Content.Load<Prefab>(actor.PrefabID);
if (prefab)
{
var prefabObjectId = actor.PrefabObjectID;
var prefabInstance = prefab.GetDefaultInstance(ref prefabObjectId);

View File

@@ -14,6 +14,7 @@ namespace FlaxEditor.Windows
private void OnTreeSelectionChanged(List<TreeNode> from, List<TreeNode> to)
{
bool setLastViewFolder = !IsLayoutLocked;
if (!_showAllContentInTree && to.Count > 1)
{
_tree.Select(to[^1]);
@@ -21,11 +22,14 @@ namespace FlaxEditor.Windows
}
if (_showAllContentInTree && to.Count > 1)
{
var activeNode = GetActiveTreeSelection(to);
if (activeNode is ContentItemTreeNode itemNode)
SaveLastViewedFolder(itemNode.Item?.ParentFolder?.Node);
else
SaveLastViewedFolder(activeNode as ContentFolderTreeNode);
if (setLastViewFolder)
{
var activeNode = GetActiveTreeSelection(to);
if (activeNode is ContentItemTreeNode itemNode)
SaveLastViewedFolder(itemNode.Item?.ParentFolder?.Node);
else
SaveLastViewedFolder(activeNode as ContentFolderTreeNode);
}
UpdateUI();
return;
}
@@ -35,7 +39,8 @@ namespace FlaxEditor.Windows
var targetNode = GetActiveTreeSelection(to);
if (targetNode is ContentItemTreeNode itemNode2)
{
SaveLastViewedFolder(itemNode2.Item?.ParentFolder?.Node);
if (setLastViewFolder)
SaveLastViewedFolder(itemNode2.Item?.ParentFolder?.Node);
UpdateUI();
itemNode2.Focus();
return;
@@ -44,7 +49,8 @@ namespace FlaxEditor.Windows
var target = targetNode as ContentFolderTreeNode;
Navigate(source, target);
SaveLastViewedFolder(target);
if (setLastViewFolder)
SaveLastViewedFolder(target);
target?.Focus();
}

View File

@@ -1227,8 +1227,6 @@ namespace FlaxEditor.Windows
UpdateItemsSearch();
else
RefreshView(SelectedNode);
return;
}
/// <summary>

View File

@@ -60,12 +60,14 @@ public:
/// <summary>
/// Requests the default prefab object instance. Deserializes the prefab objects from the asset. Skips if already done.
/// </summary>
/// <remarks>Default instances of the prefab are read-only and are used internally for objects serialization (prefab diff).</remarks>
/// <returns>The root of the prefab object loaded from the prefab. Contains the default values. It's not added to gameplay but deserialized with postLoad and init event fired.</returns>
API_FUNCTION() Actor* GetDefaultInstance();
/// <summary>
/// Requests the default prefab object instance. Deserializes the prefab objects from the asset. Skips if already done.
/// </summary>
/// <remarks>Default instances of the prefab are read-only and are used internally for objects serialization (prefab diff).</remarks>
/// <param name="objectId">The ID of the object to get from prefab default object. It can be one of the child-actors or any script that exists in the prefab. Methods returns root if id is empty.</param>
/// <returns>The object of the prefab loaded from the prefab. Contains the default values. It's not added to gameplay but deserialized with postLoad and init event fired.</returns>
API_FUNCTION() SceneObject* GetDefaultInstance(API_PARAM(Ref) const Guid& objectId);