You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
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
#ROBOMERGE-SOURCE: CL 16705229 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v835-16672529)
[CL 16705233 by jamie dale in ue5-release-engine-test branch]