Files
UnrealEngineUWP/Engine/Source/Editor/MovieSceneTools/Private/PropertySection.cpp
Ben Marsh 20bf0eb6a1 Updating copyright notices to 2017 (copying from //Tasks/UE4/Dev-Copyright-2017).
#rb none
#lockdown Nick.Penwarden

[CL 3226823 by Ben Marsh in Main branch]
2016-12-08 08:52:44 -05:00

67 lines
1.6 KiB
C++

// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
#include "PropertySection.h"
#include "SequencerSectionPainter.h"
FPropertySection::FPropertySection(UMovieSceneSection& InSectionObject, const FText& InDisplayName)
: DisplayName(InDisplayName)
, SectionObject(InSectionObject)
, Sequencer(nullptr)
{ }
FPropertySection::FPropertySection(ISequencer* InSequencer, FGuid InObjectBinding, FName InPropertyName,
const FString& InPropertyPath, UMovieSceneSection& InSectionObject, const FText& InDisplayName)
: DisplayName(InDisplayName)
, SectionObject(InSectionObject)
, Sequencer(InSequencer)
, ObjectBinding(InObjectBinding)
, PropertyBindings(MakeShareable(new FTrackInstancePropertyBindings(InPropertyName, InPropertyPath)))
{
}
UMovieSceneSection* FPropertySection::GetSectionObject()
{
return &SectionObject;
}
FText FPropertySection::GetDisplayName() const
{
return DisplayName;
}
FText FPropertySection::GetSectionTitle() const
{
return FText::GetEmpty();
}
int32 FPropertySection::OnPaintSection( FSequencerSectionPainter& Painter ) const
{
return Painter.PaintSectionBackground();
}
UProperty* FPropertySection::GetProperty() const
{
if (!PropertyBindings.IsValid())
{
return nullptr;
}
for (const TWeakObjectPtr<UObject>& WeakObject : Sequencer->FindBoundObjects(ObjectBinding, Sequencer->GetFocusedTemplateID()))
{
if (UObject* Object = WeakObject.Get())
{
return PropertyBindings->GetProperty(*Object);
}
}
return nullptr;
}
bool FPropertySection::CanGetPropertyValue() const
{
return Sequencer != nullptr && PropertyBindings.IsValid();
}