Use actual BeatmapInfo rather than PlayableBeatmap.BeatmapInfo for editor writes

This commit is contained in:
Dean Herbert
2021-10-13 14:34:31 +09:00
parent 3445d915b9
commit 02689a1b60
4 changed files with 20 additions and 8 deletions

View File

@ -162,7 +162,7 @@ namespace osu.Game.Screens.Edit
// todo: remove caching of this and consume via editorBeatmap?
dependencies.Cache(beatDivisor);
AddInternal(editorBeatmap = new EditorBeatmap(playableBeatmap, loadableBeatmap.GetSkin()));
AddInternal(editorBeatmap = new EditorBeatmap(playableBeatmap, loadableBeatmap.GetSkin(), loadableBeatmap.BeatmapInfo));
dependencies.CacheAs(editorBeatmap);
changeHandler = new EditorChangeHandler(editorBeatmap);
dependencies.CacheAs<IEditorChangeHandler>(changeHandler);
@ -333,10 +333,10 @@ namespace osu.Game.Screens.Edit
isNewBeatmap = false;
// apply any set-level metadata changes.
beatmapManager.Update(playableBeatmap.BeatmapInfo.BeatmapSet);
beatmapManager.Update(editorBeatmap.BeatmapInfo.BeatmapSet);
// save the loaded beatmap's data stream.
beatmapManager.Save(playableBeatmap.BeatmapInfo, editorBeatmap, editorBeatmap.BeatmapSkin);
beatmapManager.Save(editorBeatmap.BeatmapInfo, editorBeatmap.PlayableBeatmap, editorBeatmap.BeatmapSkin);
updateLastSavedHash();
}

View File

@ -44,6 +44,7 @@ namespace osu.Game.Screens.Edit
/// </summary>
public readonly Bindable<HitObject> PlacementObject = new Bindable<HitObject>();
private readonly BeatmapInfo beatmapInfo;
public readonly IBeatmap PlayableBeatmap;
/// <summary>
@ -66,9 +67,12 @@ namespace osu.Game.Screens.Edit
private readonly Dictionary<HitObject, Bindable<double>> startTimeBindables = new Dictionary<HitObject, Bindable<double>>();
public EditorBeatmap(IBeatmap playableBeatmap, ISkin beatmapSkin = null)
public EditorBeatmap(IBeatmap playableBeatmap, ISkin beatmapSkin = null, BeatmapInfo beatmapInfo = null)
{
PlayableBeatmap = playableBeatmap;
this.beatmapInfo = beatmapInfo ?? playableBeatmap.BeatmapInfo;
if (beatmapSkin is Skin skin)
BeatmapSkin = new EditorBeatmapSkin(skin);
@ -80,11 +84,11 @@ namespace osu.Game.Screens.Edit
public BeatmapInfo BeatmapInfo
{
get => PlayableBeatmap.BeatmapInfo;
set => PlayableBeatmap.BeatmapInfo = value;
get => beatmapInfo;
set => throw new InvalidOperationException();
}
public BeatmapMetadata Metadata => PlayableBeatmap.Metadata;
public BeatmapMetadata Metadata => beatmapInfo.Metadata;
public BeatmapDifficulty Difficulty
{