Fix skins not being displayed correctly in the editor (#6426)

Fix skins not being displayed correctly in the editor

Co-authored-by: Dan Balasescu <smoogipoo@smgi.me>
This commit is contained in:
Dean Herbert 2019-10-08 14:10:48 +09:00 committed by GitHub
commit d5aca57b08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 2 deletions

View File

@ -11,6 +11,7 @@
using osu.Game.Rulesets.Edit;
using osu.Game.Screens.Edit.Compose.Components;
using osu.Game.Screens.Edit.Compose.Components.Timeline;
using osu.Game.Skinning;
using osuTK.Graphics;
namespace osu.Game.Screens.Edit.Compose
@ -115,7 +116,17 @@ private void load([CanBeNull] BindableBeatDivisor beatDivisor)
return;
}
composerContainer.Child = composer;
var beatmapSkinProvider = new BeatmapSkinProvidingContainer(Beatmap.Value.Skin);
// the beatmapSkinProvider is used as the fallback source here to allow the ruleset-specific skin implementation
// full access to all skin sources.
var rulesetSkinProvider = new SkinProvidingContainer(ruleset.CreateLegacySkinProvider(beatmapSkinProvider));
// load the skinning hierarchy first.
// this is intentionally done in two stages to ensure things are in a loaded state before exposing the ruleset to skin sources.
composerContainer.Add(
beatmapSkinProvider.WithChild(
rulesetSkinProvider.WithChild(composer)));
}
}
}

View File

@ -53,7 +53,7 @@ public Texture GetTexture(string componentName)
if (AllowTextureLookup(componentName) && (sourceTexture = skin?.GetTexture(componentName)) != null)
return sourceTexture;
return fallbackSource.GetTexture(componentName);
return fallbackSource?.GetTexture(componentName);
}
public SampleChannel GetSample(ISampleInfo sampleInfo)