SceneEditorSession: stop setting window icon on frame, do it when we edit the editor title which is already in sync (#3529)

Tentatively resolves Facepunch/sbox-issues#9659
This commit is contained in:
Tony Ferguson
2025-12-02 10:24:04 +00:00
committed by GitHub
parent d79f0be41c
commit cd491677a0

View File

@@ -75,11 +75,11 @@ public partial class SceneEditorSession : Scene.ISceneEditorSession
SceneDock = EditorTypeLibrary.Create<Widget>( "SceneDock", new object[] { this } );
SceneDock.Name = $"SceneDock:{(Scene.Source?.ResourcePath ?? "untitled")}";
SetDockProperties();
SceneDock.Parent = EditorWindow;
SceneDock.Visible = true;
UpdateEditorTitle();
Dock();
}
@@ -204,25 +204,6 @@ public partial class SceneEditorSession : Scene.ISceneEditorSession
}
}
[EditorEvent.Frame]
private void SetDockProperties()
{
if ( !SceneDock.IsValid() )
return;
var title = Scene.Name.Trim();
if ( IsPrefabSession )
{
SceneDock.SetWindowIcon( "home_repair_service" );
SceneDock.WindowTitle = $"Prefab: {title}";
}
else
{
SceneDock.SetWindowIcon( "grid_4x4" );
}
}
internal void UpdateEditorTitle()
{
if ( !SceneDock.IsValid() )
@@ -235,8 +216,18 @@ public partial class SceneEditorSession : Scene.ISceneEditorSession
if ( SceneDock is not null )
{
SceneDock.WindowTitle = name;
SceneDock.Name = $"SceneDock:{(Scene.Source?.ResourcePath ?? "untitled")}";
if ( IsPrefabSession )
{
SceneDock.SetWindowIcon( "home_repair_service" );
SceneDock.WindowTitle = $"Prefab: {name}";
}
else
{
SceneDock.SetWindowIcon( "grid_4x4" );
SceneDock.WindowTitle = name;
}
}
}