You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
UETOOL-213 - Minimize Slate FString -> FText conversion (remove SLATE_TEXT_ATTRIBUTE) This fixes any editor/engine specific code that was passing text to Slate as FString rather than FText. [CL 2399803 by Jamie Dale in Main branch]
96 lines
1.7 KiB
C++
96 lines
1.7 KiB
C++
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "LayersPrivatePCH.h"
|
|
#include "Layers/Layer.h"
|
|
#include "ScopedTransaction.h"
|
|
|
|
#define LOCTEXT_NAMESPACE "Layer"
|
|
|
|
|
|
FActorLayerViewModel::FActorLayerViewModel( const TWeakObjectPtr< ULayer >& InLayer, const TArray< TWeakObjectPtr< AActor > >& InActors, const TSharedRef< ILayers >& InWorldLayers, const TWeakObjectPtr< UEditorEngine >& InEditor )
|
|
: WorldLayers( InWorldLayers )
|
|
, Editor( InEditor )
|
|
, Layer( InLayer )
|
|
{
|
|
Actors.Append( InActors );
|
|
}
|
|
|
|
|
|
void FActorLayerViewModel::Initialize()
|
|
{
|
|
WorldLayers->OnLayersChanged().AddSP( this, &FActorLayerViewModel::OnLayersChanged );
|
|
|
|
if ( Editor.IsValid() )
|
|
{
|
|
Editor->RegisterForUndo(this);
|
|
}
|
|
}
|
|
|
|
|
|
FActorLayerViewModel::~FActorLayerViewModel()
|
|
{
|
|
WorldLayers->OnLayersChanged().RemoveAll( this );
|
|
|
|
if ( Editor.IsValid() )
|
|
{
|
|
Editor->UnregisterForUndo(this);
|
|
}
|
|
}
|
|
|
|
|
|
FName FActorLayerViewModel::GetFName() const
|
|
{
|
|
if( !Layer.IsValid() )
|
|
{
|
|
return NAME_None;
|
|
}
|
|
|
|
return Layer->LayerName;
|
|
}
|
|
|
|
|
|
FText FActorLayerViewModel::GetName() const
|
|
{
|
|
if( !Layer.IsValid() )
|
|
{
|
|
return LOCTEXT("Invalid layer Name", "");
|
|
}
|
|
|
|
return FText::FromName(Layer->LayerName);
|
|
}
|
|
|
|
|
|
bool FActorLayerViewModel::IsVisible() const
|
|
{
|
|
if( !Layer.IsValid() )
|
|
{
|
|
return false;
|
|
}
|
|
|
|
return Layer->bIsVisible;
|
|
}
|
|
|
|
|
|
void FActorLayerViewModel::OnLayersChanged( const ELayersAction::Type Action, const TWeakObjectPtr< ULayer >& ChangedLayer, const FName& ChangedProperty )
|
|
{
|
|
if( Action != ELayersAction::Modify && Action != ELayersAction::Reset )
|
|
{
|
|
return;
|
|
}
|
|
|
|
if( ChangedLayer.IsValid() && ChangedLayer != Layer )
|
|
{
|
|
return;
|
|
}
|
|
|
|
Changed.Broadcast();
|
|
}
|
|
|
|
|
|
void FActorLayerViewModel::Refresh()
|
|
{
|
|
OnLayersChanged( ELayersAction::Reset, NULL, NAME_None );
|
|
}
|
|
|
|
|
|
#undef LOCTEXT_NAMESPACE |