2021-10-21 16:57:00 -04:00
// Copyright Epic Games, Inc. All Rights Reserved.
# include "Snapping/ModelingSceneSnappingManager.h"
# include "InteractiveToolsContext.h"
# include "InteractiveToolManager.h"
Added support for world-space hit-testing and snapping to Volume and DynamicMeshComponent mesh vertices/edges/faces, by having Modeling Mode maintain a persistent set of spatial data structures for these scene meshes. With this change, new ToolSceneQueriesUtil functions can be used to provide more general scene mesh-element hit-testing/snapping via ModelingSceneSnappingManager. Updates to existing Tools/Mechanics to use these new query functions will be done in later CLs.
ToolsFramework:
- added new USceneSnappingManager::ExecuteSceneHitQuery API function, as well as accompanying FSceneHitQueryRequest/FSceneHitQueryResult structs
- added FSceneQueryVisibilityFilter struct which contains ComponentsToIgnore/InvisibleComponentsToInclude lists for snapping queries and provides shared IsVisible() implementation
ModelingComponents:
- add FLevelObjectsObserver, tracks Actors added/removed to a Level via various editor events
- add FSceneGeometrySpatialCache, maintains spatial data structures for known types of mesh-backed PrimitiveComponents, an octree based on their world-space bounding-boxes, and provides various spatial-query functions
- ModelingSceneSnappingManager now maintains a FSceneGeometrySpatialCache for a set of Actors/Components it is notified about, and updates the spatial cache if those components are modified or translated. Currently supports Volumes and DynamicMeshComponents.
- add ModelingSceneSnappingManager::ExecuteSceneHitQuery implementation, does raycasts into the world (for static mesh components) and FSceneGeometrySpatialCache for Volumes/DMCs
- modified ModelingSceneSnappingManager::ExecuteSceneSnapQuery to also do combined query against StaticMeshComponents via world-linetrace, and FSceneGeometrySpatialCache for Volumes/DMCs
- add ToolSceneQueriesUtil::FindNearestVisibleObjectHit variants that take a USceneSnappingManager or UInteractiveTool, and do queries via the SceneSnappingManger, instead of directly linetracing into a UWorld
ModleingToolsEditorMode:
- add FLevelObjectsObserver instance and use it to drive updates to active ModelingSceneSnappingManager
#rnx
#jira none
#preflight 61a664a09a226d9e823ad4c1
#ROBOMERGE-AUTHOR: ryan.schmidt
#ROBOMERGE-SOURCE: CL 18339853 in //UE5/Release-5.0/... via CL 18339869
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)
[CL 18339891 by ryan schmidt in ue5-release-engine-test branch]
2021-12-01 11:15:01 -05:00
# include "InteractiveToolObjects.h"
2021-10-21 16:57:00 -04:00
# include "ContextObjectStore.h"
Added support for world-space hit-testing and snapping to Volume and DynamicMeshComponent mesh vertices/edges/faces, by having Modeling Mode maintain a persistent set of spatial data structures for these scene meshes. With this change, new ToolSceneQueriesUtil functions can be used to provide more general scene mesh-element hit-testing/snapping via ModelingSceneSnappingManager. Updates to existing Tools/Mechanics to use these new query functions will be done in later CLs.
ToolsFramework:
- added new USceneSnappingManager::ExecuteSceneHitQuery API function, as well as accompanying FSceneHitQueryRequest/FSceneHitQueryResult structs
- added FSceneQueryVisibilityFilter struct which contains ComponentsToIgnore/InvisibleComponentsToInclude lists for snapping queries and provides shared IsVisible() implementation
ModelingComponents:
- add FLevelObjectsObserver, tracks Actors added/removed to a Level via various editor events
- add FSceneGeometrySpatialCache, maintains spatial data structures for known types of mesh-backed PrimitiveComponents, an octree based on their world-space bounding-boxes, and provides various spatial-query functions
- ModelingSceneSnappingManager now maintains a FSceneGeometrySpatialCache for a set of Actors/Components it is notified about, and updates the spatial cache if those components are modified or translated. Currently supports Volumes and DynamicMeshComponents.
- add ModelingSceneSnappingManager::ExecuteSceneHitQuery implementation, does raycasts into the world (for static mesh components) and FSceneGeometrySpatialCache for Volumes/DMCs
- modified ModelingSceneSnappingManager::ExecuteSceneSnapQuery to also do combined query against StaticMeshComponents via world-linetrace, and FSceneGeometrySpatialCache for Volumes/DMCs
- add ToolSceneQueriesUtil::FindNearestVisibleObjectHit variants that take a USceneSnappingManager or UInteractiveTool, and do queries via the SceneSnappingManger, instead of directly linetracing into a UWorld
ModleingToolsEditorMode:
- add FLevelObjectsObserver instance and use it to drive updates to active ModelingSceneSnappingManager
#rnx
#jira none
#preflight 61a664a09a226d9e823ad4c1
#ROBOMERGE-AUTHOR: ryan.schmidt
#ROBOMERGE-SOURCE: CL 18339853 in //UE5/Release-5.0/... via CL 18339869
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)
[CL 18339891 by ryan schmidt in ue5-release-engine-test branch]
2021-12-01 11:15:01 -05:00
# include "Scene/SceneGeometrySpatialCache.h"
2022-10-26 12:57:32 -04:00
# include "Engine/Engine.h"
2021-10-21 16:57:00 -04:00
# include "Engine/World.h"
Added support for world-space hit-testing and snapping to Volume and DynamicMeshComponent mesh vertices/edges/faces, by having Modeling Mode maintain a persistent set of spatial data structures for these scene meshes. With this change, new ToolSceneQueriesUtil functions can be used to provide more general scene mesh-element hit-testing/snapping via ModelingSceneSnappingManager. Updates to existing Tools/Mechanics to use these new query functions will be done in later CLs.
ToolsFramework:
- added new USceneSnappingManager::ExecuteSceneHitQuery API function, as well as accompanying FSceneHitQueryRequest/FSceneHitQueryResult structs
- added FSceneQueryVisibilityFilter struct which contains ComponentsToIgnore/InvisibleComponentsToInclude lists for snapping queries and provides shared IsVisible() implementation
ModelingComponents:
- add FLevelObjectsObserver, tracks Actors added/removed to a Level via various editor events
- add FSceneGeometrySpatialCache, maintains spatial data structures for known types of mesh-backed PrimitiveComponents, an octree based on their world-space bounding-boxes, and provides various spatial-query functions
- ModelingSceneSnappingManager now maintains a FSceneGeometrySpatialCache for a set of Actors/Components it is notified about, and updates the spatial cache if those components are modified or translated. Currently supports Volumes and DynamicMeshComponents.
- add ModelingSceneSnappingManager::ExecuteSceneHitQuery implementation, does raycasts into the world (for static mesh components) and FSceneGeometrySpatialCache for Volumes/DMCs
- modified ModelingSceneSnappingManager::ExecuteSceneSnapQuery to also do combined query against StaticMeshComponents via world-linetrace, and FSceneGeometrySpatialCache for Volumes/DMCs
- add ToolSceneQueriesUtil::FindNearestVisibleObjectHit variants that take a USceneSnappingManager or UInteractiveTool, and do queries via the SceneSnappingManger, instead of directly linetracing into a UWorld
ModleingToolsEditorMode:
- add FLevelObjectsObserver instance and use it to drive updates to active ModelingSceneSnappingManager
#rnx
#jira none
#preflight 61a664a09a226d9e823ad4c1
#ROBOMERGE-AUTHOR: ryan.schmidt
#ROBOMERGE-SOURCE: CL 18339853 in //UE5/Release-5.0/... via CL 18339869
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)
[CL 18339891 by ryan schmidt in ue5-release-engine-test branch]
2021-12-01 11:15:01 -05:00
# include "GameFramework/Actor.h"
# include "EngineUtils.h" // for TActorIterator<>
2021-10-21 16:57:00 -04:00
# include "Engine/StaticMesh.h"
2022-04-22 15:01:13 -04:00
# include "Components/BrushComponent.h"
Added support for world-space hit-testing and snapping to Volume and DynamicMeshComponent mesh vertices/edges/faces, by having Modeling Mode maintain a persistent set of spatial data structures for these scene meshes. With this change, new ToolSceneQueriesUtil functions can be used to provide more general scene mesh-element hit-testing/snapping via ModelingSceneSnappingManager. Updates to existing Tools/Mechanics to use these new query functions will be done in later CLs.
ToolsFramework:
- added new USceneSnappingManager::ExecuteSceneHitQuery API function, as well as accompanying FSceneHitQueryRequest/FSceneHitQueryResult structs
- added FSceneQueryVisibilityFilter struct which contains ComponentsToIgnore/InvisibleComponentsToInclude lists for snapping queries and provides shared IsVisible() implementation
ModelingComponents:
- add FLevelObjectsObserver, tracks Actors added/removed to a Level via various editor events
- add FSceneGeometrySpatialCache, maintains spatial data structures for known types of mesh-backed PrimitiveComponents, an octree based on their world-space bounding-boxes, and provides various spatial-query functions
- ModelingSceneSnappingManager now maintains a FSceneGeometrySpatialCache for a set of Actors/Components it is notified about, and updates the spatial cache if those components are modified or translated. Currently supports Volumes and DynamicMeshComponents.
- add ModelingSceneSnappingManager::ExecuteSceneHitQuery implementation, does raycasts into the world (for static mesh components) and FSceneGeometrySpatialCache for Volumes/DMCs
- modified ModelingSceneSnappingManager::ExecuteSceneSnapQuery to also do combined query against StaticMeshComponents via world-linetrace, and FSceneGeometrySpatialCache for Volumes/DMCs
- add ToolSceneQueriesUtil::FindNearestVisibleObjectHit variants that take a USceneSnappingManager or UInteractiveTool, and do queries via the SceneSnappingManger, instead of directly linetracing into a UWorld
ModleingToolsEditorMode:
- add FLevelObjectsObserver instance and use it to drive updates to active ModelingSceneSnappingManager
#rnx
#jira none
#preflight 61a664a09a226d9e823ad4c1
#ROBOMERGE-AUTHOR: ryan.schmidt
#ROBOMERGE-SOURCE: CL 18339853 in //UE5/Release-5.0/... via CL 18339869
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)
[CL 18339891 by ryan schmidt in ue5-release-engine-test branch]
2021-12-01 11:15:01 -05:00
# include "Components/DynamicMeshComponent.h"
2023-11-14 13:23:52 -05:00
# include "Components/PrimitiveComponent.h"
# include "Components/StaticMeshComponent.h"
# include "Components/ShapeComponent.h"
2022-10-26 12:57:32 -04:00
# include "RawIndexBuffer.h"
# include "StaticMeshResources.h"
Added support for world-space hit-testing and snapping to Volume and DynamicMeshComponent mesh vertices/edges/faces, by having Modeling Mode maintain a persistent set of spatial data structures for these scene meshes. With this change, new ToolSceneQueriesUtil functions can be used to provide more general scene mesh-element hit-testing/snapping via ModelingSceneSnappingManager. Updates to existing Tools/Mechanics to use these new query functions will be done in later CLs.
ToolsFramework:
- added new USceneSnappingManager::ExecuteSceneHitQuery API function, as well as accompanying FSceneHitQueryRequest/FSceneHitQueryResult structs
- added FSceneQueryVisibilityFilter struct which contains ComponentsToIgnore/InvisibleComponentsToInclude lists for snapping queries and provides shared IsVisible() implementation
ModelingComponents:
- add FLevelObjectsObserver, tracks Actors added/removed to a Level via various editor events
- add FSceneGeometrySpatialCache, maintains spatial data structures for known types of mesh-backed PrimitiveComponents, an octree based on their world-space bounding-boxes, and provides various spatial-query functions
- ModelingSceneSnappingManager now maintains a FSceneGeometrySpatialCache for a set of Actors/Components it is notified about, and updates the spatial cache if those components are modified or translated. Currently supports Volumes and DynamicMeshComponents.
- add ModelingSceneSnappingManager::ExecuteSceneHitQuery implementation, does raycasts into the world (for static mesh components) and FSceneGeometrySpatialCache for Volumes/DMCs
- modified ModelingSceneSnappingManager::ExecuteSceneSnapQuery to also do combined query against StaticMeshComponents via world-linetrace, and FSceneGeometrySpatialCache for Volumes/DMCs
- add ToolSceneQueriesUtil::FindNearestVisibleObjectHit variants that take a USceneSnappingManager or UInteractiveTool, and do queries via the SceneSnappingManger, instead of directly linetracing into a UWorld
ModleingToolsEditorMode:
- add FLevelObjectsObserver instance and use it to drive updates to active ModelingSceneSnappingManager
#rnx
#jira none
#preflight 61a664a09a226d9e823ad4c1
#ROBOMERGE-AUTHOR: ryan.schmidt
#ROBOMERGE-SOURCE: CL 18339853 in //UE5/Release-5.0/... via CL 18339869
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)
[CL 18339891 by ryan schmidt in ue5-release-engine-test branch]
2021-12-01 11:15:01 -05:00
# include "UObject/UObjectGlobals.h"
2022-12-15 17:03:36 -05:00
# include "VectorUtil.h"
# include "SegmentTypes.h"
2021-10-21 16:57:00 -04:00
2022-09-28 01:06:15 -04:00
# include UE_INLINE_GENERATED_CPP_BY_NAME(ModelingSceneSnappingManager)
Added support for world-space hit-testing and snapping to Volume and DynamicMeshComponent mesh vertices/edges/faces, by having Modeling Mode maintain a persistent set of spatial data structures for these scene meshes. With this change, new ToolSceneQueriesUtil functions can be used to provide more general scene mesh-element hit-testing/snapping via ModelingSceneSnappingManager. Updates to existing Tools/Mechanics to use these new query functions will be done in later CLs.
ToolsFramework:
- added new USceneSnappingManager::ExecuteSceneHitQuery API function, as well as accompanying FSceneHitQueryRequest/FSceneHitQueryResult structs
- added FSceneQueryVisibilityFilter struct which contains ComponentsToIgnore/InvisibleComponentsToInclude lists for snapping queries and provides shared IsVisible() implementation
ModelingComponents:
- add FLevelObjectsObserver, tracks Actors added/removed to a Level via various editor events
- add FSceneGeometrySpatialCache, maintains spatial data structures for known types of mesh-backed PrimitiveComponents, an octree based on their world-space bounding-boxes, and provides various spatial-query functions
- ModelingSceneSnappingManager now maintains a FSceneGeometrySpatialCache for a set of Actors/Components it is notified about, and updates the spatial cache if those components are modified or translated. Currently supports Volumes and DynamicMeshComponents.
- add ModelingSceneSnappingManager::ExecuteSceneHitQuery implementation, does raycasts into the world (for static mesh components) and FSceneGeometrySpatialCache for Volumes/DMCs
- modified ModelingSceneSnappingManager::ExecuteSceneSnapQuery to also do combined query against StaticMeshComponents via world-linetrace, and FSceneGeometrySpatialCache for Volumes/DMCs
- add ToolSceneQueriesUtil::FindNearestVisibleObjectHit variants that take a USceneSnappingManager or UInteractiveTool, and do queries via the SceneSnappingManger, instead of directly linetracing into a UWorld
ModleingToolsEditorMode:
- add FLevelObjectsObserver instance and use it to drive updates to active ModelingSceneSnappingManager
#rnx
#jira none
#preflight 61a664a09a226d9e823ad4c1
#ROBOMERGE-AUTHOR: ryan.schmidt
#ROBOMERGE-SOURCE: CL 18339853 in //UE5/Release-5.0/... via CL 18339869
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)
[CL 18339891 by ryan schmidt in ue5-release-engine-test branch]
2021-12-01 11:15:01 -05:00
using namespace UE : : Geometry ;
2021-10-21 16:57:00 -04:00
# define LOCTEXT_NAMESPACE "USceneSnappingManager"
2022-04-22 15:01:13 -04:00
// defined in SceneGeometrySpatialCache.cpp
extern TAutoConsoleVariable < bool > CVarEnableModelingVolumeSnapping ;
2021-10-21 16:57:00 -04:00
void UModelingSceneSnappingManager : : Initialize ( TObjectPtr < UInteractiveToolsContext > ToolsContext )
{
ParentContext = ToolsContext ;
QueriesAPI = ( ParentContext & & ParentContext - > ToolManager ) ?
ParentContext - > ToolManager - > GetContextQueriesAPI ( ) : nullptr ;
Added support for world-space hit-testing and snapping to Volume and DynamicMeshComponent mesh vertices/edges/faces, by having Modeling Mode maintain a persistent set of spatial data structures for these scene meshes. With this change, new ToolSceneQueriesUtil functions can be used to provide more general scene mesh-element hit-testing/snapping via ModelingSceneSnappingManager. Updates to existing Tools/Mechanics to use these new query functions will be done in later CLs.
ToolsFramework:
- added new USceneSnappingManager::ExecuteSceneHitQuery API function, as well as accompanying FSceneHitQueryRequest/FSceneHitQueryResult structs
- added FSceneQueryVisibilityFilter struct which contains ComponentsToIgnore/InvisibleComponentsToInclude lists for snapping queries and provides shared IsVisible() implementation
ModelingComponents:
- add FLevelObjectsObserver, tracks Actors added/removed to a Level via various editor events
- add FSceneGeometrySpatialCache, maintains spatial data structures for known types of mesh-backed PrimitiveComponents, an octree based on their world-space bounding-boxes, and provides various spatial-query functions
- ModelingSceneSnappingManager now maintains a FSceneGeometrySpatialCache for a set of Actors/Components it is notified about, and updates the spatial cache if those components are modified or translated. Currently supports Volumes and DynamicMeshComponents.
- add ModelingSceneSnappingManager::ExecuteSceneHitQuery implementation, does raycasts into the world (for static mesh components) and FSceneGeometrySpatialCache for Volumes/DMCs
- modified ModelingSceneSnappingManager::ExecuteSceneSnapQuery to also do combined query against StaticMeshComponents via world-linetrace, and FSceneGeometrySpatialCache for Volumes/DMCs
- add ToolSceneQueriesUtil::FindNearestVisibleObjectHit variants that take a USceneSnappingManager or UInteractiveTool, and do queries via the SceneSnappingManger, instead of directly linetracing into a UWorld
ModleingToolsEditorMode:
- add FLevelObjectsObserver instance and use it to drive updates to active ModelingSceneSnappingManager
#rnx
#jira none
#preflight 61a664a09a226d9e823ad4c1
#ROBOMERGE-AUTHOR: ryan.schmidt
#ROBOMERGE-SOURCE: CL 18339853 in //UE5/Release-5.0/... via CL 18339869
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)
[CL 18339891 by ryan schmidt in ue5-release-engine-test branch]
2021-12-01 11:15:01 -05:00
SpatialCache = MakeShared < FSceneGeometrySpatialCache > ( ) ;
# if WITH_EDITOR
OnObjectModifiedHandler = FCoreUObjectDelegates : : OnObjectModified . AddLambda ( [ this ] ( UObject * Object ) {
HandleGlobalObjectModifiedDelegate ( Object ) ;
} ) ;
if ( GEngine )
{
OnComponentTransformChangedHandle = GEngine - > OnComponentTransformChanged ( ) . AddLambda ( [ this ] ( USceneComponent * Component , ETeleportType ) {
HandleGlobalComponentTransformChangedDelegate ( Component ) ;
} ) ;
}
# endif
2021-10-21 16:57:00 -04:00
}
void UModelingSceneSnappingManager : : Shutdown ( )
{
Added support for world-space hit-testing and snapping to Volume and DynamicMeshComponent mesh vertices/edges/faces, by having Modeling Mode maintain a persistent set of spatial data structures for these scene meshes. With this change, new ToolSceneQueriesUtil functions can be used to provide more general scene mesh-element hit-testing/snapping via ModelingSceneSnappingManager. Updates to existing Tools/Mechanics to use these new query functions will be done in later CLs.
ToolsFramework:
- added new USceneSnappingManager::ExecuteSceneHitQuery API function, as well as accompanying FSceneHitQueryRequest/FSceneHitQueryResult structs
- added FSceneQueryVisibilityFilter struct which contains ComponentsToIgnore/InvisibleComponentsToInclude lists for snapping queries and provides shared IsVisible() implementation
ModelingComponents:
- add FLevelObjectsObserver, tracks Actors added/removed to a Level via various editor events
- add FSceneGeometrySpatialCache, maintains spatial data structures for known types of mesh-backed PrimitiveComponents, an octree based on their world-space bounding-boxes, and provides various spatial-query functions
- ModelingSceneSnappingManager now maintains a FSceneGeometrySpatialCache for a set of Actors/Components it is notified about, and updates the spatial cache if those components are modified or translated. Currently supports Volumes and DynamicMeshComponents.
- add ModelingSceneSnappingManager::ExecuteSceneHitQuery implementation, does raycasts into the world (for static mesh components) and FSceneGeometrySpatialCache for Volumes/DMCs
- modified ModelingSceneSnappingManager::ExecuteSceneSnapQuery to also do combined query against StaticMeshComponents via world-linetrace, and FSceneGeometrySpatialCache for Volumes/DMCs
- add ToolSceneQueriesUtil::FindNearestVisibleObjectHit variants that take a USceneSnappingManager or UInteractiveTool, and do queries via the SceneSnappingManger, instead of directly linetracing into a UWorld
ModleingToolsEditorMode:
- add FLevelObjectsObserver instance and use it to drive updates to active ModelingSceneSnappingManager
#rnx
#jira none
#preflight 61a664a09a226d9e823ad4c1
#ROBOMERGE-AUTHOR: ryan.schmidt
#ROBOMERGE-SOURCE: CL 18339853 in //UE5/Release-5.0/... via CL 18339869
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)
[CL 18339891 by ryan schmidt in ue5-release-engine-test branch]
2021-12-01 11:15:01 -05:00
# if WITH_EDITOR
FCoreUObjectDelegates : : OnObjectModified . Remove ( OnObjectModifiedHandler ) ;
2021-10-21 16:57:00 -04:00
Added support for world-space hit-testing and snapping to Volume and DynamicMeshComponent mesh vertices/edges/faces, by having Modeling Mode maintain a persistent set of spatial data structures for these scene meshes. With this change, new ToolSceneQueriesUtil functions can be used to provide more general scene mesh-element hit-testing/snapping via ModelingSceneSnappingManager. Updates to existing Tools/Mechanics to use these new query functions will be done in later CLs.
ToolsFramework:
- added new USceneSnappingManager::ExecuteSceneHitQuery API function, as well as accompanying FSceneHitQueryRequest/FSceneHitQueryResult structs
- added FSceneQueryVisibilityFilter struct which contains ComponentsToIgnore/InvisibleComponentsToInclude lists for snapping queries and provides shared IsVisible() implementation
ModelingComponents:
- add FLevelObjectsObserver, tracks Actors added/removed to a Level via various editor events
- add FSceneGeometrySpatialCache, maintains spatial data structures for known types of mesh-backed PrimitiveComponents, an octree based on their world-space bounding-boxes, and provides various spatial-query functions
- ModelingSceneSnappingManager now maintains a FSceneGeometrySpatialCache for a set of Actors/Components it is notified about, and updates the spatial cache if those components are modified or translated. Currently supports Volumes and DynamicMeshComponents.
- add ModelingSceneSnappingManager::ExecuteSceneHitQuery implementation, does raycasts into the world (for static mesh components) and FSceneGeometrySpatialCache for Volumes/DMCs
- modified ModelingSceneSnappingManager::ExecuteSceneSnapQuery to also do combined query against StaticMeshComponents via world-linetrace, and FSceneGeometrySpatialCache for Volumes/DMCs
- add ToolSceneQueriesUtil::FindNearestVisibleObjectHit variants that take a USceneSnappingManager or UInteractiveTool, and do queries via the SceneSnappingManger, instead of directly linetracing into a UWorld
ModleingToolsEditorMode:
- add FLevelObjectsObserver instance and use it to drive updates to active ModelingSceneSnappingManager
#rnx
#jira none
#preflight 61a664a09a226d9e823ad4c1
#ROBOMERGE-AUTHOR: ryan.schmidt
#ROBOMERGE-SOURCE: CL 18339853 in //UE5/Release-5.0/... via CL 18339869
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)
[CL 18339891 by ryan schmidt in ue5-release-engine-test branch]
2021-12-01 11:15:01 -05:00
if ( GEngine )
{
GEngine - > OnComponentTransformChanged ( ) . Remove ( OnComponentTransformChangedHandle ) ;
}
# endif
}
bool UModelingSceneSnappingManager : : IsComponentTypeSupported ( const UPrimitiveComponent * Component ) const
{
// supported types
return ( Cast < UStaticMeshComponent > ( Component ) ! = nullptr | |
Cast < UBrushComponent > ( Component ) ! = nullptr | |
Cast < UDynamicMeshComponent > ( Component ) ! = nullptr ) ;
}
void UModelingSceneSnappingManager : : OnActorAdded ( AActor * Actor , TFunctionRef < bool ( UPrimitiveComponent * ) > PrimitiveFilter )
{
// TODO: additional filtering here?
// ignore internal tool framework Actors
if ( Cast < AInternalToolFrameworkActor > ( Actor ) ! = nullptr )
{
return ;
}
TArray < AActor * > AllActors ;
Actor - > GetAllChildActors ( AllActors , true ) ;
AllActors . Add ( Actor ) ;
for ( AActor * ProcessActor : AllActors )
{
for ( UActorComponent * Component : ProcessActor - > GetComponents ( ) )
{
UPrimitiveComponent * PrimComponent = Cast < UPrimitiveComponent > ( Component ) ;
if ( PrimComponent & & PrimitiveFilter ( PrimComponent ) )
{
OnComponentAdded ( PrimComponent ) ;
}
}
}
}
void UModelingSceneSnappingManager : : OnActorRemoved ( AActor * Actor )
{
// cannot assume actor is still valid...
TArray < UPrimitiveComponent * > ToRemove ;
for ( TPair < UPrimitiveComponent * , AActor * > Pair : ComponentToActorMap )
{
if ( Pair . Value = = Actor )
{
ToRemove . Add ( Pair . Key ) ;
}
}
for ( UPrimitiveComponent * Component : ToRemove )
{
OnComponentRemoved ( Component ) ;
}
}
void UModelingSceneSnappingManager : : OnComponentAdded ( UPrimitiveComponent * Component )
{
if ( Component - > GetOwner ( ) = = nullptr )
{
return ;
}
if ( IsComponentTypeSupported ( Component ) = = false )
{
return ;
}
UE : : Geometry : : FSceneGeometryID GeometryID ;
SpatialCache - > EnableComponentTracking ( Component , GeometryID ) ;
ComponentToActorMap . Add ( Component , Component - > GetOwner ( ) ) ;
// UDynamicMeshComponent gets special treatment because it has an explicit mesh-modified handler
// we can rely on to detect geometry changes
if ( UDynamicMeshComponent * DynamicMeshComponent = Cast < UDynamicMeshComponent > ( Component ) )
{
DynamicMeshComponent - > OnMeshChanged . AddUObject ( this , & UModelingSceneSnappingManager : : HandleDynamicMeshModifiedDelegate , DynamicMeshComponent ) ;
DynamicMeshComponents . Add ( DynamicMeshComponent , TWeakObjectPtr < UDynamicMeshComponent > ( DynamicMeshComponent ) ) ;
}
}
void UModelingSceneSnappingManager : : OnComponentRemoved ( UPrimitiveComponent * Component )
{
SpatialCache - > DisableComponentTracking ( Component ) ;
ComponentToActorMap . Remove ( Component ) ;
// If this is a DynamicMeshComponent, we want to stop listening to mesh change events, but
// we need to make sure it is still alive first.
TWeakObjectPtr < UDynamicMeshComponent > * FoundDynamicMesh = DynamicMeshComponents . Find ( Component ) ;
if ( FoundDynamicMesh ! = nullptr )
{
if ( FoundDynamicMesh - > IsValid ( ) )
{
UDynamicMeshComponent * DynamicMeshComponent = FoundDynamicMesh - > Get ( ) ;
DynamicMeshComponent - > OnMeshChanged . RemoveAll ( this ) ;
}
DynamicMeshComponents . Remove ( Component ) ;
}
}
void UModelingSceneSnappingManager : : HandleGlobalObjectModifiedDelegate ( UObject * Object )
{
if ( Cast < UDynamicMeshComponent > ( Object ) )
{
return ; // have special-case handling
}
UPrimitiveComponent * PrimComponent = Cast < UPrimitiveComponent > ( Object ) ;
if ( PrimComponent )
{
OnComponentModified ( PrimComponent ) ;
}
}
void UModelingSceneSnappingManager : : OnComponentModified ( UActorComponent * Component )
{
const bool bDeferRebuild = false ;
UPrimitiveComponent * PrimComponent = Cast < UPrimitiveComponent > ( Component ) ;
if ( PrimComponent )
{
SpatialCache - > NotifyGeometryUpdate ( PrimComponent , bDeferRebuild ) ;
}
}
void UModelingSceneSnappingManager : : HandleGlobalComponentTransformChangedDelegate ( USceneComponent * Component )
{
UPrimitiveComponent * PrimComponent = Cast < UPrimitiveComponent > ( Component ) ;
if ( PrimComponent & & ComponentToActorMap . Contains ( PrimComponent ) )
{
SpatialCache - > NotifyTransformUpdate ( PrimComponent ) ;
}
}
void UModelingSceneSnappingManager : : HandleDynamicMeshModifiedDelegate ( UDynamicMeshComponent * Component )
{
2022-06-16 15:25:58 -04:00
if ( bQueueModifiedDynamicMeshUpdates )
{
PendingModifiedDynamicMeshes . Add ( Component ) ;
}
else
{
const bool bDeferRebuild = false ;
SpatialCache - > NotifyGeometryUpdate ( Component , bDeferRebuild ) ;
}
Added support for world-space hit-testing and snapping to Volume and DynamicMeshComponent mesh vertices/edges/faces, by having Modeling Mode maintain a persistent set of spatial data structures for these scene meshes. With this change, new ToolSceneQueriesUtil functions can be used to provide more general scene mesh-element hit-testing/snapping via ModelingSceneSnappingManager. Updates to existing Tools/Mechanics to use these new query functions will be done in later CLs.
ToolsFramework:
- added new USceneSnappingManager::ExecuteSceneHitQuery API function, as well as accompanying FSceneHitQueryRequest/FSceneHitQueryResult structs
- added FSceneQueryVisibilityFilter struct which contains ComponentsToIgnore/InvisibleComponentsToInclude lists for snapping queries and provides shared IsVisible() implementation
ModelingComponents:
- add FLevelObjectsObserver, tracks Actors added/removed to a Level via various editor events
- add FSceneGeometrySpatialCache, maintains spatial data structures for known types of mesh-backed PrimitiveComponents, an octree based on their world-space bounding-boxes, and provides various spatial-query functions
- ModelingSceneSnappingManager now maintains a FSceneGeometrySpatialCache for a set of Actors/Components it is notified about, and updates the spatial cache if those components are modified or translated. Currently supports Volumes and DynamicMeshComponents.
- add ModelingSceneSnappingManager::ExecuteSceneHitQuery implementation, does raycasts into the world (for static mesh components) and FSceneGeometrySpatialCache for Volumes/DMCs
- modified ModelingSceneSnappingManager::ExecuteSceneSnapQuery to also do combined query against StaticMeshComponents via world-linetrace, and FSceneGeometrySpatialCache for Volumes/DMCs
- add ToolSceneQueriesUtil::FindNearestVisibleObjectHit variants that take a USceneSnappingManager or UInteractiveTool, and do queries via the SceneSnappingManger, instead of directly linetracing into a UWorld
ModleingToolsEditorMode:
- add FLevelObjectsObserver instance and use it to drive updates to active ModelingSceneSnappingManager
#rnx
#jira none
#preflight 61a664a09a226d9e823ad4c1
#ROBOMERGE-AUTHOR: ryan.schmidt
#ROBOMERGE-SOURCE: CL 18339853 in //UE5/Release-5.0/... via CL 18339869
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)
[CL 18339891 by ryan schmidt in ue5-release-engine-test branch]
2021-12-01 11:15:01 -05:00
}
2022-06-16 15:25:58 -04:00
void UModelingSceneSnappingManager : : PauseSceneGeometryUpdates ( )
{
ensure ( bQueueModifiedDynamicMeshUpdates = = false ) ;
bQueueModifiedDynamicMeshUpdates = true ;
}
void UModelingSceneSnappingManager : : UnPauseSceneGeometryUpdates ( bool bImmediateRebuilds )
{
if ( ensure ( bQueueModifiedDynamicMeshUpdates ) )
{
for ( UDynamicMeshComponent * Component : PendingModifiedDynamicMeshes )
{
SpatialCache - > NotifyGeometryUpdate ( Component , ! bImmediateRebuilds ) ;
}
PendingModifiedDynamicMeshes . Reset ( ) ;
bQueueModifiedDynamicMeshUpdates = false ;
}
}
Added support for world-space hit-testing and snapping to Volume and DynamicMeshComponent mesh vertices/edges/faces, by having Modeling Mode maintain a persistent set of spatial data structures for these scene meshes. With this change, new ToolSceneQueriesUtil functions can be used to provide more general scene mesh-element hit-testing/snapping via ModelingSceneSnappingManager. Updates to existing Tools/Mechanics to use these new query functions will be done in later CLs.
ToolsFramework:
- added new USceneSnappingManager::ExecuteSceneHitQuery API function, as well as accompanying FSceneHitQueryRequest/FSceneHitQueryResult structs
- added FSceneQueryVisibilityFilter struct which contains ComponentsToIgnore/InvisibleComponentsToInclude lists for snapping queries and provides shared IsVisible() implementation
ModelingComponents:
- add FLevelObjectsObserver, tracks Actors added/removed to a Level via various editor events
- add FSceneGeometrySpatialCache, maintains spatial data structures for known types of mesh-backed PrimitiveComponents, an octree based on their world-space bounding-boxes, and provides various spatial-query functions
- ModelingSceneSnappingManager now maintains a FSceneGeometrySpatialCache for a set of Actors/Components it is notified about, and updates the spatial cache if those components are modified or translated. Currently supports Volumes and DynamicMeshComponents.
- add ModelingSceneSnappingManager::ExecuteSceneHitQuery implementation, does raycasts into the world (for static mesh components) and FSceneGeometrySpatialCache for Volumes/DMCs
- modified ModelingSceneSnappingManager::ExecuteSceneSnapQuery to also do combined query against StaticMeshComponents via world-linetrace, and FSceneGeometrySpatialCache for Volumes/DMCs
- add ToolSceneQueriesUtil::FindNearestVisibleObjectHit variants that take a USceneSnappingManager or UInteractiveTool, and do queries via the SceneSnappingManger, instead of directly linetracing into a UWorld
ModleingToolsEditorMode:
- add FLevelObjectsObserver instance and use it to drive updates to active ModelingSceneSnappingManager
#rnx
#jira none
#preflight 61a664a09a226d9e823ad4c1
#ROBOMERGE-AUTHOR: ryan.schmidt
#ROBOMERGE-SOURCE: CL 18339853 in //UE5/Release-5.0/... via CL 18339869
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)
[CL 18339891 by ryan schmidt in ue5-release-engine-test branch]
2021-12-01 11:15:01 -05:00
void UModelingSceneSnappingManager : : BuildSpatialCacheForWorld (
UWorld * World ,
TFunctionRef < bool ( AActor * ) > ActorFilter ,
TFunctionRef < bool ( UPrimitiveComponent * ) > PrimitiveFilter )
{
for ( TActorIterator < AActor > ActorItr ( World ) ; ActorItr ; + + ActorItr )
{
if ( ActorFilter ( * ActorItr ) )
{
OnActorAdded ( * ActorItr , PrimitiveFilter ) ;
}
}
2021-10-21 16:57:00 -04:00
}
bool UModelingSceneSnappingManager : : ExecuteSceneSnapQuery ( const FSceneSnapQueryRequest & Request , TArray < FSceneSnapQueryResult > & Results ) const
{
switch ( Request . RequestType )
{
case ESceneSnapQueryType : : Position :
return ExecuteSceneSnapQueryPosition ( Request , Results ) ;
case ESceneSnapQueryType : : Rotation :
return ExecuteSceneSnapQueryRotation ( Request , Results ) ;
default :
check ( ! " Only Position and Rotation Snap Queries are supported " ) ;
}
return false ;
}
bool UModelingSceneSnappingManager : : ExecuteSceneSnapQueryRotation ( const FSceneSnapQueryRequest & Request , TArray < FSceneSnapQueryResult > & Results ) const
{
if ( ! QueriesAPI )
{
return false ;
}
if ( ( Request . TargetTypes & ESceneSnapQueryTargetType : : Grid ) ! = ESceneSnapQueryTargetType : : None )
{
FToolContextSnappingConfiguration SnappingConfig = QueriesAPI - > GetCurrentSnappingSettings ( ) ;
if ( SnappingConfig . bEnableRotationGridSnapping )
{
FRotator Rotator ( Request . DeltaRotation ) ;
FRotator RotGrid = Request . RotGridSize . Get ( SnappingConfig . RotationGridAngles ) ;
Rotator = Rotator . GridSnap ( RotGrid ) ;
FSceneSnapQueryResult SnapResult ;
SnapResult . TargetType = ESceneSnapQueryTargetType : : Grid ;
SnapResult . DeltaRotation = Rotator . Quaternion ( ) ;
Results . Add ( SnapResult ) ;
return true ;
}
}
return false ;
}
Added support for world-space hit-testing and snapping to Volume and DynamicMeshComponent mesh vertices/edges/faces, by having Modeling Mode maintain a persistent set of spatial data structures for these scene meshes. With this change, new ToolSceneQueriesUtil functions can be used to provide more general scene mesh-element hit-testing/snapping via ModelingSceneSnappingManager. Updates to existing Tools/Mechanics to use these new query functions will be done in later CLs.
ToolsFramework:
- added new USceneSnappingManager::ExecuteSceneHitQuery API function, as well as accompanying FSceneHitQueryRequest/FSceneHitQueryResult structs
- added FSceneQueryVisibilityFilter struct which contains ComponentsToIgnore/InvisibleComponentsToInclude lists for snapping queries and provides shared IsVisible() implementation
ModelingComponents:
- add FLevelObjectsObserver, tracks Actors added/removed to a Level via various editor events
- add FSceneGeometrySpatialCache, maintains spatial data structures for known types of mesh-backed PrimitiveComponents, an octree based on their world-space bounding-boxes, and provides various spatial-query functions
- ModelingSceneSnappingManager now maintains a FSceneGeometrySpatialCache for a set of Actors/Components it is notified about, and updates the spatial cache if those components are modified or translated. Currently supports Volumes and DynamicMeshComponents.
- add ModelingSceneSnappingManager::ExecuteSceneHitQuery implementation, does raycasts into the world (for static mesh components) and FSceneGeometrySpatialCache for Volumes/DMCs
- modified ModelingSceneSnappingManager::ExecuteSceneSnapQuery to also do combined query against StaticMeshComponents via world-linetrace, and FSceneGeometrySpatialCache for Volumes/DMCs
- add ToolSceneQueriesUtil::FindNearestVisibleObjectHit variants that take a USceneSnappingManager or UInteractiveTool, and do queries via the SceneSnappingManger, instead of directly linetracing into a UWorld
ModleingToolsEditorMode:
- add FLevelObjectsObserver instance and use it to drive updates to active ModelingSceneSnappingManager
#rnx
#jira none
#preflight 61a664a09a226d9e823ad4c1
#ROBOMERGE-AUTHOR: ryan.schmidt
#ROBOMERGE-SOURCE: CL 18339853 in //UE5/Release-5.0/... via CL 18339869
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)
[CL 18339891 by ryan schmidt in ue5-release-engine-test branch]
2021-12-01 11:15:01 -05:00
static bool FindNearestVisibleObjectHit_Internal (
UWorld * World ,
FHitResult & HitResultOut ,
const FRay3d & Ray ,
bool bIsSceneGeometrySnapQuery ,
const FSceneQueryVisibilityFilter & VisibilityFilter ,
UE : : Geometry : : FSceneGeometrySpatialCache * SpatialCache )
2021-10-21 16:57:00 -04:00
{
FCollisionObjectQueryParams ObjectQueryParams ( FCollisionObjectQueryParams : : AllObjects ) ;
FCollisionQueryParams QueryParams = FCollisionQueryParams : : DefaultQueryParam ;
QueryParams . bTraceComplex = true ;
QueryParams . bReturnFaceIndex = bIsSceneGeometrySnapQuery ;
Added support for world-space hit-testing and snapping to Volume and DynamicMeshComponent mesh vertices/edges/faces, by having Modeling Mode maintain a persistent set of spatial data structures for these scene meshes. With this change, new ToolSceneQueriesUtil functions can be used to provide more general scene mesh-element hit-testing/snapping via ModelingSceneSnappingManager. Updates to existing Tools/Mechanics to use these new query functions will be done in later CLs.
ToolsFramework:
- added new USceneSnappingManager::ExecuteSceneHitQuery API function, as well as accompanying FSceneHitQueryRequest/FSceneHitQueryResult structs
- added FSceneQueryVisibilityFilter struct which contains ComponentsToIgnore/InvisibleComponentsToInclude lists for snapping queries and provides shared IsVisible() implementation
ModelingComponents:
- add FLevelObjectsObserver, tracks Actors added/removed to a Level via various editor events
- add FSceneGeometrySpatialCache, maintains spatial data structures for known types of mesh-backed PrimitiveComponents, an octree based on their world-space bounding-boxes, and provides various spatial-query functions
- ModelingSceneSnappingManager now maintains a FSceneGeometrySpatialCache for a set of Actors/Components it is notified about, and updates the spatial cache if those components are modified or translated. Currently supports Volumes and DynamicMeshComponents.
- add ModelingSceneSnappingManager::ExecuteSceneHitQuery implementation, does raycasts into the world (for static mesh components) and FSceneGeometrySpatialCache for Volumes/DMCs
- modified ModelingSceneSnappingManager::ExecuteSceneSnapQuery to also do combined query against StaticMeshComponents via world-linetrace, and FSceneGeometrySpatialCache for Volumes/DMCs
- add ToolSceneQueriesUtil::FindNearestVisibleObjectHit variants that take a USceneSnappingManager or UInteractiveTool, and do queries via the SceneSnappingManger, instead of directly linetracing into a UWorld
ModleingToolsEditorMode:
- add FLevelObjectsObserver instance and use it to drive updates to active ModelingSceneSnappingManager
#rnx
#jira none
#preflight 61a664a09a226d9e823ad4c1
#ROBOMERGE-AUTHOR: ryan.schmidt
#ROBOMERGE-SOURCE: CL 18339853 in //UE5/Release-5.0/... via CL 18339869
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)
[CL 18339891 by ryan schmidt in ue5-release-engine-test branch]
2021-12-01 11:15:01 -05:00
// TODO: QueryParams.AddIgnoredComponents ?
2021-10-21 16:57:00 -04:00
TArray < FHitResult > OutHits ;
Added support for world-space hit-testing and snapping to Volume and DynamicMeshComponent mesh vertices/edges/faces, by having Modeling Mode maintain a persistent set of spatial data structures for these scene meshes. With this change, new ToolSceneQueriesUtil functions can be used to provide more general scene mesh-element hit-testing/snapping via ModelingSceneSnappingManager. Updates to existing Tools/Mechanics to use these new query functions will be done in later CLs.
ToolsFramework:
- added new USceneSnappingManager::ExecuteSceneHitQuery API function, as well as accompanying FSceneHitQueryRequest/FSceneHitQueryResult structs
- added FSceneQueryVisibilityFilter struct which contains ComponentsToIgnore/InvisibleComponentsToInclude lists for snapping queries and provides shared IsVisible() implementation
ModelingComponents:
- add FLevelObjectsObserver, tracks Actors added/removed to a Level via various editor events
- add FSceneGeometrySpatialCache, maintains spatial data structures for known types of mesh-backed PrimitiveComponents, an octree based on their world-space bounding-boxes, and provides various spatial-query functions
- ModelingSceneSnappingManager now maintains a FSceneGeometrySpatialCache for a set of Actors/Components it is notified about, and updates the spatial cache if those components are modified or translated. Currently supports Volumes and DynamicMeshComponents.
- add ModelingSceneSnappingManager::ExecuteSceneHitQuery implementation, does raycasts into the world (for static mesh components) and FSceneGeometrySpatialCache for Volumes/DMCs
- modified ModelingSceneSnappingManager::ExecuteSceneSnapQuery to also do combined query against StaticMeshComponents via world-linetrace, and FSceneGeometrySpatialCache for Volumes/DMCs
- add ToolSceneQueriesUtil::FindNearestVisibleObjectHit variants that take a USceneSnappingManager or UInteractiveTool, and do queries via the SceneSnappingManger, instead of directly linetracing into a UWorld
ModleingToolsEditorMode:
- add FLevelObjectsObserver instance and use it to drive updates to active ModelingSceneSnappingManager
#rnx
#jira none
#preflight 61a664a09a226d9e823ad4c1
#ROBOMERGE-AUTHOR: ryan.schmidt
#ROBOMERGE-SOURCE: CL 18339853 in //UE5/Release-5.0/... via CL 18339869
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)
[CL 18339891 by ryan schmidt in ue5-release-engine-test branch]
2021-12-01 11:15:01 -05:00
FVector RayEnd = ( FVector ) ( Ray . PointAt ( HALF_WORLD_MAX ) ) ;
if ( World - > LineTraceMultiByObjectType ( OutHits , ( FVector ) Ray . Origin , RayEnd , ObjectQueryParams , QueryParams ) = = false )
2021-10-21 16:57:00 -04:00
{
return false ;
}
2022-04-22 15:01:13 -04:00
bool bEnableVolumes = CVarEnableModelingVolumeSnapping . GetValueOnAnyThread ( ) ;
2022-02-14 18:32:46 -05:00
double NearestVisible = TNumericLimits < double > : : Max ( ) ;
2021-10-21 16:57:00 -04:00
for ( const FHitResult & CurResult : OutHits )
{
Added support for world-space hit-testing and snapping to Volume and DynamicMeshComponent mesh vertices/edges/faces, by having Modeling Mode maintain a persistent set of spatial data structures for these scene meshes. With this change, new ToolSceneQueriesUtil functions can be used to provide more general scene mesh-element hit-testing/snapping via ModelingSceneSnappingManager. Updates to existing Tools/Mechanics to use these new query functions will be done in later CLs.
ToolsFramework:
- added new USceneSnappingManager::ExecuteSceneHitQuery API function, as well as accompanying FSceneHitQueryRequest/FSceneHitQueryResult structs
- added FSceneQueryVisibilityFilter struct which contains ComponentsToIgnore/InvisibleComponentsToInclude lists for snapping queries and provides shared IsVisible() implementation
ModelingComponents:
- add FLevelObjectsObserver, tracks Actors added/removed to a Level via various editor events
- add FSceneGeometrySpatialCache, maintains spatial data structures for known types of mesh-backed PrimitiveComponents, an octree based on their world-space bounding-boxes, and provides various spatial-query functions
- ModelingSceneSnappingManager now maintains a FSceneGeometrySpatialCache for a set of Actors/Components it is notified about, and updates the spatial cache if those components are modified or translated. Currently supports Volumes and DynamicMeshComponents.
- add ModelingSceneSnappingManager::ExecuteSceneHitQuery implementation, does raycasts into the world (for static mesh components) and FSceneGeometrySpatialCache for Volumes/DMCs
- modified ModelingSceneSnappingManager::ExecuteSceneSnapQuery to also do combined query against StaticMeshComponents via world-linetrace, and FSceneGeometrySpatialCache for Volumes/DMCs
- add ToolSceneQueriesUtil::FindNearestVisibleObjectHit variants that take a USceneSnappingManager or UInteractiveTool, and do queries via the SceneSnappingManger, instead of directly linetracing into a UWorld
ModleingToolsEditorMode:
- add FLevelObjectsObserver instance and use it to drive updates to active ModelingSceneSnappingManager
#rnx
#jira none
#preflight 61a664a09a226d9e823ad4c1
#ROBOMERGE-AUTHOR: ryan.schmidt
#ROBOMERGE-SOURCE: CL 18339853 in //UE5/Release-5.0/... via CL 18339869
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)
[CL 18339891 by ryan schmidt in ue5-release-engine-test branch]
2021-12-01 11:15:01 -05:00
// if we have hit Component in the SpatialCache, prefer to use that
if ( SpatialCache & & SpatialCache - > HaveCacheForComponent ( CurResult . GetComponent ( ) ) )
2021-10-21 16:57:00 -04:00
{
Added support for world-space hit-testing and snapping to Volume and DynamicMeshComponent mesh vertices/edges/faces, by having Modeling Mode maintain a persistent set of spatial data structures for these scene meshes. With this change, new ToolSceneQueriesUtil functions can be used to provide more general scene mesh-element hit-testing/snapping via ModelingSceneSnappingManager. Updates to existing Tools/Mechanics to use these new query functions will be done in later CLs.
ToolsFramework:
- added new USceneSnappingManager::ExecuteSceneHitQuery API function, as well as accompanying FSceneHitQueryRequest/FSceneHitQueryResult structs
- added FSceneQueryVisibilityFilter struct which contains ComponentsToIgnore/InvisibleComponentsToInclude lists for snapping queries and provides shared IsVisible() implementation
ModelingComponents:
- add FLevelObjectsObserver, tracks Actors added/removed to a Level via various editor events
- add FSceneGeometrySpatialCache, maintains spatial data structures for known types of mesh-backed PrimitiveComponents, an octree based on their world-space bounding-boxes, and provides various spatial-query functions
- ModelingSceneSnappingManager now maintains a FSceneGeometrySpatialCache for a set of Actors/Components it is notified about, and updates the spatial cache if those components are modified or translated. Currently supports Volumes and DynamicMeshComponents.
- add ModelingSceneSnappingManager::ExecuteSceneHitQuery implementation, does raycasts into the world (for static mesh components) and FSceneGeometrySpatialCache for Volumes/DMCs
- modified ModelingSceneSnappingManager::ExecuteSceneSnapQuery to also do combined query against StaticMeshComponents via world-linetrace, and FSceneGeometrySpatialCache for Volumes/DMCs
- add ToolSceneQueriesUtil::FindNearestVisibleObjectHit variants that take a USceneSnappingManager or UInteractiveTool, and do queries via the SceneSnappingManger, instead of directly linetracing into a UWorld
ModleingToolsEditorMode:
- add FLevelObjectsObserver instance and use it to drive updates to active ModelingSceneSnappingManager
#rnx
#jira none
#preflight 61a664a09a226d9e823ad4c1
#ROBOMERGE-AUTHOR: ryan.schmidt
#ROBOMERGE-SOURCE: CL 18339853 in //UE5/Release-5.0/... via CL 18339869
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)
[CL 18339891 by ryan schmidt in ue5-release-engine-test branch]
2021-12-01 11:15:01 -05:00
continue ;
}
2022-04-22 15:01:13 -04:00
// filtering out any volume hits here will disable volume snapping
2023-11-14 13:23:52 -05:00
// shape components are also commonly used to represent simple volumes, so if we are filtering out volume hits, we filter out both brush and shape components
if ( bEnableVolumes = = false & & ( Cast < UBrushComponent > ( CurResult . GetComponent ( ) ) ! = nullptr | | Cast < UShapeComponent > ( CurResult . GetComponent ( ) ) ! = nullptr ) )
2022-04-22 15:01:13 -04:00
{
continue ;
}
Added support for world-space hit-testing and snapping to Volume and DynamicMeshComponent mesh vertices/edges/faces, by having Modeling Mode maintain a persistent set of spatial data structures for these scene meshes. With this change, new ToolSceneQueriesUtil functions can be used to provide more general scene mesh-element hit-testing/snapping via ModelingSceneSnappingManager. Updates to existing Tools/Mechanics to use these new query functions will be done in later CLs.
ToolsFramework:
- added new USceneSnappingManager::ExecuteSceneHitQuery API function, as well as accompanying FSceneHitQueryRequest/FSceneHitQueryResult structs
- added FSceneQueryVisibilityFilter struct which contains ComponentsToIgnore/InvisibleComponentsToInclude lists for snapping queries and provides shared IsVisible() implementation
ModelingComponents:
- add FLevelObjectsObserver, tracks Actors added/removed to a Level via various editor events
- add FSceneGeometrySpatialCache, maintains spatial data structures for known types of mesh-backed PrimitiveComponents, an octree based on their world-space bounding-boxes, and provides various spatial-query functions
- ModelingSceneSnappingManager now maintains a FSceneGeometrySpatialCache for a set of Actors/Components it is notified about, and updates the spatial cache if those components are modified or translated. Currently supports Volumes and DynamicMeshComponents.
- add ModelingSceneSnappingManager::ExecuteSceneHitQuery implementation, does raycasts into the world (for static mesh components) and FSceneGeometrySpatialCache for Volumes/DMCs
- modified ModelingSceneSnappingManager::ExecuteSceneSnapQuery to also do combined query against StaticMeshComponents via world-linetrace, and FSceneGeometrySpatialCache for Volumes/DMCs
- add ToolSceneQueriesUtil::FindNearestVisibleObjectHit variants that take a USceneSnappingManager or UInteractiveTool, and do queries via the SceneSnappingManger, instead of directly linetracing into a UWorld
ModleingToolsEditorMode:
- add FLevelObjectsObserver instance and use it to drive updates to active ModelingSceneSnappingManager
#rnx
#jira none
#preflight 61a664a09a226d9e823ad4c1
#ROBOMERGE-AUTHOR: ryan.schmidt
#ROBOMERGE-SOURCE: CL 18339853 in //UE5/Release-5.0/... via CL 18339869
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)
[CL 18339891 by ryan schmidt in ue5-release-engine-test branch]
2021-12-01 11:15:01 -05:00
if ( CurResult . Distance < NearestVisible & & VisibilityFilter . IsVisible ( CurResult . Component . Get ( ) ) )
{
HitResultOut = CurResult ;
NearestVisible = CurResult . Distance ;
2021-10-21 16:57:00 -04:00
}
}
2022-02-14 18:32:46 -05:00
return NearestVisible < TNumericLimits < double > : : Max ( ) ;
2021-10-21 16:57:00 -04:00
}
Added support for world-space hit-testing and snapping to Volume and DynamicMeshComponent mesh vertices/edges/faces, by having Modeling Mode maintain a persistent set of spatial data structures for these scene meshes. With this change, new ToolSceneQueriesUtil functions can be used to provide more general scene mesh-element hit-testing/snapping via ModelingSceneSnappingManager. Updates to existing Tools/Mechanics to use these new query functions will be done in later CLs.
ToolsFramework:
- added new USceneSnappingManager::ExecuteSceneHitQuery API function, as well as accompanying FSceneHitQueryRequest/FSceneHitQueryResult structs
- added FSceneQueryVisibilityFilter struct which contains ComponentsToIgnore/InvisibleComponentsToInclude lists for snapping queries and provides shared IsVisible() implementation
ModelingComponents:
- add FLevelObjectsObserver, tracks Actors added/removed to a Level via various editor events
- add FSceneGeometrySpatialCache, maintains spatial data structures for known types of mesh-backed PrimitiveComponents, an octree based on their world-space bounding-boxes, and provides various spatial-query functions
- ModelingSceneSnappingManager now maintains a FSceneGeometrySpatialCache for a set of Actors/Components it is notified about, and updates the spatial cache if those components are modified or translated. Currently supports Volumes and DynamicMeshComponents.
- add ModelingSceneSnappingManager::ExecuteSceneHitQuery implementation, does raycasts into the world (for static mesh components) and FSceneGeometrySpatialCache for Volumes/DMCs
- modified ModelingSceneSnappingManager::ExecuteSceneSnapQuery to also do combined query against StaticMeshComponents via world-linetrace, and FSceneGeometrySpatialCache for Volumes/DMCs
- add ToolSceneQueriesUtil::FindNearestVisibleObjectHit variants that take a USceneSnappingManager or UInteractiveTool, and do queries via the SceneSnappingManger, instead of directly linetracing into a UWorld
ModleingToolsEditorMode:
- add FLevelObjectsObserver instance and use it to drive updates to active ModelingSceneSnappingManager
#rnx
#jira none
#preflight 61a664a09a226d9e823ad4c1
#ROBOMERGE-AUTHOR: ryan.schmidt
#ROBOMERGE-SOURCE: CL 18339853 in //UE5/Release-5.0/... via CL 18339869
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)
[CL 18339891 by ryan schmidt in ue5-release-engine-test branch]
2021-12-01 11:15:01 -05:00
template < typename VectorType >
bool GetComponentHitTriangle_Internal ( FHitResult HitResult , VectorType * TriVertices )
{
if ( HitResult . Component . IsValid ( ) = = false | | HitResult . FaceIndex < 0 )
{
return false ;
}
2023-03-16 01:21:34 -04:00
UStaticMeshComponent * Component = Cast < UStaticMeshComponent > ( HitResult . Component . Get ( ) ) ;
if ( ! Component )
Added support for world-space hit-testing and snapping to Volume and DynamicMeshComponent mesh vertices/edges/faces, by having Modeling Mode maintain a persistent set of spatial data structures for these scene meshes. With this change, new ToolSceneQueriesUtil functions can be used to provide more general scene mesh-element hit-testing/snapping via ModelingSceneSnappingManager. Updates to existing Tools/Mechanics to use these new query functions will be done in later CLs.
ToolsFramework:
- added new USceneSnappingManager::ExecuteSceneHitQuery API function, as well as accompanying FSceneHitQueryRequest/FSceneHitQueryResult structs
- added FSceneQueryVisibilityFilter struct which contains ComponentsToIgnore/InvisibleComponentsToInclude lists for snapping queries and provides shared IsVisible() implementation
ModelingComponents:
- add FLevelObjectsObserver, tracks Actors added/removed to a Level via various editor events
- add FSceneGeometrySpatialCache, maintains spatial data structures for known types of mesh-backed PrimitiveComponents, an octree based on their world-space bounding-boxes, and provides various spatial-query functions
- ModelingSceneSnappingManager now maintains a FSceneGeometrySpatialCache for a set of Actors/Components it is notified about, and updates the spatial cache if those components are modified or translated. Currently supports Volumes and DynamicMeshComponents.
- add ModelingSceneSnappingManager::ExecuteSceneHitQuery implementation, does raycasts into the world (for static mesh components) and FSceneGeometrySpatialCache for Volumes/DMCs
- modified ModelingSceneSnappingManager::ExecuteSceneSnapQuery to also do combined query against StaticMeshComponents via world-linetrace, and FSceneGeometrySpatialCache for Volumes/DMCs
- add ToolSceneQueriesUtil::FindNearestVisibleObjectHit variants that take a USceneSnappingManager or UInteractiveTool, and do queries via the SceneSnappingManger, instead of directly linetracing into a UWorld
ModleingToolsEditorMode:
- add FLevelObjectsObserver instance and use it to drive updates to active ModelingSceneSnappingManager
#rnx
#jira none
#preflight 61a664a09a226d9e823ad4c1
#ROBOMERGE-AUTHOR: ryan.schmidt
#ROBOMERGE-SOURCE: CL 18339853 in //UE5/Release-5.0/... via CL 18339869
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)
[CL 18339891 by ryan schmidt in ue5-release-engine-test branch]
2021-12-01 11:15:01 -05:00
{
2023-03-16 01:21:34 -04:00
return false ;
}
// physics collision data is created from StaticMesh RenderData
2023-03-24 12:15:06 -04:00
// so use HitResult.FaceIndex to extract triangle from the mesh
2023-03-16 01:21:34 -04:00
// (note: this may be incorrect if there are multiple sections...in that case I think we have to
// first find section whose accumulated index range would contain .FaceIndexX)
UStaticMesh * StaticMesh = Component - > GetStaticMesh ( ) ;
2023-03-24 12:15:06 -04:00
// Get the lowest available render LOD.
// If the Minimum LOD index is not zero, their might be a lower LOD available, but it will not be used for rendering in the viewport.
const int32 MinLODIdx = StaticMesh - > GetMinLODIdx ( ) ;
const FStaticMeshLODResources * LOD = StaticMesh - > GetRenderData ( ) - > GetCurrentFirstLOD ( MinLODIdx ) ;
if ( ! LOD )
{
return false ;
}
const FIndexArrayView Indices = LOD - > IndexBuffer . GetArrayView ( ) ;
const FPositionVertexBuffer & Vertices = LOD - > VertexBuffers . PositionVertexBuffer ;
Added support for world-space hit-testing and snapping to Volume and DynamicMeshComponent mesh vertices/edges/faces, by having Modeling Mode maintain a persistent set of spatial data structures for these scene meshes. With this change, new ToolSceneQueriesUtil functions can be used to provide more general scene mesh-element hit-testing/snapping via ModelingSceneSnappingManager. Updates to existing Tools/Mechanics to use these new query functions will be done in later CLs.
ToolsFramework:
- added new USceneSnappingManager::ExecuteSceneHitQuery API function, as well as accompanying FSceneHitQueryRequest/FSceneHitQueryResult structs
- added FSceneQueryVisibilityFilter struct which contains ComponentsToIgnore/InvisibleComponentsToInclude lists for snapping queries and provides shared IsVisible() implementation
ModelingComponents:
- add FLevelObjectsObserver, tracks Actors added/removed to a Level via various editor events
- add FSceneGeometrySpatialCache, maintains spatial data structures for known types of mesh-backed PrimitiveComponents, an octree based on their world-space bounding-boxes, and provides various spatial-query functions
- ModelingSceneSnappingManager now maintains a FSceneGeometrySpatialCache for a set of Actors/Components it is notified about, and updates the spatial cache if those components are modified or translated. Currently supports Volumes and DynamicMeshComponents.
- add ModelingSceneSnappingManager::ExecuteSceneHitQuery implementation, does raycasts into the world (for static mesh components) and FSceneGeometrySpatialCache for Volumes/DMCs
- modified ModelingSceneSnappingManager::ExecuteSceneSnapQuery to also do combined query against StaticMeshComponents via world-linetrace, and FSceneGeometrySpatialCache for Volumes/DMCs
- add ToolSceneQueriesUtil::FindNearestVisibleObjectHit variants that take a USceneSnappingManager or UInteractiveTool, and do queries via the SceneSnappingManger, instead of directly linetracing into a UWorld
ModleingToolsEditorMode:
- add FLevelObjectsObserver instance and use it to drive updates to active ModelingSceneSnappingManager
#rnx
#jira none
#preflight 61a664a09a226d9e823ad4c1
#ROBOMERGE-AUTHOR: ryan.schmidt
#ROBOMERGE-SOURCE: CL 18339853 in //UE5/Release-5.0/... via CL 18339869
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)
[CL 18339891 by ryan schmidt in ue5-release-engine-test branch]
2021-12-01 11:15:01 -05:00
2023-03-16 01:21:34 -04:00
const int32 TriIdx = 3 * HitResult . FaceIndex ;
if ( TriIdx + 2 > = Indices . Num ( ) )
{
return false ;
Added support for world-space hit-testing and snapping to Volume and DynamicMeshComponent mesh vertices/edges/faces, by having Modeling Mode maintain a persistent set of spatial data structures for these scene meshes. With this change, new ToolSceneQueriesUtil functions can be used to provide more general scene mesh-element hit-testing/snapping via ModelingSceneSnappingManager. Updates to existing Tools/Mechanics to use these new query functions will be done in later CLs.
ToolsFramework:
- added new USceneSnappingManager::ExecuteSceneHitQuery API function, as well as accompanying FSceneHitQueryRequest/FSceneHitQueryResult structs
- added FSceneQueryVisibilityFilter struct which contains ComponentsToIgnore/InvisibleComponentsToInclude lists for snapping queries and provides shared IsVisible() implementation
ModelingComponents:
- add FLevelObjectsObserver, tracks Actors added/removed to a Level via various editor events
- add FSceneGeometrySpatialCache, maintains spatial data structures for known types of mesh-backed PrimitiveComponents, an octree based on their world-space bounding-boxes, and provides various spatial-query functions
- ModelingSceneSnappingManager now maintains a FSceneGeometrySpatialCache for a set of Actors/Components it is notified about, and updates the spatial cache if those components are modified or translated. Currently supports Volumes and DynamicMeshComponents.
- add ModelingSceneSnappingManager::ExecuteSceneHitQuery implementation, does raycasts into the world (for static mesh components) and FSceneGeometrySpatialCache for Volumes/DMCs
- modified ModelingSceneSnappingManager::ExecuteSceneSnapQuery to also do combined query against StaticMeshComponents via world-linetrace, and FSceneGeometrySpatialCache for Volumes/DMCs
- add ToolSceneQueriesUtil::FindNearestVisibleObjectHit variants that take a USceneSnappingManager or UInteractiveTool, and do queries via the SceneSnappingManger, instead of directly linetracing into a UWorld
ModleingToolsEditorMode:
- add FLevelObjectsObserver instance and use it to drive updates to active ModelingSceneSnappingManager
#rnx
#jira none
#preflight 61a664a09a226d9e823ad4c1
#ROBOMERGE-AUTHOR: ryan.schmidt
#ROBOMERGE-SOURCE: CL 18339853 in //UE5/Release-5.0/... via CL 18339869
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)
[CL 18339891 by ryan schmidt in ue5-release-engine-test branch]
2021-12-01 11:15:01 -05:00
}
2023-03-16 01:21:34 -04:00
const uint32 Idx [ 3 ] = { Indices [ TriIdx ] , Indices [ TriIdx + 1 ] , Indices [ TriIdx + 2 ] } ;
2023-03-24 12:15:06 -04:00
const uint32 NumVertices = Vertices . GetNumVertices ( ) ;
2023-03-16 01:21:34 -04:00
if ( Idx [ 0 ] > = NumVertices | | Idx [ 1 ] > = NumVertices | | Idx [ 2 ] > = NumVertices )
{
return false ;
}
const FVector Positions [ 3 ] = {
2023-03-24 12:15:06 -04:00
static_cast < FVector > ( Vertices . VertexPosition ( Idx [ 0 ] ) ) ,
static_cast < FVector > ( Vertices . VertexPosition ( Idx [ 1 ] ) ) ,
static_cast < FVector > ( Vertices . VertexPosition ( Idx [ 2 ] ) )
2023-03-16 01:21:34 -04:00
} ;
// transform to world space
const FTransform ComponentTransform = Component - > GetComponentTransform ( ) ;
TriVertices [ 0 ] = static_cast < VectorType > ( ComponentTransform . TransformPosition ( Positions [ 0 ] ) ) ;
TriVertices [ 1 ] = static_cast < VectorType > ( ComponentTransform . TransformPosition ( Positions [ 1 ] ) ) ;
TriVertices [ 2 ] = static_cast < VectorType > ( ComponentTransform . TransformPosition ( Positions [ 2 ] ) ) ;
return true ;
Added support for world-space hit-testing and snapping to Volume and DynamicMeshComponent mesh vertices/edges/faces, by having Modeling Mode maintain a persistent set of spatial data structures for these scene meshes. With this change, new ToolSceneQueriesUtil functions can be used to provide more general scene mesh-element hit-testing/snapping via ModelingSceneSnappingManager. Updates to existing Tools/Mechanics to use these new query functions will be done in later CLs.
ToolsFramework:
- added new USceneSnappingManager::ExecuteSceneHitQuery API function, as well as accompanying FSceneHitQueryRequest/FSceneHitQueryResult structs
- added FSceneQueryVisibilityFilter struct which contains ComponentsToIgnore/InvisibleComponentsToInclude lists for snapping queries and provides shared IsVisible() implementation
ModelingComponents:
- add FLevelObjectsObserver, tracks Actors added/removed to a Level via various editor events
- add FSceneGeometrySpatialCache, maintains spatial data structures for known types of mesh-backed PrimitiveComponents, an octree based on their world-space bounding-boxes, and provides various spatial-query functions
- ModelingSceneSnappingManager now maintains a FSceneGeometrySpatialCache for a set of Actors/Components it is notified about, and updates the spatial cache if those components are modified or translated. Currently supports Volumes and DynamicMeshComponents.
- add ModelingSceneSnappingManager::ExecuteSceneHitQuery implementation, does raycasts into the world (for static mesh components) and FSceneGeometrySpatialCache for Volumes/DMCs
- modified ModelingSceneSnappingManager::ExecuteSceneSnapQuery to also do combined query against StaticMeshComponents via world-linetrace, and FSceneGeometrySpatialCache for Volumes/DMCs
- add ToolSceneQueriesUtil::FindNearestVisibleObjectHit variants that take a USceneSnappingManager or UInteractiveTool, and do queries via the SceneSnappingManger, instead of directly linetracing into a UWorld
ModleingToolsEditorMode:
- add FLevelObjectsObserver instance and use it to drive updates to active ModelingSceneSnappingManager
#rnx
#jira none
#preflight 61a664a09a226d9e823ad4c1
#ROBOMERGE-AUTHOR: ryan.schmidt
#ROBOMERGE-SOURCE: CL 18339853 in //UE5/Release-5.0/... via CL 18339869
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)
[CL 18339891 by ryan schmidt in ue5-release-engine-test branch]
2021-12-01 11:15:01 -05:00
}
bool UModelingSceneSnappingManager : : ExecuteSceneHitQuery ( const FSceneHitQueryRequest & Request , FSceneHitQueryResult & ResultOut ) const
{
if ( ! QueriesAPI )
{
return false ;
}
FRay3d WorldRay ( Request . WorldRay ) ;
double MinCurrentHitDist = TNumericLimits < double > : : Max ( ) ;
FViewCameraState ViewState ;
QueriesAPI - > GetCurrentViewState ( ViewState ) ;
FSceneGeometryPoint HitPoint ;
FSceneGeometryID HitIdentifier ;
bool bHitSceneCache = SpatialCache - > FindNearestHit ( WorldRay , HitPoint , HitIdentifier , & Request . VisibilityFilter ) ;
if ( bHitSceneCache )
{
FVector3d A , B , C ;
SpatialCache - > GetGeometry ( HitIdentifier , HitPoint . GeometryType , HitPoint . GeometryIndex , true , A , B , C ) ;
MinCurrentHitDist = HitPoint . RayDistance ;
ResultOut . TargetActor = HitPoint . Actor ;
ResultOut . TargetComponent = HitPoint . Component ;
ResultOut . HitTriIndex = HitPoint . GeometryIndex ;
ResultOut . Position = HitPoint . WorldPoint ;
ResultOut . Normal = VectorUtil : : Normal ( A , B , C ) ;
ResultOut . TriVertices [ 0 ] = A ;
ResultOut . TriVertices [ 1 ] = B ;
ResultOut . TriVertices [ 2 ] = C ;
ResultOut . InitializeHitResult ( Request ) ;
}
FHitResult HitResult ;
bool bHitWorld = FindNearestVisibleObjectHit_Internal (
QueriesAPI - > GetCurrentEditingWorld ( ) ,
HitResult , WorldRay ,
true , Request . VisibilityFilter , SpatialCache . Get ( ) ) ;
if ( bHitWorld & & HitResult . Distance < MinCurrentHitDist )
{
MinCurrentHitDist = HitResult . Distance ;
ResultOut . TargetActor = HitResult . GetActor ( ) ;
ResultOut . TargetComponent = HitResult . GetComponent ( ) ;
ResultOut . HitTriIndex = HitResult . FaceIndex ;
ResultOut . Position = ( FVector3d ) HitResult . Location ;
ResultOut . Normal = ( FVector3d ) HitResult . Normal ;
ResultOut . HitResult = HitResult ;
if ( Request . bWantHitGeometryInfo )
{
GetComponentHitTriangle_Internal < FVector3d > ( HitResult , ResultOut . TriVertices ) ;
}
}
return ( MinCurrentHitDist < TNumericLimits < double > : : Max ( ) ) ;
}
2021-10-21 16:57:00 -04:00
bool UModelingSceneSnappingManager : : ExecuteSceneSnapQueryPosition ( const FSceneSnapQueryRequest & Request , TArray < FSceneSnapQueryResult > & Results ) const
{
if ( ! QueriesAPI )
{
return false ;
}
int FoundResultCount = 0 ;
if ( ( Request . TargetTypes & ESceneSnapQueryTargetType : : Grid ) ! = ESceneSnapQueryTargetType : : None )
{
FToolContextSnappingConfiguration SnappingConfig = QueriesAPI - > GetCurrentSnappingSettings ( ) ;
if ( SnappingConfig . bEnablePositionGridSnapping )
{
FSceneSnapQueryResult SnapResult ;
SnapResult . TargetType = ESceneSnapQueryTargetType : : Grid ;
FVector GridSize = Request . GridSize . Get ( SnappingConfig . PositionGridDimensions ) ;
2022-12-15 17:03:36 -05:00
SnapResult . Position . X = ( FVector : : FReal ) UE : : Geometry : : SnapToIncrement ( Request . Position . X , GridSize . X ) ;
SnapResult . Position . Y = ( FVector : : FReal ) UE : : Geometry : : SnapToIncrement ( Request . Position . Y , GridSize . Y ) ;
SnapResult . Position . Z = ( FVector : : FReal ) UE : : Geometry : : SnapToIncrement ( Request . Position . Z , GridSize . Z ) ;
2021-10-21 16:57:00 -04:00
Results . Add ( SnapResult ) ;
FoundResultCount + + ;
}
}
FViewCameraState ViewState ;
QueriesAPI - > GetCurrentViewState ( ViewState ) ;
//
// Run a snap query by casting ray into the world.
// If a hit is found, we look up what triangle was hit, and then test its vertices and edges
//
Added support for world-space hit-testing and snapping to Volume and DynamicMeshComponent mesh vertices/edges/faces, by having Modeling Mode maintain a persistent set of spatial data structures for these scene meshes. With this change, new ToolSceneQueriesUtil functions can be used to provide more general scene mesh-element hit-testing/snapping via ModelingSceneSnappingManager. Updates to existing Tools/Mechanics to use these new query functions will be done in later CLs.
ToolsFramework:
- added new USceneSnappingManager::ExecuteSceneHitQuery API function, as well as accompanying FSceneHitQueryRequest/FSceneHitQueryResult structs
- added FSceneQueryVisibilityFilter struct which contains ComponentsToIgnore/InvisibleComponentsToInclude lists for snapping queries and provides shared IsVisible() implementation
ModelingComponents:
- add FLevelObjectsObserver, tracks Actors added/removed to a Level via various editor events
- add FSceneGeometrySpatialCache, maintains spatial data structures for known types of mesh-backed PrimitiveComponents, an octree based on their world-space bounding-boxes, and provides various spatial-query functions
- ModelingSceneSnappingManager now maintains a FSceneGeometrySpatialCache for a set of Actors/Components it is notified about, and updates the spatial cache if those components are modified or translated. Currently supports Volumes and DynamicMeshComponents.
- add ModelingSceneSnappingManager::ExecuteSceneHitQuery implementation, does raycasts into the world (for static mesh components) and FSceneGeometrySpatialCache for Volumes/DMCs
- modified ModelingSceneSnappingManager::ExecuteSceneSnapQuery to also do combined query against StaticMeshComponents via world-linetrace, and FSceneGeometrySpatialCache for Volumes/DMCs
- add ToolSceneQueriesUtil::FindNearestVisibleObjectHit variants that take a USceneSnappingManager or UInteractiveTool, and do queries via the SceneSnappingManger, instead of directly linetracing into a UWorld
ModleingToolsEditorMode:
- add FLevelObjectsObserver instance and use it to drive updates to active ModelingSceneSnappingManager
#rnx
#jira none
#preflight 61a664a09a226d9e823ad4c1
#ROBOMERGE-AUTHOR: ryan.schmidt
#ROBOMERGE-SOURCE: CL 18339853 in //UE5/Release-5.0/... via CL 18339869
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)
[CL 18339891 by ryan schmidt in ue5-release-engine-test branch]
2021-12-01 11:15:01 -05:00
// try snapping to vertices
auto TrySnapToVertex = [ ] ( const FSceneSnapQueryRequest & RequestIn , const FRay3d & WorldRay , FSceneSnapQueryResult & SnapResult , double & SmallestSnapAngle )
{
if ( ( RequestIn . TargetTypes & ESceneSnapQueryTargetType : : MeshVertex ) ! = ESceneSnapQueryTargetType : : None )
{
for ( int j = 0 ; j < 3 ; + + j )
{
2022-12-15 17:03:36 -05:00
double VisualAngle = UE : : Geometry : : VectorUtil : : OpeningAngleD ( ( FVector3d ) RequestIn . Position , ( FVector3d ) SnapResult . TriVertices [ j ] , WorldRay . Origin ) ;
Added support for world-space hit-testing and snapping to Volume and DynamicMeshComponent mesh vertices/edges/faces, by having Modeling Mode maintain a persistent set of spatial data structures for these scene meshes. With this change, new ToolSceneQueriesUtil functions can be used to provide more general scene mesh-element hit-testing/snapping via ModelingSceneSnappingManager. Updates to existing Tools/Mechanics to use these new query functions will be done in later CLs.
ToolsFramework:
- added new USceneSnappingManager::ExecuteSceneHitQuery API function, as well as accompanying FSceneHitQueryRequest/FSceneHitQueryResult structs
- added FSceneQueryVisibilityFilter struct which contains ComponentsToIgnore/InvisibleComponentsToInclude lists for snapping queries and provides shared IsVisible() implementation
ModelingComponents:
- add FLevelObjectsObserver, tracks Actors added/removed to a Level via various editor events
- add FSceneGeometrySpatialCache, maintains spatial data structures for known types of mesh-backed PrimitiveComponents, an octree based on their world-space bounding-boxes, and provides various spatial-query functions
- ModelingSceneSnappingManager now maintains a FSceneGeometrySpatialCache for a set of Actors/Components it is notified about, and updates the spatial cache if those components are modified or translated. Currently supports Volumes and DynamicMeshComponents.
- add ModelingSceneSnappingManager::ExecuteSceneHitQuery implementation, does raycasts into the world (for static mesh components) and FSceneGeometrySpatialCache for Volumes/DMCs
- modified ModelingSceneSnappingManager::ExecuteSceneSnapQuery to also do combined query against StaticMeshComponents via world-linetrace, and FSceneGeometrySpatialCache for Volumes/DMCs
- add ToolSceneQueriesUtil::FindNearestVisibleObjectHit variants that take a USceneSnappingManager or UInteractiveTool, and do queries via the SceneSnappingManger, instead of directly linetracing into a UWorld
ModleingToolsEditorMode:
- add FLevelObjectsObserver instance and use it to drive updates to active ModelingSceneSnappingManager
#rnx
#jira none
#preflight 61a664a09a226d9e823ad4c1
#ROBOMERGE-AUTHOR: ryan.schmidt
#ROBOMERGE-SOURCE: CL 18339853 in //UE5/Release-5.0/... via CL 18339869
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)
[CL 18339891 by ryan schmidt in ue5-release-engine-test branch]
2021-12-01 11:15:01 -05:00
if ( VisualAngle < SmallestSnapAngle )
{
SmallestSnapAngle = VisualAngle ;
SnapResult . Position = SnapResult . TriVertices [ j ] ;
SnapResult . TargetType = ESceneSnapQueryTargetType : : MeshVertex ;
SnapResult . TriSnapIndex = j ;
}
}
}
} ;
2024-02-14 12:20:29 -05:00
auto TrySnapToEdge = [ ] ( const FSceneSnapQueryRequest & RequestIn , const FVector & SurfacePoint , const FRay3d & WorldRay , FSceneSnapQueryResult & SnapResult , double & SmallestSnapAngle )
Added support for world-space hit-testing and snapping to Volume and DynamicMeshComponent mesh vertices/edges/faces, by having Modeling Mode maintain a persistent set of spatial data structures for these scene meshes. With this change, new ToolSceneQueriesUtil functions can be used to provide more general scene mesh-element hit-testing/snapping via ModelingSceneSnappingManager. Updates to existing Tools/Mechanics to use these new query functions will be done in later CLs.
ToolsFramework:
- added new USceneSnappingManager::ExecuteSceneHitQuery API function, as well as accompanying FSceneHitQueryRequest/FSceneHitQueryResult structs
- added FSceneQueryVisibilityFilter struct which contains ComponentsToIgnore/InvisibleComponentsToInclude lists for snapping queries and provides shared IsVisible() implementation
ModelingComponents:
- add FLevelObjectsObserver, tracks Actors added/removed to a Level via various editor events
- add FSceneGeometrySpatialCache, maintains spatial data structures for known types of mesh-backed PrimitiveComponents, an octree based on their world-space bounding-boxes, and provides various spatial-query functions
- ModelingSceneSnappingManager now maintains a FSceneGeometrySpatialCache for a set of Actors/Components it is notified about, and updates the spatial cache if those components are modified or translated. Currently supports Volumes and DynamicMeshComponents.
- add ModelingSceneSnappingManager::ExecuteSceneHitQuery implementation, does raycasts into the world (for static mesh components) and FSceneGeometrySpatialCache for Volumes/DMCs
- modified ModelingSceneSnappingManager::ExecuteSceneSnapQuery to also do combined query against StaticMeshComponents via world-linetrace, and FSceneGeometrySpatialCache for Volumes/DMCs
- add ToolSceneQueriesUtil::FindNearestVisibleObjectHit variants that take a USceneSnappingManager or UInteractiveTool, and do queries via the SceneSnappingManger, instead of directly linetracing into a UWorld
ModleingToolsEditorMode:
- add FLevelObjectsObserver instance and use it to drive updates to active ModelingSceneSnappingManager
#rnx
#jira none
#preflight 61a664a09a226d9e823ad4c1
#ROBOMERGE-AUTHOR: ryan.schmidt
#ROBOMERGE-SOURCE: CL 18339853 in //UE5/Release-5.0/... via CL 18339869
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)
[CL 18339891 by ryan schmidt in ue5-release-engine-test branch]
2021-12-01 11:15:01 -05:00
{
if ( ( ( RequestIn . TargetTypes & ESceneSnapQueryTargetType : : MeshEdge ) ! = ESceneSnapQueryTargetType : : None ) & &
( SnapResult . TargetType ! = ESceneSnapQueryTargetType : : MeshVertex ) )
{
for ( int j = 0 ; j < 3 ; + + j )
{
2022-12-15 17:03:36 -05:00
UE : : Geometry : : FSegment3d Segment ( SnapResult . TriVertices [ j ] , SnapResult . TriVertices [ ( j + 1 ) % 3 ] ) ;
2024-02-14 12:20:29 -05:00
FVector3d EdgeNearestPt = Segment . NearestPoint ( SurfacePoint ) ;
2022-12-15 17:03:36 -05:00
double VisualAngle = UE : : Geometry : : VectorUtil : : OpeningAngleD ( RequestIn . Position , EdgeNearestPt , WorldRay . Origin ) ;
Added support for world-space hit-testing and snapping to Volume and DynamicMeshComponent mesh vertices/edges/faces, by having Modeling Mode maintain a persistent set of spatial data structures for these scene meshes. With this change, new ToolSceneQueriesUtil functions can be used to provide more general scene mesh-element hit-testing/snapping via ModelingSceneSnappingManager. Updates to existing Tools/Mechanics to use these new query functions will be done in later CLs.
ToolsFramework:
- added new USceneSnappingManager::ExecuteSceneHitQuery API function, as well as accompanying FSceneHitQueryRequest/FSceneHitQueryResult structs
- added FSceneQueryVisibilityFilter struct which contains ComponentsToIgnore/InvisibleComponentsToInclude lists for snapping queries and provides shared IsVisible() implementation
ModelingComponents:
- add FLevelObjectsObserver, tracks Actors added/removed to a Level via various editor events
- add FSceneGeometrySpatialCache, maintains spatial data structures for known types of mesh-backed PrimitiveComponents, an octree based on their world-space bounding-boxes, and provides various spatial-query functions
- ModelingSceneSnappingManager now maintains a FSceneGeometrySpatialCache for a set of Actors/Components it is notified about, and updates the spatial cache if those components are modified or translated. Currently supports Volumes and DynamicMeshComponents.
- add ModelingSceneSnappingManager::ExecuteSceneHitQuery implementation, does raycasts into the world (for static mesh components) and FSceneGeometrySpatialCache for Volumes/DMCs
- modified ModelingSceneSnappingManager::ExecuteSceneSnapQuery to also do combined query against StaticMeshComponents via world-linetrace, and FSceneGeometrySpatialCache for Volumes/DMCs
- add ToolSceneQueriesUtil::FindNearestVisibleObjectHit variants that take a USceneSnappingManager or UInteractiveTool, and do queries via the SceneSnappingManger, instead of directly linetracing into a UWorld
ModleingToolsEditorMode:
- add FLevelObjectsObserver instance and use it to drive updates to active ModelingSceneSnappingManager
#rnx
#jira none
#preflight 61a664a09a226d9e823ad4c1
#ROBOMERGE-AUTHOR: ryan.schmidt
#ROBOMERGE-SOURCE: CL 18339853 in //UE5/Release-5.0/... via CL 18339869
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)
[CL 18339891 by ryan schmidt in ue5-release-engine-test branch]
2021-12-01 11:15:01 -05:00
if ( VisualAngle < SmallestSnapAngle )
{
SmallestSnapAngle = VisualAngle ;
SnapResult . Position = EdgeNearestPt ;
SnapResult . TargetType = ESceneSnapQueryTargetType : : MeshEdge ;
SnapResult . TriSnapIndex = j ;
}
}
}
} ;
FVector3d RayStart = ( FVector3d ) ViewState . Position ;
FVector3d RayDirection = ( FVector3d ) Request . Position - RayStart ;
FRay3d WorldRay ( RayStart , Normalized ( RayDirection ) ) ;
FSceneQueryVisibilityFilter TmpFilter ;
TmpFilter . ComponentsToIgnore = Request . ComponentsToIgnore ;
TmpFilter . InvisibleComponentsToInclude = Request . InvisibleComponentsToInclude ;
// cast ray into scene cache
FSceneGeometryPoint HitPoint ;
FSceneGeometryID HitIdentifier ;
2022-03-10 21:07:11 -05:00
bool bHitSceneCache = SpatialCache - > FindNearestHit ( WorldRay , HitPoint , HitIdentifier , & TmpFilter ) ;
Added support for world-space hit-testing and snapping to Volume and DynamicMeshComponent mesh vertices/edges/faces, by having Modeling Mode maintain a persistent set of spatial data structures for these scene meshes. With this change, new ToolSceneQueriesUtil functions can be used to provide more general scene mesh-element hit-testing/snapping via ModelingSceneSnappingManager. Updates to existing Tools/Mechanics to use these new query functions will be done in later CLs.
ToolsFramework:
- added new USceneSnappingManager::ExecuteSceneHitQuery API function, as well as accompanying FSceneHitQueryRequest/FSceneHitQueryResult structs
- added FSceneQueryVisibilityFilter struct which contains ComponentsToIgnore/InvisibleComponentsToInclude lists for snapping queries and provides shared IsVisible() implementation
ModelingComponents:
- add FLevelObjectsObserver, tracks Actors added/removed to a Level via various editor events
- add FSceneGeometrySpatialCache, maintains spatial data structures for known types of mesh-backed PrimitiveComponents, an octree based on their world-space bounding-boxes, and provides various spatial-query functions
- ModelingSceneSnappingManager now maintains a FSceneGeometrySpatialCache for a set of Actors/Components it is notified about, and updates the spatial cache if those components are modified or translated. Currently supports Volumes and DynamicMeshComponents.
- add ModelingSceneSnappingManager::ExecuteSceneHitQuery implementation, does raycasts into the world (for static mesh components) and FSceneGeometrySpatialCache for Volumes/DMCs
- modified ModelingSceneSnappingManager::ExecuteSceneSnapQuery to also do combined query against StaticMeshComponents via world-linetrace, and FSceneGeometrySpatialCache for Volumes/DMCs
- add ToolSceneQueriesUtil::FindNearestVisibleObjectHit variants that take a USceneSnappingManager or UInteractiveTool, and do queries via the SceneSnappingManger, instead of directly linetracing into a UWorld
ModleingToolsEditorMode:
- add FLevelObjectsObserver instance and use it to drive updates to active ModelingSceneSnappingManager
#rnx
#jira none
#preflight 61a664a09a226d9e823ad4c1
#ROBOMERGE-AUTHOR: ryan.schmidt
#ROBOMERGE-SOURCE: CL 18339853 in //UE5/Release-5.0/... via CL 18339869
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)
[CL 18339891 by ryan schmidt in ue5-release-engine-test branch]
2021-12-01 11:15:01 -05:00
2021-10-21 16:57:00 -04:00
// cast ray into world
FHitResult HitResult ;
bool bHitWorld = FindNearestVisibleObjectHit_Internal (
QueriesAPI - > GetCurrentEditingWorld ( ) ,
Added support for world-space hit-testing and snapping to Volume and DynamicMeshComponent mesh vertices/edges/faces, by having Modeling Mode maintain a persistent set of spatial data structures for these scene meshes. With this change, new ToolSceneQueriesUtil functions can be used to provide more general scene mesh-element hit-testing/snapping via ModelingSceneSnappingManager. Updates to existing Tools/Mechanics to use these new query functions will be done in later CLs.
ToolsFramework:
- added new USceneSnappingManager::ExecuteSceneHitQuery API function, as well as accompanying FSceneHitQueryRequest/FSceneHitQueryResult structs
- added FSceneQueryVisibilityFilter struct which contains ComponentsToIgnore/InvisibleComponentsToInclude lists for snapping queries and provides shared IsVisible() implementation
ModelingComponents:
- add FLevelObjectsObserver, tracks Actors added/removed to a Level via various editor events
- add FSceneGeometrySpatialCache, maintains spatial data structures for known types of mesh-backed PrimitiveComponents, an octree based on their world-space bounding-boxes, and provides various spatial-query functions
- ModelingSceneSnappingManager now maintains a FSceneGeometrySpatialCache for a set of Actors/Components it is notified about, and updates the spatial cache if those components are modified or translated. Currently supports Volumes and DynamicMeshComponents.
- add ModelingSceneSnappingManager::ExecuteSceneHitQuery implementation, does raycasts into the world (for static mesh components) and FSceneGeometrySpatialCache for Volumes/DMCs
- modified ModelingSceneSnappingManager::ExecuteSceneSnapQuery to also do combined query against StaticMeshComponents via world-linetrace, and FSceneGeometrySpatialCache for Volumes/DMCs
- add ToolSceneQueriesUtil::FindNearestVisibleObjectHit variants that take a USceneSnappingManager or UInteractiveTool, and do queries via the SceneSnappingManger, instead of directly linetracing into a UWorld
ModleingToolsEditorMode:
- add FLevelObjectsObserver instance and use it to drive updates to active ModelingSceneSnappingManager
#rnx
#jira none
#preflight 61a664a09a226d9e823ad4c1
#ROBOMERGE-AUTHOR: ryan.schmidt
#ROBOMERGE-SOURCE: CL 18339853 in //UE5/Release-5.0/... via CL 18339869
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)
[CL 18339891 by ryan schmidt in ue5-release-engine-test branch]
2021-12-01 11:15:01 -05:00
HitResult , WorldRay ,
true , TmpFilter , SpatialCache . Get ( ) ) ;
2021-10-21 16:57:00 -04:00
Added support for world-space hit-testing and snapping to Volume and DynamicMeshComponent mesh vertices/edges/faces, by having Modeling Mode maintain a persistent set of spatial data structures for these scene meshes. With this change, new ToolSceneQueriesUtil functions can be used to provide more general scene mesh-element hit-testing/snapping via ModelingSceneSnappingManager. Updates to existing Tools/Mechanics to use these new query functions will be done in later CLs.
ToolsFramework:
- added new USceneSnappingManager::ExecuteSceneHitQuery API function, as well as accompanying FSceneHitQueryRequest/FSceneHitQueryResult structs
- added FSceneQueryVisibilityFilter struct which contains ComponentsToIgnore/InvisibleComponentsToInclude lists for snapping queries and provides shared IsVisible() implementation
ModelingComponents:
- add FLevelObjectsObserver, tracks Actors added/removed to a Level via various editor events
- add FSceneGeometrySpatialCache, maintains spatial data structures for known types of mesh-backed PrimitiveComponents, an octree based on their world-space bounding-boxes, and provides various spatial-query functions
- ModelingSceneSnappingManager now maintains a FSceneGeometrySpatialCache for a set of Actors/Components it is notified about, and updates the spatial cache if those components are modified or translated. Currently supports Volumes and DynamicMeshComponents.
- add ModelingSceneSnappingManager::ExecuteSceneHitQuery implementation, does raycasts into the world (for static mesh components) and FSceneGeometrySpatialCache for Volumes/DMCs
- modified ModelingSceneSnappingManager::ExecuteSceneSnapQuery to also do combined query against StaticMeshComponents via world-linetrace, and FSceneGeometrySpatialCache for Volumes/DMCs
- add ToolSceneQueriesUtil::FindNearestVisibleObjectHit variants that take a USceneSnappingManager or UInteractiveTool, and do queries via the SceneSnappingManger, instead of directly linetracing into a UWorld
ModleingToolsEditorMode:
- add FLevelObjectsObserver instance and use it to drive updates to active ModelingSceneSnappingManager
#rnx
#jira none
#preflight 61a664a09a226d9e823ad4c1
#ROBOMERGE-AUTHOR: ryan.schmidt
#ROBOMERGE-SOURCE: CL 18339853 in //UE5/Release-5.0/... via CL 18339869
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)
[CL 18339891 by ryan schmidt in ue5-release-engine-test branch]
2021-12-01 11:15:01 -05:00
// if we hit both, determine which is closer
if ( bHitSceneCache & & bHitWorld )
2021-10-21 16:57:00 -04:00
{
Added support for world-space hit-testing and snapping to Volume and DynamicMeshComponent mesh vertices/edges/faces, by having Modeling Mode maintain a persistent set of spatial data structures for these scene meshes. With this change, new ToolSceneQueriesUtil functions can be used to provide more general scene mesh-element hit-testing/snapping via ModelingSceneSnappingManager. Updates to existing Tools/Mechanics to use these new query functions will be done in later CLs.
ToolsFramework:
- added new USceneSnappingManager::ExecuteSceneHitQuery API function, as well as accompanying FSceneHitQueryRequest/FSceneHitQueryResult structs
- added FSceneQueryVisibilityFilter struct which contains ComponentsToIgnore/InvisibleComponentsToInclude lists for snapping queries and provides shared IsVisible() implementation
ModelingComponents:
- add FLevelObjectsObserver, tracks Actors added/removed to a Level via various editor events
- add FSceneGeometrySpatialCache, maintains spatial data structures for known types of mesh-backed PrimitiveComponents, an octree based on their world-space bounding-boxes, and provides various spatial-query functions
- ModelingSceneSnappingManager now maintains a FSceneGeometrySpatialCache for a set of Actors/Components it is notified about, and updates the spatial cache if those components are modified or translated. Currently supports Volumes and DynamicMeshComponents.
- add ModelingSceneSnappingManager::ExecuteSceneHitQuery implementation, does raycasts into the world (for static mesh components) and FSceneGeometrySpatialCache for Volumes/DMCs
- modified ModelingSceneSnappingManager::ExecuteSceneSnapQuery to also do combined query against StaticMeshComponents via world-linetrace, and FSceneGeometrySpatialCache for Volumes/DMCs
- add ToolSceneQueriesUtil::FindNearestVisibleObjectHit variants that take a USceneSnappingManager or UInteractiveTool, and do queries via the SceneSnappingManger, instead of directly linetracing into a UWorld
ModleingToolsEditorMode:
- add FLevelObjectsObserver instance and use it to drive updates to active ModelingSceneSnappingManager
#rnx
#jira none
#preflight 61a664a09a226d9e823ad4c1
#ROBOMERGE-AUTHOR: ryan.schmidt
#ROBOMERGE-SOURCE: CL 18339853 in //UE5/Release-5.0/... via CL 18339869
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)
[CL 18339891 by ryan schmidt in ue5-release-engine-test branch]
2021-12-01 11:15:01 -05:00
if ( HitPoint . RayDistance < HitResult . Distance )
{
bHitWorld = false ;
}
else
{
bHitSceneCache = false ;
}
}
// Try to snap based on whichever thing was hit.
// Might be possible to combine parts of these blocks.
if ( bHitSceneCache )
{
// is this check necessary? isn't this always going to be zero for a scene hit??
2022-12-15 17:03:36 -05:00
double VisualAngle = UE : : Geometry : : VectorUtil : : OpeningAngleD ( ( FVector3d ) Request . Position , HitPoint . WorldPoint , RayStart ) ;
2022-02-14 18:32:46 -05:00
if ( VisualAngle < ( double ) Request . VisualAngleThresholdDegrees )
2021-10-21 16:57:00 -04:00
{
Added support for world-space hit-testing and snapping to Volume and DynamicMeshComponent mesh vertices/edges/faces, by having Modeling Mode maintain a persistent set of spatial data structures for these scene meshes. With this change, new ToolSceneQueriesUtil functions can be used to provide more general scene mesh-element hit-testing/snapping via ModelingSceneSnappingManager. Updates to existing Tools/Mechanics to use these new query functions will be done in later CLs.
ToolsFramework:
- added new USceneSnappingManager::ExecuteSceneHitQuery API function, as well as accompanying FSceneHitQueryRequest/FSceneHitQueryResult structs
- added FSceneQueryVisibilityFilter struct which contains ComponentsToIgnore/InvisibleComponentsToInclude lists for snapping queries and provides shared IsVisible() implementation
ModelingComponents:
- add FLevelObjectsObserver, tracks Actors added/removed to a Level via various editor events
- add FSceneGeometrySpatialCache, maintains spatial data structures for known types of mesh-backed PrimitiveComponents, an octree based on their world-space bounding-boxes, and provides various spatial-query functions
- ModelingSceneSnappingManager now maintains a FSceneGeometrySpatialCache for a set of Actors/Components it is notified about, and updates the spatial cache if those components are modified or translated. Currently supports Volumes and DynamicMeshComponents.
- add ModelingSceneSnappingManager::ExecuteSceneHitQuery implementation, does raycasts into the world (for static mesh components) and FSceneGeometrySpatialCache for Volumes/DMCs
- modified ModelingSceneSnappingManager::ExecuteSceneSnapQuery to also do combined query against StaticMeshComponents via world-linetrace, and FSceneGeometrySpatialCache for Volumes/DMCs
- add ToolSceneQueriesUtil::FindNearestVisibleObjectHit variants that take a USceneSnappingManager or UInteractiveTool, and do queries via the SceneSnappingManger, instead of directly linetracing into a UWorld
ModleingToolsEditorMode:
- add FLevelObjectsObserver instance and use it to drive updates to active ModelingSceneSnappingManager
#rnx
#jira none
#preflight 61a664a09a226d9e823ad4c1
#ROBOMERGE-AUTHOR: ryan.schmidt
#ROBOMERGE-SOURCE: CL 18339853 in //UE5/Release-5.0/... via CL 18339869
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)
[CL 18339891 by ryan schmidt in ue5-release-engine-test branch]
2021-12-01 11:15:01 -05:00
FVector3d A , B , C ;
SpatialCache - > GetGeometry ( HitIdentifier , HitPoint . GeometryType , HitPoint . GeometryIndex , true , A , B , C ) ;
FSceneSnapQueryResult SnapResult ;
SnapResult . TriVertices [ 0 ] = ( FVector ) A ;
SnapResult . TriVertices [ 1 ] = ( FVector ) B ;
SnapResult . TriVertices [ 2 ] = ( FVector ) C ;
double SmallestAngle = Request . VisualAngleThresholdDegrees ;
// try snapping to vertices
TrySnapToVertex ( Request , WorldRay , SnapResult , SmallestAngle ) ;
// try snapping to nearest points on edges
2024-02-14 12:20:29 -05:00
TrySnapToEdge ( Request , HitPoint . WorldPoint , WorldRay , SnapResult , SmallestAngle ) ;
Added support for world-space hit-testing and snapping to Volume and DynamicMeshComponent mesh vertices/edges/faces, by having Modeling Mode maintain a persistent set of spatial data structures for these scene meshes. With this change, new ToolSceneQueriesUtil functions can be used to provide more general scene mesh-element hit-testing/snapping via ModelingSceneSnappingManager. Updates to existing Tools/Mechanics to use these new query functions will be done in later CLs.
ToolsFramework:
- added new USceneSnappingManager::ExecuteSceneHitQuery API function, as well as accompanying FSceneHitQueryRequest/FSceneHitQueryResult structs
- added FSceneQueryVisibilityFilter struct which contains ComponentsToIgnore/InvisibleComponentsToInclude lists for snapping queries and provides shared IsVisible() implementation
ModelingComponents:
- add FLevelObjectsObserver, tracks Actors added/removed to a Level via various editor events
- add FSceneGeometrySpatialCache, maintains spatial data structures for known types of mesh-backed PrimitiveComponents, an octree based on their world-space bounding-boxes, and provides various spatial-query functions
- ModelingSceneSnappingManager now maintains a FSceneGeometrySpatialCache for a set of Actors/Components it is notified about, and updates the spatial cache if those components are modified or translated. Currently supports Volumes and DynamicMeshComponents.
- add ModelingSceneSnappingManager::ExecuteSceneHitQuery implementation, does raycasts into the world (for static mesh components) and FSceneGeometrySpatialCache for Volumes/DMCs
- modified ModelingSceneSnappingManager::ExecuteSceneSnapQuery to also do combined query against StaticMeshComponents via world-linetrace, and FSceneGeometrySpatialCache for Volumes/DMCs
- add ToolSceneQueriesUtil::FindNearestVisibleObjectHit variants that take a USceneSnappingManager or UInteractiveTool, and do queries via the SceneSnappingManger, instead of directly linetracing into a UWorld
ModleingToolsEditorMode:
- add FLevelObjectsObserver instance and use it to drive updates to active ModelingSceneSnappingManager
#rnx
#jira none
#preflight 61a664a09a226d9e823ad4c1
#ROBOMERGE-AUTHOR: ryan.schmidt
#ROBOMERGE-SOURCE: CL 18339853 in //UE5/Release-5.0/... via CL 18339869
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)
[CL 18339891 by ryan schmidt in ue5-release-engine-test branch]
2021-12-01 11:15:01 -05:00
// if we found a valid snap, return it
if ( SmallestAngle < ( double ) Request . VisualAngleThresholdDegrees )
2021-10-21 16:57:00 -04:00
{
Added support for world-space hit-testing and snapping to Volume and DynamicMeshComponent mesh vertices/edges/faces, by having Modeling Mode maintain a persistent set of spatial data structures for these scene meshes. With this change, new ToolSceneQueriesUtil functions can be used to provide more general scene mesh-element hit-testing/snapping via ModelingSceneSnappingManager. Updates to existing Tools/Mechanics to use these new query functions will be done in later CLs.
ToolsFramework:
- added new USceneSnappingManager::ExecuteSceneHitQuery API function, as well as accompanying FSceneHitQueryRequest/FSceneHitQueryResult structs
- added FSceneQueryVisibilityFilter struct which contains ComponentsToIgnore/InvisibleComponentsToInclude lists for snapping queries and provides shared IsVisible() implementation
ModelingComponents:
- add FLevelObjectsObserver, tracks Actors added/removed to a Level via various editor events
- add FSceneGeometrySpatialCache, maintains spatial data structures for known types of mesh-backed PrimitiveComponents, an octree based on their world-space bounding-boxes, and provides various spatial-query functions
- ModelingSceneSnappingManager now maintains a FSceneGeometrySpatialCache for a set of Actors/Components it is notified about, and updates the spatial cache if those components are modified or translated. Currently supports Volumes and DynamicMeshComponents.
- add ModelingSceneSnappingManager::ExecuteSceneHitQuery implementation, does raycasts into the world (for static mesh components) and FSceneGeometrySpatialCache for Volumes/DMCs
- modified ModelingSceneSnappingManager::ExecuteSceneSnapQuery to also do combined query against StaticMeshComponents via world-linetrace, and FSceneGeometrySpatialCache for Volumes/DMCs
- add ToolSceneQueriesUtil::FindNearestVisibleObjectHit variants that take a USceneSnappingManager or UInteractiveTool, and do queries via the SceneSnappingManger, instead of directly linetracing into a UWorld
ModleingToolsEditorMode:
- add FLevelObjectsObserver instance and use it to drive updates to active ModelingSceneSnappingManager
#rnx
#jira none
#preflight 61a664a09a226d9e823ad4c1
#ROBOMERGE-AUTHOR: ryan.schmidt
#ROBOMERGE-SOURCE: CL 18339853 in //UE5/Release-5.0/... via CL 18339869
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)
[CL 18339891 by ryan schmidt in ue5-release-engine-test branch]
2021-12-01 11:15:01 -05:00
SnapResult . TargetActor = HitPoint . Actor ;
SnapResult . TargetComponent = HitPoint . Component ;
Results . Add ( SnapResult ) ;
FoundResultCount + + ;
}
2021-10-21 16:57:00 -04:00
Added support for world-space hit-testing and snapping to Volume and DynamicMeshComponent mesh vertices/edges/faces, by having Modeling Mode maintain a persistent set of spatial data structures for these scene meshes. With this change, new ToolSceneQueriesUtil functions can be used to provide more general scene mesh-element hit-testing/snapping via ModelingSceneSnappingManager. Updates to existing Tools/Mechanics to use these new query functions will be done in later CLs.
ToolsFramework:
- added new USceneSnappingManager::ExecuteSceneHitQuery API function, as well as accompanying FSceneHitQueryRequest/FSceneHitQueryResult structs
- added FSceneQueryVisibilityFilter struct which contains ComponentsToIgnore/InvisibleComponentsToInclude lists for snapping queries and provides shared IsVisible() implementation
ModelingComponents:
- add FLevelObjectsObserver, tracks Actors added/removed to a Level via various editor events
- add FSceneGeometrySpatialCache, maintains spatial data structures for known types of mesh-backed PrimitiveComponents, an octree based on their world-space bounding-boxes, and provides various spatial-query functions
- ModelingSceneSnappingManager now maintains a FSceneGeometrySpatialCache for a set of Actors/Components it is notified about, and updates the spatial cache if those components are modified or translated. Currently supports Volumes and DynamicMeshComponents.
- add ModelingSceneSnappingManager::ExecuteSceneHitQuery implementation, does raycasts into the world (for static mesh components) and FSceneGeometrySpatialCache for Volumes/DMCs
- modified ModelingSceneSnappingManager::ExecuteSceneSnapQuery to also do combined query against StaticMeshComponents via world-linetrace, and FSceneGeometrySpatialCache for Volumes/DMCs
- add ToolSceneQueriesUtil::FindNearestVisibleObjectHit variants that take a USceneSnappingManager or UInteractiveTool, and do queries via the SceneSnappingManger, instead of directly linetracing into a UWorld
ModleingToolsEditorMode:
- add FLevelObjectsObserver instance and use it to drive updates to active ModelingSceneSnappingManager
#rnx
#jira none
#preflight 61a664a09a226d9e823ad4c1
#ROBOMERGE-AUTHOR: ryan.schmidt
#ROBOMERGE-SOURCE: CL 18339853 in //UE5/Release-5.0/... via CL 18339869
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)
[CL 18339891 by ryan schmidt in ue5-release-engine-test branch]
2021-12-01 11:15:01 -05:00
}
}
2021-10-21 16:57:00 -04:00
Added support for world-space hit-testing and snapping to Volume and DynamicMeshComponent mesh vertices/edges/faces, by having Modeling Mode maintain a persistent set of spatial data structures for these scene meshes. With this change, new ToolSceneQueriesUtil functions can be used to provide more general scene mesh-element hit-testing/snapping via ModelingSceneSnappingManager. Updates to existing Tools/Mechanics to use these new query functions will be done in later CLs.
ToolsFramework:
- added new USceneSnappingManager::ExecuteSceneHitQuery API function, as well as accompanying FSceneHitQueryRequest/FSceneHitQueryResult structs
- added FSceneQueryVisibilityFilter struct which contains ComponentsToIgnore/InvisibleComponentsToInclude lists for snapping queries and provides shared IsVisible() implementation
ModelingComponents:
- add FLevelObjectsObserver, tracks Actors added/removed to a Level via various editor events
- add FSceneGeometrySpatialCache, maintains spatial data structures for known types of mesh-backed PrimitiveComponents, an octree based on their world-space bounding-boxes, and provides various spatial-query functions
- ModelingSceneSnappingManager now maintains a FSceneGeometrySpatialCache for a set of Actors/Components it is notified about, and updates the spatial cache if those components are modified or translated. Currently supports Volumes and DynamicMeshComponents.
- add ModelingSceneSnappingManager::ExecuteSceneHitQuery implementation, does raycasts into the world (for static mesh components) and FSceneGeometrySpatialCache for Volumes/DMCs
- modified ModelingSceneSnappingManager::ExecuteSceneSnapQuery to also do combined query against StaticMeshComponents via world-linetrace, and FSceneGeometrySpatialCache for Volumes/DMCs
- add ToolSceneQueriesUtil::FindNearestVisibleObjectHit variants that take a USceneSnappingManager or UInteractiveTool, and do queries via the SceneSnappingManger, instead of directly linetracing into a UWorld
ModleingToolsEditorMode:
- add FLevelObjectsObserver instance and use it to drive updates to active ModelingSceneSnappingManager
#rnx
#jira none
#preflight 61a664a09a226d9e823ad4c1
#ROBOMERGE-AUTHOR: ryan.schmidt
#ROBOMERGE-SOURCE: CL 18339853 in //UE5/Release-5.0/... via CL 18339869
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)
[CL 18339891 by ryan schmidt in ue5-release-engine-test branch]
2021-12-01 11:15:01 -05:00
if ( bHitWorld )
{
// is this check necessary? isn't this always going to be zero for a scene hit??
2022-12-15 17:03:36 -05:00
double VisualAngle = UE : : Geometry : : VectorUtil : : OpeningAngleD ( ( FVector3d ) Request . Position , ( FVector3d ) HitResult . ImpactPoint , RayStart ) ;
2022-02-14 18:32:46 -05:00
if ( VisualAngle < ( double ) Request . VisualAngleThresholdDegrees )
Added support for world-space hit-testing and snapping to Volume and DynamicMeshComponent mesh vertices/edges/faces, by having Modeling Mode maintain a persistent set of spatial data structures for these scene meshes. With this change, new ToolSceneQueriesUtil functions can be used to provide more general scene mesh-element hit-testing/snapping via ModelingSceneSnappingManager. Updates to existing Tools/Mechanics to use these new query functions will be done in later CLs.
ToolsFramework:
- added new USceneSnappingManager::ExecuteSceneHitQuery API function, as well as accompanying FSceneHitQueryRequest/FSceneHitQueryResult structs
- added FSceneQueryVisibilityFilter struct which contains ComponentsToIgnore/InvisibleComponentsToInclude lists for snapping queries and provides shared IsVisible() implementation
ModelingComponents:
- add FLevelObjectsObserver, tracks Actors added/removed to a Level via various editor events
- add FSceneGeometrySpatialCache, maintains spatial data structures for known types of mesh-backed PrimitiveComponents, an octree based on their world-space bounding-boxes, and provides various spatial-query functions
- ModelingSceneSnappingManager now maintains a FSceneGeometrySpatialCache for a set of Actors/Components it is notified about, and updates the spatial cache if those components are modified or translated. Currently supports Volumes and DynamicMeshComponents.
- add ModelingSceneSnappingManager::ExecuteSceneHitQuery implementation, does raycasts into the world (for static mesh components) and FSceneGeometrySpatialCache for Volumes/DMCs
- modified ModelingSceneSnappingManager::ExecuteSceneSnapQuery to also do combined query against StaticMeshComponents via world-linetrace, and FSceneGeometrySpatialCache for Volumes/DMCs
- add ToolSceneQueriesUtil::FindNearestVisibleObjectHit variants that take a USceneSnappingManager or UInteractiveTool, and do queries via the SceneSnappingManger, instead of directly linetracing into a UWorld
ModleingToolsEditorMode:
- add FLevelObjectsObserver instance and use it to drive updates to active ModelingSceneSnappingManager
#rnx
#jira none
#preflight 61a664a09a226d9e823ad4c1
#ROBOMERGE-AUTHOR: ryan.schmidt
#ROBOMERGE-SOURCE: CL 18339853 in //UE5/Release-5.0/... via CL 18339869
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)
[CL 18339891 by ryan schmidt in ue5-release-engine-test branch]
2021-12-01 11:15:01 -05:00
{
FSceneSnapQueryResult SnapResult ;
if ( GetComponentHitTriangle_Internal < FVector > ( HitResult , SnapResult . TriVertices ) )
{
double SmallestAngle = Request . VisualAngleThresholdDegrees ;
2021-10-21 16:57:00 -04:00
// try snapping to vertices
Added support for world-space hit-testing and snapping to Volume and DynamicMeshComponent mesh vertices/edges/faces, by having Modeling Mode maintain a persistent set of spatial data structures for these scene meshes. With this change, new ToolSceneQueriesUtil functions can be used to provide more general scene mesh-element hit-testing/snapping via ModelingSceneSnappingManager. Updates to existing Tools/Mechanics to use these new query functions will be done in later CLs.
ToolsFramework:
- added new USceneSnappingManager::ExecuteSceneHitQuery API function, as well as accompanying FSceneHitQueryRequest/FSceneHitQueryResult structs
- added FSceneQueryVisibilityFilter struct which contains ComponentsToIgnore/InvisibleComponentsToInclude lists for snapping queries and provides shared IsVisible() implementation
ModelingComponents:
- add FLevelObjectsObserver, tracks Actors added/removed to a Level via various editor events
- add FSceneGeometrySpatialCache, maintains spatial data structures for known types of mesh-backed PrimitiveComponents, an octree based on their world-space bounding-boxes, and provides various spatial-query functions
- ModelingSceneSnappingManager now maintains a FSceneGeometrySpatialCache for a set of Actors/Components it is notified about, and updates the spatial cache if those components are modified or translated. Currently supports Volumes and DynamicMeshComponents.
- add ModelingSceneSnappingManager::ExecuteSceneHitQuery implementation, does raycasts into the world (for static mesh components) and FSceneGeometrySpatialCache for Volumes/DMCs
- modified ModelingSceneSnappingManager::ExecuteSceneSnapQuery to also do combined query against StaticMeshComponents via world-linetrace, and FSceneGeometrySpatialCache for Volumes/DMCs
- add ToolSceneQueriesUtil::FindNearestVisibleObjectHit variants that take a USceneSnappingManager or UInteractiveTool, and do queries via the SceneSnappingManger, instead of directly linetracing into a UWorld
ModleingToolsEditorMode:
- add FLevelObjectsObserver instance and use it to drive updates to active ModelingSceneSnappingManager
#rnx
#jira none
#preflight 61a664a09a226d9e823ad4c1
#ROBOMERGE-AUTHOR: ryan.schmidt
#ROBOMERGE-SOURCE: CL 18339853 in //UE5/Release-5.0/... via CL 18339869
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)
[CL 18339891 by ryan schmidt in ue5-release-engine-test branch]
2021-12-01 11:15:01 -05:00
TrySnapToVertex ( Request , WorldRay , SnapResult , SmallestAngle ) ;
2021-10-21 16:57:00 -04:00
// try snapping to nearest points on edges
2024-02-14 12:20:29 -05:00
TrySnapToEdge ( Request , HitResult . ImpactPoint , WorldRay , SnapResult , SmallestAngle ) ;
2021-10-21 16:57:00 -04:00
// if we found a valid snap, return it
Added support for world-space hit-testing and snapping to Volume and DynamicMeshComponent mesh vertices/edges/faces, by having Modeling Mode maintain a persistent set of spatial data structures for these scene meshes. With this change, new ToolSceneQueriesUtil functions can be used to provide more general scene mesh-element hit-testing/snapping via ModelingSceneSnappingManager. Updates to existing Tools/Mechanics to use these new query functions will be done in later CLs.
ToolsFramework:
- added new USceneSnappingManager::ExecuteSceneHitQuery API function, as well as accompanying FSceneHitQueryRequest/FSceneHitQueryResult structs
- added FSceneQueryVisibilityFilter struct which contains ComponentsToIgnore/InvisibleComponentsToInclude lists for snapping queries and provides shared IsVisible() implementation
ModelingComponents:
- add FLevelObjectsObserver, tracks Actors added/removed to a Level via various editor events
- add FSceneGeometrySpatialCache, maintains spatial data structures for known types of mesh-backed PrimitiveComponents, an octree based on their world-space bounding-boxes, and provides various spatial-query functions
- ModelingSceneSnappingManager now maintains a FSceneGeometrySpatialCache for a set of Actors/Components it is notified about, and updates the spatial cache if those components are modified or translated. Currently supports Volumes and DynamicMeshComponents.
- add ModelingSceneSnappingManager::ExecuteSceneHitQuery implementation, does raycasts into the world (for static mesh components) and FSceneGeometrySpatialCache for Volumes/DMCs
- modified ModelingSceneSnappingManager::ExecuteSceneSnapQuery to also do combined query against StaticMeshComponents via world-linetrace, and FSceneGeometrySpatialCache for Volumes/DMCs
- add ToolSceneQueriesUtil::FindNearestVisibleObjectHit variants that take a USceneSnappingManager or UInteractiveTool, and do queries via the SceneSnappingManger, instead of directly linetracing into a UWorld
ModleingToolsEditorMode:
- add FLevelObjectsObserver instance and use it to drive updates to active ModelingSceneSnappingManager
#rnx
#jira none
#preflight 61a664a09a226d9e823ad4c1
#ROBOMERGE-AUTHOR: ryan.schmidt
#ROBOMERGE-SOURCE: CL 18339853 in //UE5/Release-5.0/... via CL 18339869
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)
[CL 18339891 by ryan schmidt in ue5-release-engine-test branch]
2021-12-01 11:15:01 -05:00
if ( SmallestAngle < ( double ) Request . VisualAngleThresholdDegrees )
2021-10-21 16:57:00 -04:00
{
SnapResult . TargetActor = HitResult . HitObjectHandle . FetchActor ( ) ;
SnapResult . TargetComponent = HitResult . Component . Get ( ) ;
Results . Add ( SnapResult ) ;
FoundResultCount + + ;
}
}
}
}
return ( FoundResultCount > 0 ) ;
}
bool UE : : Geometry : : RegisterSceneSnappingManager ( UInteractiveToolsContext * ToolsContext )
{
if ( ensure ( ToolsContext ) )
{
UModelingSceneSnappingManager * Found = ToolsContext - > ContextObjectStore - > FindContext < UModelingSceneSnappingManager > ( ) ;
if ( Found = = nullptr )
{
UModelingSceneSnappingManager * SelectionManager = NewObject < UModelingSceneSnappingManager > ( ToolsContext - > ToolManager ) ;
if ( ensure ( SelectionManager ) )
{
SelectionManager - > Initialize ( ToolsContext ) ;
ToolsContext - > ContextObjectStore - > AddContextObject ( SelectionManager ) ;
return true ;
}
else
{
return false ;
}
}
return true ;
}
return false ;
}
bool UE : : Geometry : : DeregisterSceneSnappingManager ( UInteractiveToolsContext * ToolsContext )
{
if ( ensure ( ToolsContext ) )
{
UModelingSceneSnappingManager * Found = ToolsContext - > ContextObjectStore - > FindContext < UModelingSceneSnappingManager > ( ) ;
if ( Found ! = nullptr )
{
Found - > Shutdown ( ) ;
ToolsContext - > ContextObjectStore - > RemoveContextObject ( Found ) ;
}
return true ;
}
return false ;
}
UModelingSceneSnappingManager * UE : : Geometry : : FindModelingSceneSnappingManager ( UInteractiveToolManager * ToolManager )
{
if ( ensure ( ToolManager ) )
{
UModelingSceneSnappingManager * Found = ToolManager - > GetContextObjectStore ( ) - > FindContext < UModelingSceneSnappingManager > ( ) ;
if ( Found ! = nullptr )
{
return Found ;
}
}
return nullptr ;
}
2022-09-28 01:06:15 -04:00
# undef LOCTEXT_NAMESPACE