- Added FTypedElementListConstRef overloads of SelectElements, DeselectElements, and SetSelection in UTypedElementSelectionSet.
- Added FTypedElementListConstRef overload of Append in FTypedElementList.
- Removed the TSet<FTypedElementHandle> overload of GetElementHandlesInRect in FViewport.
- Updated UPlacementBrushToolBase::GetElementsInBrushRadius to return/use a FTypedElementListRef, and updated UPlacementModeLassoSelectTool and UPlacementModeEraseTool accordingly.
- Updated FoliageElementUtil::FoliageInstanceElementsEnabled to only return true if static mesh instance elements are also enabled.
#rb Brooke.Hubert
#preflight 60edb2d6ef22fa0001705b18
[CL 16839075 by Jamie Dale in ue5-main branch]
Storing typed elements in UObjects can easily lead to reference leaks if the elements aren't cleared prior to the UObject being left pending GC. This actually made UTypedElementList tricky to use, as you had to remember to manually empty it when you'd finished with it to avoid reference leaks, and we've had several cases now where that was done incorrectly.
To address this issue, we've moved element lists back to being a normal C++ class, FTypedElementList. However, unlike the original version of FTypedElementList (which was itself a UStruct), this version is always heap-allocated and referenced via a TSharedPtr/TSharedRef.
This gives us a nice middle-ground of a well defined lifetime (ie, no lingering references prior to GC) while still being efficient to pass around, including for scripting APIs via FTypedElementListProxy (which just wraps the TSharedPtr in a UStruct).
The downside of this approach is that we need to wrap the FTypedElementList functions that we want to expose to the scripting API (see UTypedElementListLibrary), however that is a far more reasonable burden than requring every user of the typed element framework to know and understand that UTypedElementList had to be manually cleared to avoid potentially hard to find reference leaks (especially if via leaked via scripting APIs).
The core of this change is to TypedElementList.h/.cpp, with TypedElementListFwd.h existing to forward declare the pointer types, and TypedElementListProxy.h and TypedElementListLibrary.h existing to declare the proxy type and wrapped functions used for scripting APIs. TypedElementSelectionInterface.h (and its implementations) provide an example of using FTypedElementListProxy within a scripting API, and the rest of the change is mostly just fallout to transform const UTypedElementList* to FTypedElementListConstRef and UTypedElementList* to FTypedElementListRef.
#rb Brooke.Hubert
#preflight 60d2720c634cd100016c804b
[CL 16776547 by Jamie Dale in ue5-main branch]
Static mesh instances are only hooked up editor side via hit proxies, and won't register in a sweep since it only deals with limited types.
#preflight 60ccd086be81e80001e90434
#Jira UETOOL-3724
#rb jamie.dale
#fyi basil.pesin
[CL 16763208 by brooke hubert in ue5-main branch]
Previously we relied on element implementations to know what their parent or child elements might be, and to deal with them correctly in the following cases:
1) When "normalising" a selection to be safe for operations like a move or delete, eg) removing elements that are children of other selected elements.
2) When deleting an element, also ensuring that any implicitly destroyed child elements were deselected, eg) deleting an ISM component that has selected static mesh instances.
This approach hurts the modularity of the elements themselves, as it requires that the element implementations have intrinsic knowledge of any other child (or parent) element types that may exist, and to deal with them accordingly when needed. As a concrete example, an ISM component may have child elements in the form of static mesh instance elements, however the generic component element type does not (and should not) directly know that static mesh instance elements exist.
To address this issue, we've added a new interface, UTypedElementHierarchyInterface, which can be used to provide information about the logical parent<->child hierarchy information of elements. This is implemented as follows for our current element types:
- Actor:
- GetParentElement returns an invalid element handle.
- GetChildElements returns the element handles of any components on the actor.
- Component:
- GetParentElement returns its owner actor element handle.
- GetChildElements returns nothing by default, but UActorComponent::GetComponentChildElements may be overridden to control this behavior.
- eg) UInstancedStaticMeshComponent overrides it to return its static mesh instance element handles.
- SMInstance:
- GetParentElement returns its owner ISM component element handle.
- GetChildElements returns nothing.
Now the problems listed above can be solved by using this interface instead of relying on the element implementations:
1) Selection normalization is now handled by UTypedElementSelectionSet, replacing the previous duplicate implementations of UTypedElementCommonActions and UTypedElementViewportInteraction.
2) UTypedElementSelectionSet will now walk and also update the selection state of child elements, when asked to via the FTypedElementSelectionOptions.
Breaking Changes:
- UTypedElementCommonActions::GetElementsForAction and UTypedElementViewportInteraction::GetSelectedElementsToMove have been removed, in favor of using the selection normalization functions of UTypedElementSelectionSet.
- Note: You may still favor using FLevelEditorViewportClient::GetElementsToManipulate, as it will have removed normalized elements that also cannot be moved by a gizmo.
- UTypedElementCommonActions::DeleteElements and UTypedElementCommonActions::DuplicateElements have been removed, as these functions operated on an unnormalized selection and could be unsafe. UTypedElementCommonActions::DeleteNormalizedElements and UTypedElementCommonActions::DuplicateNormalizedElements should be used instead.
- AGroupActor::ForEachActorInGroup and AGroupActor::ForEachMovableActorInGroup now take a second AGroupActor* argument in their callback.
#rb Brooke.Hubert
#preflight 60ca33a678c3b00001e8f5df
[CL 16705229 by Jamie Dale in ue5-main branch]
Added an option to prevent auto selection after placement for more rapid placing.
#Jira UE-109548
#rb jamie.dale
#ROBOMERGE-SOURCE: CL 15570959 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v771-15082668)
[CL 15570975 by brooke hubert in ue5-main branch]
UE_TYPED_ELEMENT_HAS_REFTRACKING is now compiled in to Debug and Development builds, and is controlled at runtime by the "TypedElements.EnableReferenceTracking" CVar. This can be queried in code via FTypedElementReferences::ReferenceTrackingEnabled.
UE_ENABLE_SMINSTANCE_ELEMENTS has been removed, and is controlled at runtime by the "TypedElements.EnableSMInstanceElements" CVar. This can be queried in code via SMInstanceElementDataUtil::SMInstanceElementsEnabled.
#rb Brooke.Hubert
#ROBOMERGE-SOURCE: CL 15541560 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v771-15082668)
[CL 15541563 by jamie dale in ue5-main branch]
Also fixed a bug where the ISM component was not rebuilding render data when using the placement subsystem.
#Jira UE-109265
#rb jamie.dale
#ROBOMERGE-SOURCE: CL 15528418 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v771-15082668)
[CL 15528424 by brooke hubert in ue5-main branch]
Also hooked up a clear all items from palette command, and removed some stale combo box functions.
#Jira UE-107394
#rb jamie.dale
#ROBOMERGE-SOURCE: CL 15503519 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v771-15082668)
[CL 15504138 by brooke hubert in ue5-main branch]
Disabled ISM placement in single place tool, since single selection of ISM is not hooked up yet.
#Jira UE-107395
#rb jamie.dale
#ROBOMERGE-SOURCE: CL 15493337 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v771-15082668)
[CL 15493396 by brooke hubert in ue5-main branch]
This was causing a crash when undoing due to the selection set being cleared on tool enter, and it felt bad to be in a different tool than I last selected after undoing.
#Jira none
#rb jamie.dale
#ROBOMERGE-SOURCE: CL 15476168 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v771-15082668)
[CL 15476259 by brooke hubert in ue5-main branch]
* Tweak after placement in world and local space using standard level editor gizmos.
* Removed Single place tool settings. Since we're using the TRS gizmos, these settings are unnecessary.
* Moved cycle through palette to shift + right click to match other viewport functions (i.e. cycling static mesh previews).
* Placement mode now inherits from default ed mode, so we will get the new gizmos as they come online.
* Fixed a bug in the select tool where the input was never making it back to the viewport for handling.
* Fixed a bug in the ITF Editor hooks where the mouse capture was incorrectly reporting and eating the input from the viewport.
#Jira UE-107395
[at]jamie.dale
#ROBOMERGE-SOURCE: CL 15464701 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v771-15082668)
[CL 15466468 by brooke hubert in ue5-main branch]
* Preview actor to visualize placement.
* Ctrl + click to rotate to another item in the palette and regenerate rotation and scale.
* Configurable normal axis alignment.
Also fixed a crash on exiting the mode due to lingering mode toolkit references in the level editor.
#Jira UE-107395
[at]jamie.dale [at]chris.gagnon
#ROBOMERGE-SOURCE: CL 15449338 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v771-15082668)
[CL 15454762 by brooke hubert in ue5-main branch]
# The implementation of this is backlogged due to bookkeeping information for arbitrary (non-foliage) types.
#Jira UE-107090
#rb jamie.dale
#ROBOMERGE-SOURCE: CL 15369985 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v771-15082668)
[CL 15370082 by brooke hubert in ue5-main branch]