RealTimeThumbnails

RealTimeThumbnails

#Overview

name: RealTimeThumbnails

The value of this variable can be defined or overridden in .ini config files. 1 .ini config file referencing this setting variable.

It is referenced in 10 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of RealTimeThumbnails is to control the rendering of real-time thumbnails for loaded assets in the Content Browser of Unreal Engine. This setting variable is primarily used in the asset management and visualization system of the Unreal Engine editor.

Based on the callsites, the Content Browser module and the UnrealEd module rely on this setting variable. It is used in the SAssetView class for displaying assets and in the FAssetThumbnailPool class for managing asset thumbnails.

The value of this variable is set in the UContentBrowserSettings class, which is a configuration class for the Content Browser. It can be toggled using the ToggleRealTimeThumbnails function in the SAssetView class.

This variable interacts with other asset management and rendering systems in the engine. It affects the behavior of the FAssetThumbnailPool class, which manages the rendering and caching of asset thumbnails.

Developers must be aware that enabling real-time thumbnails can impact performance, especially when dealing with a large number of assets or complex assets that require significant rendering time. It’s also important to note that this feature is disabled during PIE (Play In Editor) or Simulate modes to prevent performance issues during gameplay testing.

Best practices when using this variable include:

  1. Consider the performance impact when enabling real-time thumbnails, especially for large projects.
  2. Use it judiciously, perhaps enabling it only for specific asset types that benefit most from real-time updates.
  3. Be aware that it may not reflect changes in assets that are not currently loaded.
  4. Consider providing a user-facing option to toggle this feature, allowing end-users to balance visual fidelity and performance based on their system capabilities.
  5. Ensure that disabling this feature doesn’t negatively impact the user experience, by providing alternative ways to preview assets if necessary.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEditorSettings.ini:23, section: [/Script/UnrealEd.ContentBrowserSettings]

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Editor/ContentBrowser/Private/SAssetView.cpp:3049

Scope (from outer to inner):

file
function     void SAssetView::ToggleRealTimeThumbnails

Source code excerpt:

	bool bNewState = !IsShowingRealTimeThumbnails();

	GetMutableDefault<UContentBrowserSettings>()->RealTimeThumbnails = bNewState;
	GetMutableDefault<UContentBrowserSettings>()->PostEditChange();
}

bool SAssetView::CanShowRealTimeThumbnails() const
{
	return bCanShowRealTimeThumbnails;

#Loc: <Workspace>/Engine/Source/Editor/ContentBrowser/Private/SAssetView.cpp:3065

Scope (from outer to inner):

file
function     bool SAssetView::IsShowingRealTimeThumbnails

Source code excerpt:

	}

	return GetDefault<UContentBrowserSettings>()->RealTimeThumbnails;
}

void SAssetView::ToggleShowPluginContent()
{
	check(IsToggleShowPluginContentAllowed());

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Classes/Settings/ContentBrowserSettings.h:27

Scope (from outer to inner):

file
class        class UContentBrowserSettings : public UObject

Source code excerpt:

	/** Whether to render thumbnails for loaded assets in real-time in the Content Browser */
	UPROPERTY(config)
	bool RealTimeThumbnails;

	/** Whether to display folders in the asset view of the content browser. Note that this implies 'Show Only Assets in Selected Folders'. */
	UPROPERTY(config)
	bool DisplayFolders;

	/** Whether to empty display folders in the asset view of the content browser. */

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/AssetThumbnail.cpp:988

Scope (from outer to inner):

file
function     void FAssetThumbnailPool::ReleaseResources

Source code excerpt:

	// Clear all pending render requests
	ThumbnailsToRenderStack.Empty();
	RealTimeThumbnails.Empty();
	RealTimeThumbnailsToRender.Empty();

	TArray< TSharedRef<FThumbnailInfo> > ThumbnailsToRelease;

	for( auto ThumbIt = ThumbnailToTextureMap.CreateConstIterator(); ThumbIt; ++ThumbIt )
	{

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/AssetThumbnail.cpp:1041

Scope (from outer to inner):

file
function     bool FAssetThumbnailPool::IsTickable

Source code excerpt:

bool FAssetThumbnailPool::IsTickable() const
{
	return RecentlyLoadedAssets.Num() > 0 || ThumbnailsToRenderStack.Num() > 0 || RealTimeThumbnails.Num() > 0 || bWereShadersCompilingLastFrame || (GShaderCompilingManager && GShaderCompilingManager->IsCompiling());
}

void FAssetThumbnailPool::Tick( float DeltaTime )
{
	// If throttling do not tick unless drag dropping which could have a thumbnail as the cursor decorator
	if (FSlateApplication::IsInitialized() && !FSlateApplication::Get().IsDragDropping() && !FSlateThrottleManager::Get().IsAllowingExpensiveTasks() && !FSlateApplication::Get().AnyMenusVisible())

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/AssetThumbnail.cpp:1078

Scope (from outer to inner):

file
function     void FAssetThumbnailPool::Tick

Source code excerpt:

	// If we have dynamic thumbnails and we are done rendering the last batch of dynamic thumbnails, start a new batch as long as real-time thumbnails are enabled
	const bool bIsInPIEOrSimulate = GEditor->PlayWorld != NULL || GEditor->bIsSimulatingInEditor;
	const bool bShouldUseRealtimeThumbnails = GetDefault<UContentBrowserSettings>()->RealTimeThumbnails && !bIsInPIEOrSimulate;
	if ( bShouldUseRealtimeThumbnails && RealTimeThumbnails.Num() > 0 && RealTimeThumbnailsToRender.Num() == 0 )
	{
		double CurrentTime = FPlatformTime::Seconds();
		for ( int32 ThumbIdx = RealTimeThumbnails.Num() - 1; ThumbIdx >= 0; --ThumbIdx )
		{
			const TSharedRef<FThumbnailInfo>& Thumb = RealTimeThumbnails[ThumbIdx];
			if ( Thumb->AssetData.IsAssetLoaded() )
			{
				// Only render thumbnails that have been requested recently
				if ( (CurrentTime - Thumb->LastAccessTime) < 1.f )
				{
					RealTimeThumbnailsToRender.Add(Thumb);

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/AssetThumbnail.cpp:1095

Scope (from outer to inner):

file
function     void FAssetThumbnailPool::Tick

Source code excerpt:

			else
			{
				RealTimeThumbnails.RemoveAt(ThumbIdx);
			}
		}
	}

	uint32 NumRealTimeThumbnailsRenderedThisFrame = 0;
	// If there are any thumbnails to render, pop one off the stack and render it.

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/AssetThumbnail.cpp:1582

Scope (from outer to inner):

file
function     void FAssetThumbnailPool::SetRealTimeThumbnail

Source code excerpt:

			if ( bRealTimeThumbnail )
			{
				RealTimeThumbnails.AddUnique(*ThumbnailInfoPtr);
			}
			else
			{
				RealTimeThumbnails.Remove(*ThumbnailInfoPtr);
			}
		}
	}
}

void FAssetThumbnailPool::FreeThumbnail( const FSoftObjectPath& ObjectPath, uint32 Width, uint32 Height )

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/AssetThumbnail.cpp:1604

Scope (from outer to inner):

file
function     void FAssetThumbnailPool::FreeThumbnail

Source code excerpt:

			ThumbnailToTextureMap.Remove(ThumbId);
			ThumbnailsToRenderStack.Remove(ThumbnailInfo);
			RealTimeThumbnails.Remove(ThumbnailInfo);
			RealTimeThumbnailsToRender.Remove(ThumbnailInfo);

			FSlateTexture2DRHIRef* ThumbnailTexture = ThumbnailInfo->ThumbnailTexture;
			ENQUEUE_RENDER_COMMAND(ReleaseThumbnailTextureData)(
				[ThumbnailTexture](FRHICommandListImmediate& RHICmdList)
				{

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Public/AssetThumbnail.h:353

Scope (from outer to inner):

file
class        class FAssetThumbnailPool : public FTickableEditorObject

Source code excerpt:


	/** List of thumbnails that can be rendered in real-time */
	TArray< TSharedRef<FThumbnailInfo> > RealTimeThumbnails;

	/** List of real-time thumbnails that are queued to be rendered */
	TArray< TSharedRef<FThumbnailInfo> > RealTimeThumbnailsToRender;

	/** List of free thumbnails that can be reused */
	TArray< TSharedRef<FThumbnailInfo> > FreeThumbnails;