You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Introduces the concept of "Active Ticking" to allow Slate to go to sleep when there is no need to update the UI.
While asleep, Slate will skip the Tick & Paint pass for that frame entirely.
- There are TWO ways to "wake" Slate and cause a Tick/Paint pass:
1. Provide some sort of input (mouse movement, clicks, and key presses). Slate will always tick when the user is active.
- Therefore, if the logic in a given widget's Tick is only relevant in response to user action, there is no need to register an active tick.
2. Register an Active Tick. Currently this is an all-or-nothing situation, so if a single active tick needs to execute, all of Slate will be ticked.
- The purpose of an Active Tick is to allow a widget to "drive" Slate and guarantee a Tick/Paint pass in the absence of any user action.
- Examples include animation, async operations that update periodically, progress updates, loading bars, etc.
- An empty active tick is registered for viewports when they are real-time, so game project widgets are unaffected by this change and should continue to work as before.
- An Active Tick is registered by creating an FWidgetActiveTickDelegate and passing it to SWidget::RegisterActiveTick()
- There are THREE ways to unregister an active tick:
1. Return EActiveTickReturnType::StopTicking from the active tick function
2. Pass the FActiveTickHandle returned by RegisterActiveTick() to SWidget::UnregisterActiveTick()
3. Destroy the widget responsible for the active tick
- Sleeping is currently disabled, can be enabled with Slate.AllowSlateToSleep cvar
- There is currently a little buffer time during which Slate continues to tick following any input. Long-term, this is planned to be removed.
- The duration of the buffer can be adjusted using Slate.SleepBufferPostInput cvar (defaults to 1.0f)
- The FCurveSequence API has been updated to work with the active tick system
- Playing a curve sequence now requires that you pass the widget being animated by the sequence
- The active tick will automatically be registered on behalf of the widget and unregister when the sequence is complete
- GetLerpLooping() has been removed. Instead, pass true as the second param to Play() to indicate that the animation will loop. This causes the active tick to be registered indefinitely until paused or jumped to the start/end.
[CL 2391669 by Dan Hertzka in Main branch]
208 lines
6.0 KiB
C++
208 lines
6.0 KiB
C++
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "DeviceManagerPrivatePCH.h"
|
|
#include "SExpandableArea.h"
|
|
|
|
|
|
#define LOCTEXT_NAMESPACE "SDeviceBrowser"
|
|
|
|
|
|
/* SDeviceBrowser interface
|
|
*****************************************************************************/
|
|
|
|
BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION
|
|
void SDeviceBrowser::Construct( const FArguments& InArgs, const FDeviceManagerModelRef& InModel, const ITargetDeviceServiceManagerRef& InDeviceServiceManager, const TSharedPtr<FUICommandList>& InUICommandList )
|
|
{
|
|
DeviceServiceManager = InDeviceServiceManager;
|
|
Filter = MakeShareable(new FDeviceBrowserFilter());
|
|
Model = InModel;
|
|
NeedsServiceListRefresh = true;
|
|
UICommandList = InUICommandList;
|
|
|
|
ChildSlot
|
|
[
|
|
SNew(SVerticalBox)
|
|
|
|
+ SVerticalBox::Slot()
|
|
.AutoHeight()
|
|
[
|
|
/*
|
|
SNew(SExpandableArea)
|
|
.AreaTitle(LOCTEXT("FilterBarAreaTitle", "Device Filter").ToString())
|
|
.InitiallyCollapsed(true)
|
|
.Padding(FMargin(8.0f, 8.0f, 8.0f, 4.0f))
|
|
.BodyContent()
|
|
[*/
|
|
// filter bar
|
|
SNew(SDeviceBrowserFilterBar, Filter.ToSharedRef())
|
|
//]
|
|
]
|
|
|
|
+ SVerticalBox::Slot()
|
|
.FillHeight(1.0f)
|
|
.Padding(0.0f, 4.0f, 0.0f, 0.0f)
|
|
[
|
|
SNew(SBorder)
|
|
.BorderImage(FEditorStyle::GetBrush("ToolPanel.GroupBorder"))
|
|
.Padding(0.0f)
|
|
[
|
|
// device list
|
|
SAssignNew(DeviceServiceListView, SListView<ITargetDeviceServicePtr>)
|
|
.ItemHeight(20.0f)
|
|
.ListItemsSource(&DeviceServiceList)
|
|
.OnContextMenuOpening(this, &SDeviceBrowser::HandleDeviceServiceListViewContextMenuOpening)
|
|
.OnGenerateRow(this, &SDeviceBrowser::HandleDeviceServiceListViewGenerateRow)
|
|
.OnSelectionChanged(this, &SDeviceBrowser::HandleDeviceServiceListViewSelectionChanged)
|
|
.SelectionMode(ESelectionMode::Single)
|
|
.HeaderRow
|
|
(
|
|
SNew(SHeaderRow)
|
|
|
|
+ SHeaderRow::Column("Icon")
|
|
.DefaultLabel( FText::FromString(TEXT(" ")) )
|
|
.FixedWidth(32.0f)
|
|
|
|
+ SHeaderRow::Column("Name")
|
|
.DefaultLabel(LOCTEXT("DevicesListNameColumnHeader", "Device"))
|
|
|
|
+ SHeaderRow::Column("Platform")
|
|
.DefaultLabel(LOCTEXT("DevicesListPlatformColumnHeader", "Platform"))
|
|
|
|
+ SHeaderRow::Column("Status")
|
|
.DefaultLabel(LOCTEXT("DevicesListStatusColumnHeader", "Status"))
|
|
.FixedWidth(128.0f)
|
|
|
|
+ SHeaderRow::Column("Claimed")
|
|
.DefaultLabel(LOCTEXT("DevicesListClaimedColumnHeader", "Claimed By"))
|
|
|
|
+ SHeaderRow::Column("Share")
|
|
.DefaultLabel(LOCTEXT("DevicesListShareColumnHeader", "Share"))
|
|
.FixedWidth(48.0f)
|
|
.HAlignCell(HAlign_Center)
|
|
.HAlignHeader(HAlign_Center)
|
|
)
|
|
]
|
|
]
|
|
|
|
+ SVerticalBox::Slot()
|
|
.AutoHeight()
|
|
.Padding(0.0f, 4.0f, 0.0f, 0.0f)
|
|
[
|
|
SNew(SExpandableArea)
|
|
.AreaTitle(LOCTEXT("DeviceAdderAreaTitle", "Add An Unlisted Device"))
|
|
.InitiallyCollapsed(true)
|
|
.Padding(FMargin(8.0f, 8.0f, 8.0f, 4.0f))
|
|
.BodyContent()
|
|
[
|
|
// device adder
|
|
SNew(SDeviceBrowserDeviceAdder, InDeviceServiceManager)
|
|
]
|
|
]
|
|
];
|
|
|
|
DeviceServiceManager->OnServiceAdded().AddSP(this, &SDeviceBrowser::HandleDeviceServiceManagerServiceAdded);
|
|
DeviceServiceManager->OnServiceRemoved().AddSP(this, &SDeviceBrowser::HandleDeviceServiceManagerServiceRemoved);
|
|
|
|
Filter->OnFilterChanged().AddSP(this, &SDeviceBrowser::HandleFilterChanged);
|
|
}
|
|
void SDeviceBrowser::Tick( const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime )
|
|
{
|
|
//@TODO Passive - Only happens in response to the addition or removal of a device to the device service manager
|
|
if (NeedsServiceListRefresh)
|
|
{
|
|
ReloadDeviceServiceList(true);
|
|
NeedsServiceListRefresh = false;
|
|
}
|
|
}
|
|
|
|
|
|
/* SDeviceBrowser callbacks
|
|
*****************************************************************************/
|
|
|
|
void SDeviceBrowser::ReloadDeviceServiceList( bool FullyReload )
|
|
{
|
|
// reload target device service list
|
|
if (FullyReload)
|
|
{
|
|
AvailableDeviceServices.Reset();
|
|
|
|
DeviceServiceManager->GetServices(AvailableDeviceServices);
|
|
Filter->ResetFilter(AvailableDeviceServices);
|
|
}
|
|
|
|
// filter target device service list
|
|
DeviceServiceList.Reset();
|
|
|
|
for (int32 DeviceServiceIndex = 0; DeviceServiceIndex < AvailableDeviceServices.Num(); ++DeviceServiceIndex)
|
|
{
|
|
const ITargetDeviceServicePtr& DeviceService = AvailableDeviceServices[DeviceServiceIndex];
|
|
|
|
if (Filter->FilterDeviceService(DeviceService.ToSharedRef()))
|
|
{
|
|
DeviceServiceList.Add(DeviceService);
|
|
}
|
|
}
|
|
|
|
// refresh list view
|
|
DeviceServiceListView->RequestListRefresh();
|
|
}
|
|
|
|
|
|
/* SDeviceBrowser callbacks
|
|
*****************************************************************************/
|
|
|
|
|
|
TSharedPtr<SWidget> SDeviceBrowser::HandleDeviceServiceListViewContextMenuOpening( )
|
|
{
|
|
TArray<ITargetDeviceServicePtr> SelectedDeviceServices = DeviceServiceListView->GetSelectedItems();
|
|
|
|
if (SelectedDeviceServices.Num() > 0)
|
|
{
|
|
return SNew(SDeviceBrowserContextMenu, UICommandList);
|
|
}
|
|
|
|
return NULL;
|
|
}
|
|
|
|
|
|
TSharedRef<ITableRow> SDeviceBrowser::HandleDeviceServiceListViewGenerateRow( ITargetDeviceServicePtr DeviceService, const TSharedRef<STableViewBase>& OwnerTable )
|
|
{
|
|
return SNew(SDeviceBrowserDeviceListRow, OwnerTable)
|
|
.DeviceService(DeviceService)
|
|
.HighlightText(this, &SDeviceBrowser::HandleDeviceServiceListViewHighlightText)
|
|
.ToolTip(SNew(SDeviceBrowserTooltip, DeviceService.ToSharedRef()));
|
|
}
|
|
|
|
|
|
void SDeviceBrowser::HandleDeviceServiceListViewSelectionChanged( ITargetDeviceServicePtr Selection, ESelectInfo::Type SelectInfo )
|
|
{
|
|
Model->SelectDeviceService(Selection);
|
|
}
|
|
|
|
|
|
FText SDeviceBrowser::HandleDeviceServiceListViewHighlightText( ) const
|
|
{
|
|
return Filter->GetDeviceSearchText();
|
|
}
|
|
|
|
|
|
void SDeviceBrowser::HandleDeviceServiceManagerServiceAdded( const ITargetDeviceServiceRef& AddedService )
|
|
{
|
|
NeedsServiceListRefresh = true;
|
|
}
|
|
|
|
|
|
void SDeviceBrowser::HandleDeviceServiceManagerServiceRemoved( const ITargetDeviceServiceRef& RemovedService )
|
|
{
|
|
NeedsServiceListRefresh = true;
|
|
}
|
|
|
|
|
|
void SDeviceBrowser::HandleFilterChanged( )
|
|
{
|
|
ReloadDeviceServiceList(false);
|
|
}
|
|
|
|
|
|
#undef LOCTEXT_NAMESPACE
|