You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Other Updates: - The WidgetReflector is now in its own module as well. It will be converted to a plug-in later. - The Public API of both Slate and SlateCore has largely been reorganized for better discoverabilty. More cleanup work is needed. - Added a lot of missing API documentation and fixed existing ones. More and better documentation is needed. - Removed dead code, fixed a couple things I stubled upon, and conformed to coding guidelines (NULL vs nullptr, line breaks, etc.) Upgrade Notes: - The Slate Remote Server is currently disabled - will be re-enabled shortly! - If your module previously had a module dependency to 'Slate', it now also needs a PrivateModuleDependency to 'SlateCore' in its Build.cs file. - If your module exposes in any of its Public header files types that are now declared in SlateCore, it needs a PublicModuleDependency to 'SlateCore' - The ToolTip property type on SWidget has changed from SToolTip to IToolTip; change local variables to TSharedPtr<IToolTip> instead of TSharedPtr<SToolTip> where needed - IToolTip is not a widget. If you need access to the actual widget that represents the tool tip, use IToolTip::AsWidget(); If you need access to the tool tip's content, use IToolTip::GetContentWidget() Troubleshooting: - After syncing to this changelist you may have to clean your /Engine/Intermediate/Build/ directory and rebuild your entire project - If in your project you are getting linker errors for unresolved types that are now declared in SlateCore, you may be missing a dependency to 'SlateCore' - If in the Engine code you are getting linker errors for unresolved types that are now declared in SlateCore, you may need to rebuild the entire Engine [CL 2057118 by Max Preussner in Main branch]
104 lines
3.7 KiB
C++
104 lines
3.7 KiB
C++
// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
|
|
|
|
/*=============================================================================
|
|
WidgetReflectorNode.h: Declares the FWidgetReflectorNode class.
|
|
=============================================================================*/
|
|
|
|
#pragma once
|
|
|
|
|
|
/**
|
|
* The WidgetReflector captures layout information and widget hierarchy structure into a tree of FReflectorNode.
|
|
* The node also contains useful visualization and debug info.
|
|
*/
|
|
struct FReflectorNode
|
|
{
|
|
/** The widget which this node describes */
|
|
TWeakPtr<SWidget> Widget;
|
|
|
|
/** The geometry of the widget */
|
|
FGeometry Geometry;
|
|
|
|
/** ReflectorNodes for the Widget's children. */
|
|
TArray<TSharedPtr<FReflectorNode>> ChildNodes;
|
|
|
|
/** A tint that is applied to text in order to provide visual hints */
|
|
FLinearColor Tint;
|
|
|
|
/** Should we visualize this node */
|
|
bool bVisualizeThisNode;
|
|
|
|
public:
|
|
|
|
/**
|
|
* FReflectorNodes must be constructed as shared pointers.
|
|
*
|
|
* @param InWidgetGeometry Optional widget and associated geometry which this node should represent
|
|
*/
|
|
static TSharedRef<FReflectorNode> New( const FArrangedWidget& InWidgetGeometry = FArrangedWidget(SNullWidget::NullWidget, FGeometry()) )
|
|
{
|
|
return MakeShareable( new FReflectorNode(InWidgetGeometry) );
|
|
}
|
|
|
|
/**
|
|
* Capture all the children of the supplied widget along with their layout results
|
|
* Note that we include both visible and invisible children!
|
|
*
|
|
* @param InWidgetGeometry Widget and geometry whose children to capture in the snapshot.
|
|
*/
|
|
static TSharedRef<FReflectorNode> NewTreeFrom( const FArrangedWidget& InWidgetGeometry )
|
|
{
|
|
TSharedRef<FReflectorNode> NewNode = MakeShareable( new FReflectorNode(InWidgetGeometry) );
|
|
|
|
FArrangedChildren ArrangedChildren(EVisibility::All);
|
|
NewNode->Widget.Pin()->ArrangeChildren( NewNode->Geometry, ArrangedChildren );
|
|
|
|
for (int32 WidgetIndex=0; WidgetIndex < ArrangedChildren.Num(); ++WidgetIndex)
|
|
{
|
|
// Note that we include both visible and invisible children!
|
|
NewNode->ChildNodes.Add( FReflectorNode::NewTreeFrom( ArrangedChildren(WidgetIndex) ) );
|
|
}
|
|
|
|
return NewNode;
|
|
}
|
|
|
|
/**
|
|
* Locate all the widgets from a widget path in a list of ReflectorNodes and their children.
|
|
*
|
|
* @param CandidateNodes A list of FReflectorNodes that represent widgets.
|
|
* @param WidgetPathToFind We want to find all reflector nodes corresponding to widgets in this path
|
|
* @param SearchResult An array that gets results put in it
|
|
* @param NodeIndexToFind Index of the widget in the path that we are currently looking for; we are done when we've found all of them
|
|
*/
|
|
static void FindWidgetPath( const TArray<TSharedPtr<FReflectorNode>>& CandidateNodes, const FWidgetPath& WidgetPathToFind, TArray< TSharedPtr<FReflectorNode> >& SearchResult, int32 NodeIndexToFind = 0 )
|
|
{
|
|
if (NodeIndexToFind < WidgetPathToFind.Widgets.Num())
|
|
{
|
|
const FArrangedWidget& WidgetToFind = WidgetPathToFind.Widgets(NodeIndexToFind);
|
|
|
|
for (int32 NodeIndex=0; NodeIndex < CandidateNodes.Num(); ++NodeIndex)
|
|
{
|
|
if (CandidateNodes[NodeIndex]->Widget.Pin() == WidgetPathToFind.Widgets(NodeIndexToFind).Widget)
|
|
{
|
|
SearchResult.Add(CandidateNodes[NodeIndex]);
|
|
FindWidgetPath(CandidateNodes[NodeIndex]->ChildNodes, WidgetPathToFind, SearchResult, NodeIndexToFind + 1);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
protected:
|
|
|
|
/**
|
|
* FReflectorNode must be constructor through static methods.
|
|
*
|
|
* @param InWidgetGeometry Widget and associated geometry that this node will represent
|
|
*/
|
|
FReflectorNode( const FArrangedWidget& InWidgetGeometry )
|
|
: Widget( InWidgetGeometry.Widget )
|
|
, Geometry( InWidgetGeometry.Geometry )
|
|
, Tint(FLinearColor(1.0f, 1.0f, 1.0f))
|
|
, bVisualizeThisNode(true)
|
|
{ }
|
|
};
|