[Editor] Make AssetEditorViewModel.Asset property virtual

C# has covariant return types since version 9
This commit is contained in:
Nicolas Musset 2024-02-29 11:06:01 +01:00
Родитель b0c25e71d1
Коммит 076f32f557
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 5D113F041FA3C820
11 изменённых файлов: 13 добавлений и 26 удалений

Просмотреть файл

@ -80,8 +80,7 @@ namespace Stride.Assets.Presentation.AssetEditors.AssetCompositeGameEditor.ViewM
[NotNull]
public ICommandBase PasteCommand { get; }
[NotNull]
public new AssetCompositeHierarchyViewModel<TAssetPartDesign, TAssetPart> Asset => (AssetCompositeHierarchyViewModel<TAssetPartDesign, TAssetPart>)base.Asset;
public override AssetCompositeHierarchyViewModel<TAssetPartDesign, TAssetPart> Asset => (AssetCompositeHierarchyViewModel<TAssetPartDesign, TAssetPart>)base.Asset;
[NotNull]
protected FuncClipboardMonitor<bool> PasteAsRootMonitor { get; } = new FuncClipboardMonitor<bool>();

Просмотреть файл

@ -151,12 +151,10 @@ namespace Stride.Assets.Presentation.AssetEditors.EntityHierarchyEditor.ViewMode
[NotNull]
public ICommandBase CreatePrefabFromSelectionCommand { get; }
[NotNull]
public new EntityHierarchyViewModel Asset => (EntityHierarchyViewModel)base.Asset;
public override EntityHierarchyViewModel Asset => (EntityHierarchyViewModel)base.Asset;
// TODO: turn private, create a service getter that accepts only IEditorGameViewModelService
[NotNull]
protected internal new EntityHierarchyEditorController Controller => (EntityHierarchyEditorController)base.Controller;
protected internal override EntityHierarchyEditorController Controller => (EntityHierarchyEditorController)base.Controller;
private IEditorGameMaterialHighlightViewModelService MaterialHighlight => Controller.GetService<IEditorGameMaterialHighlightViewModelService>();

Просмотреть файл

@ -1,4 +1,4 @@
// Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp)
// Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp)
// Distributed under the MIT license. See the LICENSE.md file in the project root for more information.
using System;
using System.Threading.Tasks;
@ -51,7 +51,7 @@ namespace Stride.Assets.Presentation.AssetEditors.GameEditor.ViewModels
internal SessionNodeContainer NodeContainer => Session.AssetNodeContainer;
[NotNull]
protected internal IEditorGameController Controller { get; }
protected internal virtual IEditorGameController Controller { get; }
[NotNull]
public ICommandBase CopyErrorToClipboardCommand { get; }

Просмотреть файл

@ -63,7 +63,7 @@ namespace Stride.Assets.Presentation.AssetEditors.GraphicsCompositorEditor.ViewM
RemoveSelectedCameraSlotsCommand = new AnonymousCommand(ServiceProvider, RemoveSelectedCameraSlots);
}
public new GraphicsCompositorViewModel Asset => (GraphicsCompositorViewModel)base.Asset;
public override GraphicsCompositorViewModel Asset => (GraphicsCompositorViewModel)base.Asset;
public ObservableList<RenderStageViewModel> RenderStages { get; } = new ObservableList<RenderStageViewModel>();

Просмотреть файл

@ -4,14 +4,12 @@ using System;
using System.Threading.Tasks;
using Stride.Core.Annotations;
using Stride.Core.Extensions;
using Stride.Assets.Entities;
using Stride.Assets.Presentation.AssetEditors.AssetCompositeGameEditor.ViewModels;
using Stride.Assets.Presentation.AssetEditors.EntityHierarchyEditor;
using Stride.Assets.Presentation.AssetEditors.EntityHierarchyEditor.ViewModels;
using Stride.Assets.Presentation.AssetEditors.GameEditor.Services;
using Stride.Assets.Presentation.AssetEditors.GameEditor.ViewModels;
using Stride.Assets.Presentation.AssetEditors.PrefabEditor.Services;
using Stride.Assets.Presentation.AssetEditors.PrefabEditor.Views;
using Stride.Assets.Presentation.SceneEditor;
using Stride.Assets.Presentation.ViewModel;
using Stride.Core.Assets.Editor.Annotations;
@ -43,11 +41,9 @@ namespace Stride.Assets.Presentation.AssetEditors.PrefabEditor.ViewModels
{
}
[NotNull]
public new PrefabViewModel Asset => (PrefabViewModel)base.Asset;
public override PrefabViewModel Asset => (PrefabViewModel)base.Asset;
[NotNull]
internal new PrefabEditorController Controller => (PrefabEditorController)base.Controller;
protected internal override PrefabEditorController Controller => (PrefabEditorController)base.Controller;
/// <inheritdoc />
protected override AssetCompositeItemViewModel CreateRootPartViewModel()

Просмотреть файл

@ -9,14 +9,12 @@ using Stride.Core.Annotations;
using Stride.Core.Extensions;
using Stride.Core.Threading;
using Stride.Core.Presentation.Collections;
using Stride.Assets.Entities;
using Stride.Assets.Presentation.AssetEditors.AssetCompositeGameEditor.ViewModels;
using Stride.Assets.Presentation.AssetEditors.EntityHierarchyEditor.ViewModels;
using Stride.Assets.Presentation.AssetEditors.GameEditor;
using Stride.Assets.Presentation.AssetEditors.GameEditor.Services;
using Stride.Assets.Presentation.AssetEditors.GameEditor.ViewModels;
using Stride.Assets.Presentation.AssetEditors.SceneEditor.Services;
using Stride.Assets.Presentation.AssetEditors.SceneEditor.Views;
using Stride.Assets.Presentation.SceneEditor;
using Stride.Assets.Presentation.ViewModel;
using Stride.Core.Assets.Editor.Annotations;
@ -57,8 +55,7 @@ namespace Stride.Assets.Presentation.AssetEditors.SceneEditor.ViewModels
mainScene = asset;
}
[NotNull]
public new SceneViewModel Asset => (SceneViewModel)base.Asset;
public override SceneViewModel Asset => (SceneViewModel)base.Asset;
public bool DisplayCameraPreview { get => Preview.IsActive; set { SetValue(Preview.IsActive != value, () => Preview.IsActive = value); } }

Просмотреть файл

@ -29,7 +29,7 @@ namespace Stride.Assets.Presentation.AssetEditors.ScriptEditor
/// <summary>
/// The asset being edited.
/// </summary>
public new ScriptSourceFileAssetViewModel Asset => (ScriptSourceFileAssetViewModel)base.Asset;
public override ScriptSourceFileAssetViewModel Asset => (ScriptSourceFileAssetViewModel)base.Asset;
/// <summary>
/// The code view model that manages roslyn states.

Просмотреть файл

@ -23,7 +23,6 @@ using Stride.Core.Presentation.Interop;
using Stride.Core.Presentation.Quantum;
using Stride.Core.Quantum;
using Stride.Assets.Presentation.AssetEditors.SpriteEditor.Services;
using Stride.Assets.Presentation.AssetEditors.SpriteEditor.Views;
using Stride.Assets.Presentation.ViewModel;
using Stride.Assets.Sprite;
using Stride.Core.Assets.Editor.Annotations;
@ -97,7 +96,7 @@ namespace Stride.Assets.Presentation.AssetEditors.SpriteEditor.ViewModels
spritesNode.ItemChanged += SpritesContentChanged;
}
public new SpriteSheetViewModel Asset => (SpriteSheetViewModel)base.Asset;
public override SpriteSheetViewModel Asset => (SpriteSheetViewModel)base.Asset;
public SpriteSheetType Type { get => typeNodeBinding.Value; set => typeNodeBinding.Value = value; }

Просмотреть файл

@ -166,7 +166,7 @@ namespace Stride.Assets.Presentation.AssetEditors.VisualScriptEditor
public BlockTemplateDescriptionCollectionViewModel BlockTemplateDescriptionCollection => blockTemplateDescriptionCollection.Value;
public new VisualScriptViewModel Asset => (VisualScriptViewModel)base.Asset;
public override VisualScriptViewModel Asset => (VisualScriptViewModel)base.Asset;
public string BaseType { get { return baseTypeNodeBinding.Value; } set { baseTypeNodeBinding.Value = value; } }

Просмотреть файл

@ -39,7 +39,7 @@ namespace Stride.Core.Assets.Editor.ViewModel
public SessionViewModel Session => Asset.Session;
/// <inheritdoc/>
public AssetViewModel Asset { get; }
public virtual AssetViewModel Asset { get; }
/// <inheritdoc/>
public virtual Task EditorInitialized => Task.CompletedTask; // FIXME might not be necessary, but implementing editor might have different initialization logic

Просмотреть файл

@ -6,10 +6,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Stride.Core.Assets;
using Stride.Core.Assets.Editor;
using Stride.Core.Assets.Editor.Annotations;
using Stride.Core.Assets.Editor.Internal;
using Stride.Core.Assets.Editor.Services;
using Stride.Core.Assets.Editor.ViewModel;