stride icon indicating copy to clipboard operation
stride copied to clipboard

Scene.Name = asset name by default

Open RedKorshun opened this issue 1 year ago • 1 comments

Is your feature request related to a problem? Please describe. I'm always frustrated when look at the scenes while debugging and always see "Scene Scene" value. This makes hard to determine which scene is which.

Describe the solution you'd like Set scene's "Name" property to the appropriate asset name by default.

Describe alternatives you've considered Allow to edit scene's "Name" property like it's already done for entities, but I'm afraid of possible side effects like broken link between the real asset and the added scene to the "Asset editor". It also may not be a problem, I don't really know.

Additional context SceneNameIssue RootScene's "Name" should be "RootScene", not "Scene" and debug view for the scene will be automatically updated to "Scene RootScene" instead of "Scene Scene".

Unfortunatelly I'm not familiar with the Game Studio source code, so I don't know how to implement the idea.

RedKorshun avatar Jul 24 '22 02:07 RedKorshun

For some reason I can't check if the following changes works, but I hope my investigation will help someone who can:

  1. SceneAssetCompiler.SceneCommand class contains a method DoCommandOverride that creates a Scene from the SceneAsset and then saves it to the ContentManager. We can try to add something like Name = Parameters.MainSource.GetFileNameWithoutExtension(), to the Scene instance initialization (right after the Offset property). Full code:
var scene = new Scene
{
    Parent = Parameters.Parent,
    Offset = Parameters.Offset,
    Name = Parameters.MainSource.GetFileNameWithoutExtension(), // <-- Added code
};
  1. SceneSystem has a code to initialize SceneInstance:
SceneInstance ??= new SceneInstance(Services) { RootScene = new Scene() };

This code can be updated in next way:

SceneInstance ??= new SceneInstance(Services) { RootScene = new Scene { Name = nameof(SceneInstance.RootScene) } };

RedKorshun avatar Aug 09 '22 06:08 RedKorshun