2014-12-07 19:09:38 -05:00
|
|
|
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
2014-08-05 09:04:35 -04:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
class UEditorTutorial;
|
|
|
|
|
|
2015-04-02 16:56:18 -04:00
|
|
|
DECLARE_DELEGATE_FiveParams(FOnLaunchTutorial, UEditorTutorial* /** InTutorialToLaunch */, IIntroTutorials::ETutorialStartType /* InStartType */, TWeakPtr<SWindow> /* InFromWindow */, FSimpleDelegate /* InOnTutorialClosed */, FSimpleDelegate /* InOnTutorialExited */);
|
2014-08-05 09:04:35 -04:00
|
|
|
|
|
|
|
|
/** Abstract base class for list entries in the tutorial menu */
|
|
|
|
|
struct ITutorialListEntry
|
|
|
|
|
{
|
|
|
|
|
/** Generate content for a tree entry */
|
|
|
|
|
virtual TSharedRef<ITableRow> OnGenerateTutorialRow(const TSharedRef<STableViewBase>& OwnerTable) const = 0;
|
|
|
|
|
|
|
|
|
|
/** Whether this entry passes the current filter criteria */
|
|
|
|
|
virtual bool PassesFilter(const FString& InCategoryFilter, const FString& InFilter) const = 0;
|
2014-09-18 16:43:17 -04:00
|
|
|
|
2014-09-29 05:28:46 -04:00
|
|
|
/** Get the text representation of this item's title */
|
|
|
|
|
virtual FText GetTitleText() const = 0;
|
|
|
|
|
|
2014-09-18 16:43:17 -04:00
|
|
|
/** Get the string representation of this item's title */
|
|
|
|
|
virtual FString GetTitleString() const = 0;
|
|
|
|
|
|
2015-02-02 10:16:37 -05:00
|
|
|
/** Get a priority value to override alphabetical sorting */
|
|
|
|
|
virtual int32 GetSortOrder() const = 0;
|
|
|
|
|
|
2014-09-18 16:43:17 -04:00
|
|
|
/**
|
|
|
|
|
* Sort this entry against another entry
|
|
|
|
|
* @return true if this < OtherEntry
|
|
|
|
|
*/
|
|
|
|
|
virtual bool SortAgainst(TSharedRef<ITutorialListEntry> OtherEntry) const = 0;
|
2015-03-23 10:08:21 -04:00
|
|
|
|
|
|
|
|
/** Return true if this entry should show up as completed (currently used to hide/show green check mark) */
|
|
|
|
|
virtual EVisibility GetCompletedVisibility() const = 0;
|
2014-08-05 09:04:35 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class FTutorialListEntry_Category;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The widget which holds all available tutorials
|
|
|
|
|
*/
|
|
|
|
|
class STutorialsBrowser : public SCompoundWidget
|
|
|
|
|
{
|
|
|
|
|
SLATE_BEGIN_ARGS( STutorialsBrowser ) {}
|
|
|
|
|
|
|
|
|
|
SLATE_ARGUMENT(FSimpleDelegate, OnClosed)
|
|
|
|
|
SLATE_ARGUMENT(FOnLaunchTutorial, OnLaunchTutorial)
|
|
|
|
|
SLATE_ARGUMENT(TWeakPtr<SWindow>, ParentWindow)
|
|
|
|
|
|
|
|
|
|
SLATE_END_ARGS()
|
|
|
|
|
|
|
|
|
|
void Construct(const FArguments& Args);
|
|
|
|
|
|
---- Merging with SlateDev branch ----
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]
2014-12-17 16:07:57 -05:00
|
|
|
/** Set the current filter string. Filters are used to only show the specified category of tutorials (e.g. only Blueprint tutorials) */
|
2014-08-05 09:04:35 -04:00
|
|
|
void SetFilter(const FString& InFilter);
|
|
|
|
|
|
2014-09-18 08:32:42 -04:00
|
|
|
/** Reload all tutorials that we know about */
|
|
|
|
|
void ReloadTutorials();
|
|
|
|
|
|
2014-08-05 09:04:35 -04:00
|
|
|
protected:
|
|
|
|
|
/** Handle generating a table row in the browser */
|
|
|
|
|
TSharedRef<ITableRow> OnGenerateTutorialRow(TSharedPtr<ITutorialListEntry> InItem, const TSharedRef<STableViewBase>& OwnerTable) const;
|
|
|
|
|
|
|
|
|
|
/** Handle closing the browser */
|
|
|
|
|
FReply OnCloseButtonClicked();
|
|
|
|
|
|
|
|
|
|
/** Handle traversing back up the browser hierarchy */
|
|
|
|
|
FReply OnBackButtonClicked();
|
|
|
|
|
|
|
|
|
|
/** Handle whether the back button can be clicked */
|
|
|
|
|
bool IsBackButtonEnabled() const;
|
|
|
|
|
|
|
|
|
|
/** Delegate handler fired when a tutorial is selected form the browser */
|
|
|
|
|
void OnTutorialSelected(UEditorTutorial* InTutorial, bool bRestart);
|
|
|
|
|
|
|
|
|
|
/** Delegate handler fired when a category is selected form the browser */
|
|
|
|
|
void OnCategorySelected(const FString& InCategory);
|
|
|
|
|
|
|
|
|
|
/** Filter displayed tutorials - regenerates the displayed items */
|
|
|
|
|
void FilterTutorials();
|
|
|
|
|
|
|
|
|
|
/** Rebuild the displayed categories */
|
|
|
|
|
TSharedPtr<FTutorialListEntry_Category> RebuildCategories();
|
|
|
|
|
|
|
|
|
|
/** Rebuild the displayed tutorials */
|
|
|
|
|
void RebuildTutorials(TSharedPtr<FTutorialListEntry_Category> InRootCategory);
|
|
|
|
|
|
|
|
|
|
/** Recursive helper function used to find a category given the current NavigationFilter */
|
|
|
|
|
TSharedPtr<FTutorialListEntry_Category> FindCategory_Recursive(TSharedPtr<FTutorialListEntry_Category> InCategory) const;
|
|
|
|
|
|
|
|
|
|
/** Handle rebuilding the browser display when the filter text changes */
|
|
|
|
|
void OnSearchTextChanged(const FText& InText);
|
|
|
|
|
|
|
|
|
|
/** Supplies the text to display in the filter box */
|
|
|
|
|
FText GetSearchText() const;
|
|
|
|
|
|
2014-09-29 05:28:46 -04:00
|
|
|
/** Handle clicking the breadcrumb trail */
|
|
|
|
|
void OnBreadcrumbClicked(const TSharedPtr<ITutorialListEntry>& InEntry);
|
|
|
|
|
|
|
|
|
|
/** Rebuild the breadcrumb trail according to the current category */
|
|
|
|
|
void RebuildCrumbs();
|
|
|
|
|
|
2014-10-13 06:46:06 -04:00
|
|
|
/** Handle an asset being added - rebuild our list if required */
|
|
|
|
|
void HandleAssetAdded(const FAssetData& InAssetData);
|
|
|
|
|
|
2014-08-05 09:04:35 -04:00
|
|
|
private:
|
|
|
|
|
|
---- Merging with SlateDev branch ----
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]
2014-12-17 16:07:57 -05:00
|
|
|
/** Triggers a reload of the tutorials */
|
2014-12-19 17:44:49 -05:00
|
|
|
EActiveTimerReturnType TriggerReloadTutorials( double InCurrentTime, float InDeltaTime );
|
---- Merging with SlateDev branch ----
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]
2014-12-17 16:07:57 -05:00
|
|
|
|
2014-08-05 09:04:35 -04:00
|
|
|
/** Root entry of the tutorials tree */
|
|
|
|
|
TSharedPtr<FTutorialListEntry_Category> RootEntry;
|
|
|
|
|
|
|
|
|
|
/** Current filtered entries */
|
|
|
|
|
TArray<TSharedPtr<ITutorialListEntry>> FilteredEntries;
|
|
|
|
|
|
|
|
|
|
/** List of tutorials widget */
|
|
|
|
|
TSharedPtr<SListView<TSharedPtr<ITutorialListEntry>>> TutorialList;
|
|
|
|
|
|
|
|
|
|
/** Delegate fired when the close button is clicked */
|
|
|
|
|
FSimpleDelegate OnClosed;
|
|
|
|
|
|
|
|
|
|
/** Delegate fired when a tutorial is selected */
|
|
|
|
|
FOnLaunchTutorial OnLaunchTutorial;
|
|
|
|
|
|
|
|
|
|
/** Current search string */
|
|
|
|
|
FText SearchFilter;
|
|
|
|
|
|
|
|
|
|
/** Current category navigation string */
|
|
|
|
|
FString NavigationFilter;
|
|
|
|
|
|
|
|
|
|
/** Static category filter for this browser */
|
|
|
|
|
FString CategoryFilter;
|
|
|
|
|
|
|
|
|
|
/** Cached current category */
|
|
|
|
|
TWeakPtr<FTutorialListEntry_Category> CurrentCategoryPtr;
|
|
|
|
|
|
|
|
|
|
/** Parent window of this browser */
|
|
|
|
|
TWeakPtr<SWindow> ParentWindow;
|
2014-09-29 05:28:46 -04:00
|
|
|
|
|
|
|
|
/** Breadcrumb trail for path display */
|
|
|
|
|
TSharedPtr<SBreadcrumbTrail<TSharedPtr<ITutorialListEntry>>> BreadcrumbTrail;
|
2014-10-13 06:46:06 -04:00
|
|
|
|
|
|
|
|
/** Whether we need to refresh the content in the browser */
|
|
|
|
|
bool bNeedsRefresh;
|
|
|
|
|
|
|
|
|
|
/** Prevent us from refreshing too often */
|
|
|
|
|
float RefreshTimer;
|
2014-08-05 09:04:35 -04:00
|
|
|
};
|