LifePlay-Revival/Plugins/StreetMap/Source/StreetMapImporting/StreetMapStyle.cpp
edujiro5972 1122e17fa6 L0 : etat initial du projet 5.5 avant toute correction
Instantane de reference de la reprise de migration (2026-09-29).
Contient GI.uasset tel que trouve (copie UE4 identique a 4.27,
MD5 F4550DA5DC05FC005400CDCA2FC123C9). Ajouts de ce commit :
.gitattributes (aucune conversion de fin de ligne), regles .gitignore
CHG-001, Tools/ (Snapshot, Restore, AssetHeaders), empreintes L0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 00:56:10 +02:00

56 lines
No EOL
1.9 KiB
C++

#include "StreetMapStyle.h"
#include "Styling/SlateStyle.h"
#include "Styling/SlateStyleRegistry.h"
#include "Interfaces/IPluginManager.h"
#define IMAGE_BRUSH( RelativePath, ... ) FSlateImageBrush( FStreetMapStyle::InContent( RelativePath, ".png" ), __VA_ARGS__ )
FString FStreetMapStyle::InContent(const FString& RelativePath, const ANSICHAR* Extension)
{
static FString IconsDir = IPluginManager::Get().FindPlugin(TEXT("StreetMap"))->GetContentDir() / TEXT("Icons");
return (IconsDir / RelativePath) + Extension;
}
TSharedPtr< FSlateStyleSet > FStreetMapStyle::StyleSet = nullptr;
TSharedPtr< class ISlateStyle > FStreetMapStyle::Get() { return StyleSet; }
void FStreetMapStyle::Initialize()
{
// Const icon & thumbnail sizes
const FVector2D Icon16x16(16.0f, 16.0f);
const FVector2D Icon128x128(128.0f, 128.0f);
// Only register once
if (StyleSet.IsValid())
{
return;
}
StyleSet = MakeShareable(new FSlateStyleSet("StreetMapStyle"));
FString ContentDir = IPluginManager::Get().FindPlugin(TEXT("StreetMap"))->GetContentDir();
StyleSet->SetContentRoot(ContentDir);
StyleSet->Set("ClassIcon.StreetMap", new IMAGE_BRUSH("sm_asset_icon_32", Icon16x16));
StyleSet->Set("ClassThumbnail.StreetMap", new IMAGE_BRUSH("sm_asset_icon_128", Icon128x128));
StyleSet->Set("ClassIcon.StreetMapActor", new IMAGE_BRUSH("sm_actor_icon_32", Icon16x16));
StyleSet->Set("ClassThumbnail.StreetMapActor", new IMAGE_BRUSH("sm_actor_icon_128", Icon128x128));
StyleSet->Set("ClassIcon.StreetMapComponent", new IMAGE_BRUSH("sm_component_icon_32", Icon16x16));
StyleSet->Set("ClassThumbnail.StreetMapComponent", new IMAGE_BRUSH("sm_component_icon_128", Icon128x128));
FSlateStyleRegistry::RegisterSlateStyle(*StyleSet.Get());
};
#undef IMAGE_BRUSH
void FStreetMapStyle::Shutdown()
{
if (StyleSet.IsValid())
{
FSlateStyleRegistry::UnRegisterSlateStyle(*StyleSet.Get());
ensure(StyleSet.IsUnique());
StyleSet.Reset();
}
}