Users project recursively generates UIs, which leads to extremely long resource names. Eventually, assigning such a name to a brush results in an assertion being triggered, as the name is too long. Fixed on our end by creating a custom resource name instead of reusing the name of the material. User still has to clean-up their code.
This commit is contained in:
badlogic 2021-12-23 17:04:57 +01:00
parent 7400da8896
commit d065c88ca8

View File

@ -45,12 +45,17 @@
using namespace spine;
static int brushNameId = 0;
// Workaround for https://github.com/EsotericSoftware/spine-runtimes/issues/1458
// See issue comments for more information.
struct SpineSlateMaterialBrush : public FSlateBrush {
SpineSlateMaterialBrush(class UMaterialInterface &InMaterial, const FVector2D &InImageSize)
: FSlateBrush(ESlateBrushDrawType::Image, FName(TEXT("None")), FMargin(0), ESlateBrushTileType::NoTile, ESlateBrushImageType::FullColor, InImageSize, FLinearColor::White, &InMaterial) {
ResourceName = FName(*InMaterial.GetFullName());
// Workaround for https://github.com/EsotericSoftware/spine-runtimes/issues/2006
FString brushName = TEXT("spineslatebrush");
brushName.AppendInt(brushNameId++);
ResourceName = FName(brushName);
}
};