Commit Graph

26 Commits

Author SHA1 Message Date
Jamie Dale
3f3e0e7a67 Updated actor property editing to be typed element based
SActorDetails now operates on a given UTypedElementSelectionSet (removing its dependence on the global selection), and also operates based on the list of selected top-level elements rather than the selected actors.

UTypedElementDetailsInterface provides the interface needed for an element to be used with the details panel, with ITypedElementDetailsObject being the underlying glue object.
The ITypedElementDetailsObject instance will exist as long as the details panel is using it, so gives a lifetime to potentially synthesized UObject instances that are created purely for editing (eg, on instances).

This change removes almost all direct use of UpdateFloatingPropertyWindowsFromActorList, with only a single use-case in the reference viewer remaining.
Most code was already using UpdateFloatingPropertyWindows anyway, which now emits an extra OnElementSelectionChanged event in addition to its previous OnActorSelectionChanged event.
UpdateFloatingPropertyWindowsFromActorList now only emits an OnOverridePropertyEditorSelection event and no longer emits an OnActorSelectionChanged event.
SActorDetails is updated from both OnElementSelectionChanged and OnOverridePropertyEditorSelection, with the OnActorSelectionChanged event remaining for backwards compatability with existing code.

#jira
#rb Chris.Gagnon, Brooke.Hubert

[CL 15037524 by Jamie Dale in ue5-main branch]
2021-01-11 11:14:52 -04:00
Jamie Dale
5160047ddd Added SetSelection helper to UTypedElementSelectionSet
This is equivalent to calling ClearSelection then SelectElements, but happens in a single batch.

#rb Brooke.Hubert

[CL 14891193 by Jamie Dale in ue5-main branch]
2020-12-09 15:57:48 -04:00
brooke hubert
6a2f66594f Non-unity build fix.
#rnx
#Jira UE-104162
#rb trivial

[CL 14871346 by brooke hubert in ue5-main branch]
2020-12-07 13:38:37 -04:00
brooke hubert
94e5cdb545 Initial Placement Factory and Subsystem APIs.
# FActorFactoryAssetProxy uses the placement subsystem first to try to place a new actor.
# Existing UActorFactory implementations added to the subsystem and hooked up to the placement API

#Jira UE-98159
#Jira UE-98161
#review-14836149
#rb chris.gagnon jamie.dale

[CL 14847312 by brooke hubert in ue5-main branch]
2020-12-03 14:49:26 -04:00
Jamie Dale
2eba45e383 Ported viewport drag-duplication to use typed elements
This involved splitting and converting several UUnrealEdEngine functions to no longer operate on or manipulate the current selection set:
 - edactCopySelected:
   - Split into CopyComponents and CopyActors, which take an array of components and actors to copy rather than use the selection state.
   - Breaking: If a DestinationData is provided, it is now used *instead of* the clipboard rather than *as well as* the clipboard.
     - In practice nothing seemed to rely on this old method, and in fact some places stashed and restored the clipboard data to workaround it!
 - edactPasteSelected:
   - Split into PasteComponents and PasteActors, which now returns an array of components or actors that were pasted rather than make them the active selection.
   - Note: PasteActors does still update the selection via FactoryCreateText, but we restore it again afterwards.
 - edactDuplicateSelected:
   - Split into DuplicateComponents and DuplicateActors, which take an array of components or actors to duplicate, and also returns an array of components or actors that were created.

The "edact" versions still use and update the selection state when calling into the internal functions, but the typed element layer does not, and handles duplication via UEngineElementsLibrary::DuplicateElements and UTypedElementWorldInterface, with the level editor viewport handling updating the selection state afterwards.

#rb Brooke.Hubert, Chris.Gagnon

[CL 14838341 by Jamie Dale in ue5-main branch]
2020-12-02 16:08:03 -04:00
Jamie Dale
c54ffb854e Ported the actor snap/align functions to use typed elements internally
The following options from the actor viewport menu are now elemenent based:
 - Snap/Align (excluding layers)
 - Delta Transform
 - Mirror X/Y/Z

#rb Brooke.Hubert

[CL 14830849 by Jamie Dale in ue5-main branch]
2020-12-01 16:57:10 -04:00
Jamie Dale
08b036dc97 Remove redundant include
#rb Brooke.Hubert
#rnx

[CL 14828930 by Jamie Dale in ue5-main branch]
2020-12-01 12:46:54 -04:00
Jamie Dale
ca08dfb897 Removed GLevelEditorModeTools use from typed element interface implementations
#rb Brooke.Hubert
#rnx

[CL 14828542 by Jamie Dale in ue5-main branch]
2020-12-01 12:05:35 -04:00
Jamie Dale
5e11829221 Fixed incorrect interface signature
#rb none
#rnx

[CL 14818390 by Jamie Dale in ue5-main branch]
2020-11-28 14:50:45 -04:00
Jamie Dale
d43516f6bc Fixed valid selection changes failing to transact for undo/redo
#rb none
#rnx

[CL 14817263 by Jamie Dale in ue5-main branch]
2020-11-27 10:36:37 -04:00
Jamie Dale
cf9fcc3e71 Implemented initial support for element based viewport interaction
There are two parts to this:
 - UTypedElementWorldInterface, which provides the lower-level access to things like element transforms.
 - UTypedElementViewportInteraction, which provides the higher-level access for things like gizmo manipulation.
   - The default implementation is implemented purely in terms of get/set transform via UTypedElementWorldInterface.
   - The level editor overrides this to continue to go through the current code path for gizmo manipulation.

#rb Brooke.Hubert

[CL 14813510 by Jamie Dale in ue5-main branch]
2020-11-25 14:31:59 -04:00
Jamie Dale
2771f192b1 Added utils for getting the existence/count of the number of elements/objects within a element list and selection set
#rb Lauren.Barnes
#rnx

[CL 14793994 by Jamie Dale in ue5-main branch]
2020-11-19 21:42:20 -04:00
Jamie Dale
fe22bc2cbd Allow the UObject utils for element selection to be used with element lists as well as the wrapper selection set
#rb Brooke.Hubert
#rnx

[CL 14779934 by Jamie Dale in ue5-main branch]
2020-11-18 14:27:25 -04:00
Jamie Dale
bbb6877579 Added functions to enumerate selected objects from the typed element selection set
Moved the typed element list to also use enumeration functions for consistency

#fyi Lauren.Barnes
#rb Chris.Gagnon

[CL 14758753 by Jamie Dale in ue5-main branch]
2020-11-16 17:19:10 -04:00
Jamie Dale
6dc9d4f940 Formalized the process for creating higher-level element interfaces that can be customized by specific asset editors
This takes the framework used for UTypedElementSelectionSet and moves to it a utility base class that other higher-level interfaces can also make use of.

This also changes the interface implementations for these systems to be non-UObject types, as the script exposure is handled by the owner object, and this can solve some cyclic parsing issues with UHT (eg, between UnrealEd and LevelEditor).

#rb Chris.Gagnon, Brooke.Hubert
#rnx

[CL 14704895 by Jamie Dale in ue5-main branch]
2020-11-10 14:12:52 -04:00
Jamie Dale
d2615616d3 Fixed assert when UTypedElementSelectionSet was queried for object references
#jira UE-102138, UE-102094
#rb Lauren.Barnes
#rnx

[CL 14603694 by Jamie Dale in ue5-main branch]
2020-10-28 16:49:35 -04:00
Jamie Dale
ff7d47fbf4 Made typed element includes more consistent
- Moved all the "framework" code under "Elements/Framework".
 - Moved all the "interface" code under "Elements/Interfaces".

This lets the code be split over multiple modules (including the Engine and Editor) while retaining consistent include paths with things like "Elements/Actor", "Elements/Component", etc, as well as letting new interfaces and frameworky things be added outside of the core typed element modules while still maintaining a coherent include scheme.

#fyi Brooke.Hubert
#rb Chris.Gagnon

[CL 14585700 by Jamie Dale in ue5-main branch]
2020-10-27 07:00:04 -04:00
Jamie Dale
db7459f98e Migrated undo/redo support from USelection to UTypedElementSelectionSet
This adds some new functions to UTypedElementSelectionInterface to deal with writing the underlying data needed by an element (WriteTransactedElement) to factory it again later (ReadTransactedElement) when restoring a prior selection state.

#rb Chris.Gagnon

[CL 14585511 by Jamie Dale in ue5-main branch]
2020-10-27 05:49:47 -04:00
Jamie Dale
e3ac0f1b0f Updated USelection to be a legacy shim around a UTypedElementSelectionSet
This change removes the original UObject-array based USelection implementation that was still being used for generic UObject selection, in favor of always using a UTypedElementSelectionSet to back the USelection.

 - Added an "Object" element type, so that generic objects can be stored in a UTypedElementSelectionSet.
 - Added UEngineElementsLibrary to manage the creation and destruction of "Object" elements, as CoreUObject cannot directly use the TypedElementFramework.
   - Also migrated "Actor" and "Component" element creation and destruction to UEngineElementsLibrary for consistency.
 - Fixed a race condition in the AcquireEditorXElementHandle functions due to the TTypedElementOwnerStore lock being released between the find and the add (see TTypedElementOwnerStore::FindOrRegisterElementOwner).
 - Moved the GetObject function onto a new UTypedElementObjectInterface, as that function will likely be needed by legacy code outside of selection.
 - Removed UTypedElementSelectionSet::GetMutableElementList in favor of selectively exposing certain functions from the underlying UTypedElementList, which should avoid potential abuse or misuse of the underlying list.

#rb Brooke.Hubert
#rnx

[CL 14535062 by Jamie Dale in ue5-main branch]
2020-10-21 12:09:05 -04:00
Jamie Dale
64b075c319 First phase of converting Level Editor viewport selection to use typed elements
This phase focuses on the minimum set of changes needed to port the UnrealEd logic for handling the selection of actors and components within the Level Editor viewport to use typed element interfaces. There is still future work to be done to clean this up further.

This change adds a new framework type, UTypedElementSelectionSet, which manages the concept of "selection" for typed elements. Internally this owns its own UTypedElementList, and ensures that mutation of that list goes via the UTypedElementSelectionInterface implementations.

To allow specific asset editors to customize their selection behavior, UTypedElementSelectionSet may have "selection proxies" that implement UTypedElementAssetEditorSelectionProxy registered to it. This is what's used to allow the level editor to implement its type specific rules.

The core Level Editor selection implementation for actors and components now lives inside UActorElementLevelEditorSelectionProxy and UComponentElementLevelEditorSelectionProxy, and the existing UUnrealEdEngine functions that used to deal with this logic now proxy through to those implementations via UTypedElementSelectionSet. This means that the implementation has moved into the LevelEditor module without UnrealEd even knowing.

Future work will focus on:
 - Cleaning up the legacy USelection bridge, so that all USelection instances are just a proxy around a UTypedElementSelectionSet.
   - This will involve making a basic "Object" element type to handle the generic UObject based selection (for assets) that USelection also handles.
   - This should allow GetMutableElementList to be removed from UTypedElementSelectionSet, to avoid potential abuse or misuse.
 - Investigating the best way to integrate element based selection into the editor modes.

#rb Chris.Gagnon, Brooke.Hubert
#rnx

[CL 14470181 by Jamie Dale in ue5-main branch]
2020-10-11 12:40:44 -04:00
brooke hubert
e85ae49f14 The EditorToolsContext is now owned by the mode manager.
Updated Mesh Paint, geometry, arch gen, hair lab, and sample editor modes to reflect changes to the tools context ownership.

#Jira UE-96448
#rb lauren.barnes michael.daum
#fyi ryan.schmidt simon.barsky jack.greasley
#review-14189762
#review-14189796
#review-14189767
#review-14189774
#review-14189785

[CL 14247116 by brooke hubert in ue5-main branch]
2020-09-02 15:43:58 -04:00
jimmy smith
37e87fe289 Fix for nounity errors
#fyi brooke.hubert

[CL 14225929 by jimmy smith in ue5-main branch]
2020-08-31 23:09:18 -04:00
brooke hubert
71fab51246 Remove EditorSubsystem from EditorFramework build dependencies.
#rnx
#Jira UE-96448
#rb louise.rasmussen

[CL 14116568 by brooke hubert in ue5-main branch]
2020-08-14 15:23:25 -04:00
brooke hubert
db1865135e Move Viewport Tab content and Editor Layout to EditorFramework.
#rnx
#Jira UE-96448
#rb chris.gagnon

[CL 14113508 by brooke hubert in ue5-main branch]
2020-08-14 10:43:13 -04:00
brooke hubert
b25777d3f1 Move Toolkit Manager to EditorFramework module.
#rnx
#Jira UE-96448
#rb jamie.dale lauren.barnes

[CL 14095882 by brooke hubert in ue5-main branch]
2020-08-12 17:44:00 -04:00