2021-05-28 02:09:37 -04:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "CoreMinimal.h"
|
|
|
|
|
#include "DynamicMesh/DynamicMesh3.h"
|
ModelingTools: Add support for reading and writing to a specific LOD via IMeshDescriptionProvider/Committer. Refactor various other aspects of MeshDescription access. Update MeshTransferTool to be able to transfer from and to specific LODs.
Add new MeshTargetInterfaceTypes.h file, move EStaticMeshEditingLOD there and rename to EMeshLODIdentifier. Add FGetMeshParameters and FCommitMeshParameters types.
IMeshDescriptionProvider::GetMeshDescription() now takes FGetMeshParameters to optionally specify LOD.
Added IMeshDescriptionProvider::GetMeshDescriptionCopy() function, to handle copy-case.
removed IMeshDescriptionProvider::CalculateAutoGeneratedAttributes(). This was only being used to force Tangents computation, which can now be done via GetMeshDescriptionCopy() and FGetMeshParameters.bWantMeshTangents option
IMeshDescriptionCommitter commit functions now take a FCommitMeshParameters to optionally specify target LOD.
StaticMeshComponentToolTarget::GetMeshDescriptionCopy() added, optionally computes auto-generated MeshDescription attributes on the copy
StaticMesh(Component)ToolTarget updated to support FCommitMeshParameters target-LOD.
SkeletalMesh, Volume, and DynamicMesh ToolTargets updated for new APIs but do not currently support any of the new LOD parameters. These should never be called w/ LOD parameters in the current codebase, ensures added to catch any errors (they would be non-fatal).
UE::ToolTarget::GetMeshDescription() and GetMeshDescriptionCopy() in now take FGetMeshParameters argument.
Removed bWantMeshTangents param to GetMeshDescriptionCopy(), now done via FGetMeshParameters. Updated call sites.
TransferMeshesTool now supports specifying read and write LOD (numbered or HiRes) for StaticMeshComponent source/target, via above functions.
TransferMeshesTool can now also target a new LOD in a StaticMeshComponent, index is 1 larger than current maximum source LOD.
#rb lonnie.li, rinat.abdrashitov
#rnx
#jira none
#preflight 61b8d56b2e65a1df046aa5e1
#ROBOMERGE-AUTHOR: ryan.schmidt
#ROBOMERGE-SOURCE: CL 18461686 in //UE5/Release-5.0/... via CL 18461725
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v899-18417669)
[CL 18461778 by ryan schmidt in ue5-release-engine-test branch]
2021-12-14 18:40:01 -05:00
|
|
|
#include "TargetInterfaces/MeshTargetInterfaceTypes.h"
|
2021-05-28 02:09:37 -04:00
|
|
|
#include "TargetInterfaces/MaterialProvider.h" // FComponentMaterialSet
|
2021-06-11 22:42:32 -04:00
|
|
|
#include "MeshConversionOptions.h"
|
2021-05-28 02:09:37 -04:00
|
|
|
|
|
|
|
|
class UToolTarget;
|
|
|
|
|
class UPrimitiveComponent;
|
ModelingTools: add support for creating Volumes directly from DrawPolygon, DrawRevolve, DrawPolyPath, and AddPrimitive, CombineMeshes, CutMeshWithMesh, PlaneCut, BaseCreateFromSelected Tools. Improve support for Editing volumes, eg handling mesh/volume interactions, and add configurable auto-simplification for volumes to avoid painful Editor hangs.
- Move ToolTarget implementations, DynamicMeshToVolume to ModelingComponentsEditorOnly module
- move VolumeToDynamicMesh, DynamicMeshProvider/Commiter interfaces to ModelingComponents module
- Add UCreateMeshObjectTypeProperties property set to expose mesh/volume options
- Add FCreateMeshObjectParams::TypeHintClass to allow AVolume type (or other UClass hints) to be passed to creation APIs
- Add UE::ToolTarget::ConfigureCreateMeshObjectParams() util function in ModelingToolTargetUtil, tries to determine output type in a FCreateMeshObjectParams based on input ToolTarget
- Add UEditorModelingObjectsCreationAPI::CreateVolume() implementation
- Add UEditorModelingObjectsCreationAPI::FilterMaterials() that strips out any internal materials and replaces with WorldGridMaterial. This occurs when (eg) subtracting a Volume from a StaticMesh, because the temporary volume mesh gets assigned internal materials, but the Tools don't know this. Use in EditorModelingObjectsCreationAPI when creating new objects. UStaticMeshComponentToolTarget also does this filtering in ::CommitMaterialSetUpdate().
- Add ::ComponentTypeSupportsCollision() function to ComponentCollisionUtil, use to avoid checks/ensures for Volume targets
- Add support for automatic mesh simplification in DynamicMeshToVolume. Add CVar to VolumeDynamicMeshToolTarget.h to control max triangle count (default 500). Apply auto-simplify when creating or updating an AVolume. This prevents the Editor from blocking for long periods on meshes that are too high-res for volumes (even 500 is quite high).
- DynamicMeshToVolume now emits polygroup-faces that contain holes (ie multiple boundary loops) as a set of triangles, rather than emitting separate overlapping faces for each boundary loop
#rb none
#rnx
#jira none
#preflight 60ba50632c42ea0001cb54c5
[CL 16561742 by Ryan Schmidt in ue5-main branch]
2021-06-04 16:04:03 -04:00
|
|
|
class AActor;
|
2021-11-26 16:37:25 -05:00
|
|
|
class UBodySetup;
|
|
|
|
|
class IInterface_CollisionDataProvider;
|
2021-05-28 02:09:37 -04:00
|
|
|
struct FMeshDescription;
|
ModelingTools: add support for creating Volumes directly from DrawPolygon, DrawRevolve, DrawPolyPath, and AddPrimitive, CombineMeshes, CutMeshWithMesh, PlaneCut, BaseCreateFromSelected Tools. Improve support for Editing volumes, eg handling mesh/volume interactions, and add configurable auto-simplification for volumes to avoid painful Editor hangs.
- Move ToolTarget implementations, DynamicMeshToVolume to ModelingComponentsEditorOnly module
- move VolumeToDynamicMesh, DynamicMeshProvider/Commiter interfaces to ModelingComponents module
- Add UCreateMeshObjectTypeProperties property set to expose mesh/volume options
- Add FCreateMeshObjectParams::TypeHintClass to allow AVolume type (or other UClass hints) to be passed to creation APIs
- Add UE::ToolTarget::ConfigureCreateMeshObjectParams() util function in ModelingToolTargetUtil, tries to determine output type in a FCreateMeshObjectParams based on input ToolTarget
- Add UEditorModelingObjectsCreationAPI::CreateVolume() implementation
- Add UEditorModelingObjectsCreationAPI::FilterMaterials() that strips out any internal materials and replaces with WorldGridMaterial. This occurs when (eg) subtracting a Volume from a StaticMesh, because the temporary volume mesh gets assigned internal materials, but the Tools don't know this. Use in EditorModelingObjectsCreationAPI when creating new objects. UStaticMeshComponentToolTarget also does this filtering in ::CommitMaterialSetUpdate().
- Add ::ComponentTypeSupportsCollision() function to ComponentCollisionUtil, use to avoid checks/ensures for Volume targets
- Add support for automatic mesh simplification in DynamicMeshToVolume. Add CVar to VolumeDynamicMeshToolTarget.h to control max triangle count (default 500). Apply auto-simplify when creating or updating an AVolume. This prevents the Editor from blocking for long periods on meshes that are too high-res for volumes (even 500 is quite high).
- DynamicMeshToVolume now emits polygroup-faces that contain holes (ie multiple boundary loops) as a set of triangles, rather than emitting separate overlapping faces for each boundary loop
#rb none
#rnx
#jira none
#preflight 60ba50632c42ea0001cb54c5
[CL 16561742 by Ryan Schmidt in ue5-main branch]
2021-06-04 16:04:03 -04:00
|
|
|
struct FCreateMeshObjectParams;
|
2021-11-24 23:55:31 -05:00
|
|
|
class IPersistentDynamicMeshSource;
|
2021-05-28 02:09:37 -04:00
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// UE::ToolTarget:: namespace contains utility/helper functions for interacting with UToolTargets.
|
|
|
|
|
// Generally these are meant to be used by UInteractiveTools to handle standard tasks that would
|
|
|
|
|
// otherwise require each Tool to figure out things like which ToolTargetInterface to cast to, etc.
|
|
|
|
|
// Using these functions ideally avoids all the boilerplate inherent in the ToolTarget system.
|
|
|
|
|
//
|
|
|
|
|
// However, the cost is that it is not necessarily the most efficient, as each one of these functions
|
|
|
|
|
// may potentially do many repeated Cast<>'s internally. So, use sparingly, or cache the outputs.
|
|
|
|
|
//
|
|
|
|
|
namespace UE
|
|
|
|
|
{
|
|
|
|
|
namespace ToolTarget
|
|
|
|
|
{
|
|
|
|
|
|
ModelingTools: add support for creating Volumes directly from DrawPolygon, DrawRevolve, DrawPolyPath, and AddPrimitive, CombineMeshes, CutMeshWithMesh, PlaneCut, BaseCreateFromSelected Tools. Improve support for Editing volumes, eg handling mesh/volume interactions, and add configurable auto-simplification for volumes to avoid painful Editor hangs.
- Move ToolTarget implementations, DynamicMeshToVolume to ModelingComponentsEditorOnly module
- move VolumeToDynamicMesh, DynamicMeshProvider/Commiter interfaces to ModelingComponents module
- Add UCreateMeshObjectTypeProperties property set to expose mesh/volume options
- Add FCreateMeshObjectParams::TypeHintClass to allow AVolume type (or other UClass hints) to be passed to creation APIs
- Add UE::ToolTarget::ConfigureCreateMeshObjectParams() util function in ModelingToolTargetUtil, tries to determine output type in a FCreateMeshObjectParams based on input ToolTarget
- Add UEditorModelingObjectsCreationAPI::CreateVolume() implementation
- Add UEditorModelingObjectsCreationAPI::FilterMaterials() that strips out any internal materials and replaces with WorldGridMaterial. This occurs when (eg) subtracting a Volume from a StaticMesh, because the temporary volume mesh gets assigned internal materials, but the Tools don't know this. Use in EditorModelingObjectsCreationAPI when creating new objects. UStaticMeshComponentToolTarget also does this filtering in ::CommitMaterialSetUpdate().
- Add ::ComponentTypeSupportsCollision() function to ComponentCollisionUtil, use to avoid checks/ensures for Volume targets
- Add support for automatic mesh simplification in DynamicMeshToVolume. Add CVar to VolumeDynamicMeshToolTarget.h to control max triangle count (default 500). Apply auto-simplify when creating or updating an AVolume. This prevents the Editor from blocking for long periods on meshes that are too high-res for volumes (even 500 is quite high).
- DynamicMeshToVolume now emits polygroup-faces that contain holes (ie multiple boundary loops) as a set of triangles, rather than emitting separate overlapping faces for each boundary loop
#rb none
#rnx
#jira none
#preflight 60ba50632c42ea0001cb54c5
[CL 16561742 by Ryan Schmidt in ue5-main branch]
2021-06-04 16:04:03 -04:00
|
|
|
/**
|
|
|
|
|
* @return the AActor backing a ToolTarget, or nullptr if there is no such Actor
|
|
|
|
|
*/
|
|
|
|
|
MODELINGCOMPONENTS_API AActor* GetTargetActor(UToolTarget* Target);
|
|
|
|
|
|
2021-05-28 02:09:37 -04:00
|
|
|
/**
|
|
|
|
|
* @return the UPrimitiveComponent backing a ToolTarget, or nullptr if there is no such Component
|
|
|
|
|
*/
|
|
|
|
|
MODELINGCOMPONENTS_API UPrimitiveComponent* GetTargetComponent(UToolTarget* Target);
|
|
|
|
|
|
2021-09-17 16:47:10 -04:00
|
|
|
/**
|
|
|
|
|
* @return a human readable identifier for a ToolTarget, based on the underlying nature of it.
|
|
|
|
|
*/
|
|
|
|
|
MODELINGCOMPONENTS_API FString GetHumanReadableName(UToolTarget* Target);
|
|
|
|
|
|
2021-05-28 02:09:37 -04:00
|
|
|
/**
|
|
|
|
|
* Hide the "Source Object" (eg PrimitiveComponent, Actor, etc) backing a ToolTarget
|
|
|
|
|
* @return true on success
|
|
|
|
|
*/
|
|
|
|
|
MODELINGCOMPONENTS_API bool HideSourceObject(UToolTarget* Target);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Show the "Source Object" (eg PrimitiveComponent, Actor, etc) backing a ToolTarget
|
|
|
|
|
* @return true on success
|
|
|
|
|
*/
|
|
|
|
|
MODELINGCOMPONENTS_API bool ShowSourceObject(UToolTarget* Target);
|
|
|
|
|
|
2021-06-21 18:09:10 -04:00
|
|
|
/**
|
|
|
|
|
* Show or Hide the "Source Object" (eg PrimitiveComponent, Actor, etc) backing a ToolTarget
|
|
|
|
|
* @return true on success
|
|
|
|
|
*/
|
|
|
|
|
MODELINGCOMPONENTS_API bool SetSourceObjectVisible(UToolTarget* Target, bool bVisible);
|
|
|
|
|
|
2021-05-28 02:09:37 -04:00
|
|
|
/**
|
|
|
|
|
* @return the local-to-world Transform underlying a ToolTarget, eg the Component or Actor transform
|
|
|
|
|
*/
|
2022-01-29 14:37:53 -05:00
|
|
|
MODELINGCOMPONENTS_API FTransform3d GetLocalToWorldTransform(UToolTarget* Target);
|
2021-05-28 02:09:37 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Fetch the Material Set on the object underlying a ToolTarget. In cases where there are (eg)
|
|
|
|
|
* separate Component and Asset material sets, prefers the Component material set
|
|
|
|
|
* @param bPreferAssetMaterials if true, prefer an Asset material set, if available
|
|
|
|
|
* @return a valid MaterialSet
|
|
|
|
|
*/
|
|
|
|
|
MODELINGCOMPONENTS_API FComponentMaterialSet GetMaterialSet(UToolTarget* Target, bool bPreferAssetMaterials = false);
|
|
|
|
|
|
|
|
|
|
|
2021-06-11 22:42:32 -04:00
|
|
|
/**
|
|
|
|
|
* Update the material set of the Target
|
|
|
|
|
* @param bApplyToAsset In situations where the Target has both Component-level and Asset-level materials, this specifies which should be updated (this flag is passed to the IMaterialProvider, which may or may not respect it)
|
|
|
|
|
*/
|
|
|
|
|
MODELINGCOMPONENTS_API bool CommitMaterialSetUpdate(
|
|
|
|
|
UToolTarget* Target,
|
|
|
|
|
const FComponentMaterialSet& UpdatedMaterials,
|
|
|
|
|
bool bApplyToAsset = true);
|
|
|
|
|
|
|
|
|
|
|
2021-05-28 02:09:37 -04:00
|
|
|
/**
|
|
|
|
|
* @return the MeshDescription underlying a ToolTarget, if it has such a mesh. May be generated internally by the ToolTarget. May be nullptr if the Target does not have a mesh.
|
|
|
|
|
*/
|
ModelingTools: Add support for reading and writing to a specific LOD via IMeshDescriptionProvider/Committer. Refactor various other aspects of MeshDescription access. Update MeshTransferTool to be able to transfer from and to specific LODs.
Add new MeshTargetInterfaceTypes.h file, move EStaticMeshEditingLOD there and rename to EMeshLODIdentifier. Add FGetMeshParameters and FCommitMeshParameters types.
IMeshDescriptionProvider::GetMeshDescription() now takes FGetMeshParameters to optionally specify LOD.
Added IMeshDescriptionProvider::GetMeshDescriptionCopy() function, to handle copy-case.
removed IMeshDescriptionProvider::CalculateAutoGeneratedAttributes(). This was only being used to force Tangents computation, which can now be done via GetMeshDescriptionCopy() and FGetMeshParameters.bWantMeshTangents option
IMeshDescriptionCommitter commit functions now take a FCommitMeshParameters to optionally specify target LOD.
StaticMeshComponentToolTarget::GetMeshDescriptionCopy() added, optionally computes auto-generated MeshDescription attributes on the copy
StaticMesh(Component)ToolTarget updated to support FCommitMeshParameters target-LOD.
SkeletalMesh, Volume, and DynamicMesh ToolTargets updated for new APIs but do not currently support any of the new LOD parameters. These should never be called w/ LOD parameters in the current codebase, ensures added to catch any errors (they would be non-fatal).
UE::ToolTarget::GetMeshDescription() and GetMeshDescriptionCopy() in now take FGetMeshParameters argument.
Removed bWantMeshTangents param to GetMeshDescriptionCopy(), now done via FGetMeshParameters. Updated call sites.
TransferMeshesTool now supports specifying read and write LOD (numbered or HiRes) for StaticMeshComponent source/target, via above functions.
TransferMeshesTool can now also target a new LOD in a StaticMeshComponent, index is 1 larger than current maximum source LOD.
#rb lonnie.li, rinat.abdrashitov
#rnx
#jira none
#preflight 61b8d56b2e65a1df046aa5e1
#ROBOMERGE-AUTHOR: ryan.schmidt
#ROBOMERGE-SOURCE: CL 18461686 in //UE5/Release-5.0/... via CL 18461725
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v899-18417669)
[CL 18461778 by ryan schmidt in ue5-release-engine-test branch]
2021-12-14 18:40:01 -05:00
|
|
|
MODELINGCOMPONENTS_API const FMeshDescription* GetMeshDescription(
|
|
|
|
|
UToolTarget* Target,
|
|
|
|
|
const FGetMeshParameters& GetMeshParams = FGetMeshParameters());
|
2021-05-28 02:09:37 -04:00
|
|
|
|
2022-01-12 14:53:07 -05:00
|
|
|
/**
|
|
|
|
|
* @return an empty MeshDescription with attributes already registered appropriate to the target.
|
|
|
|
|
*/
|
|
|
|
|
MODELINGCOMPONENTS_API FMeshDescription GetEmptyMeshDescription(
|
|
|
|
|
UToolTarget* Target);
|
|
|
|
|
|
2021-05-28 02:09:37 -04:00
|
|
|
/**
|
ModelingTools: Add support for reading and writing to a specific LOD via IMeshDescriptionProvider/Committer. Refactor various other aspects of MeshDescription access. Update MeshTransferTool to be able to transfer from and to specific LODs.
Add new MeshTargetInterfaceTypes.h file, move EStaticMeshEditingLOD there and rename to EMeshLODIdentifier. Add FGetMeshParameters and FCommitMeshParameters types.
IMeshDescriptionProvider::GetMeshDescription() now takes FGetMeshParameters to optionally specify LOD.
Added IMeshDescriptionProvider::GetMeshDescriptionCopy() function, to handle copy-case.
removed IMeshDescriptionProvider::CalculateAutoGeneratedAttributes(). This was only being used to force Tangents computation, which can now be done via GetMeshDescriptionCopy() and FGetMeshParameters.bWantMeshTangents option
IMeshDescriptionCommitter commit functions now take a FCommitMeshParameters to optionally specify target LOD.
StaticMeshComponentToolTarget::GetMeshDescriptionCopy() added, optionally computes auto-generated MeshDescription attributes on the copy
StaticMesh(Component)ToolTarget updated to support FCommitMeshParameters target-LOD.
SkeletalMesh, Volume, and DynamicMesh ToolTargets updated for new APIs but do not currently support any of the new LOD parameters. These should never be called w/ LOD parameters in the current codebase, ensures added to catch any errors (they would be non-fatal).
UE::ToolTarget::GetMeshDescription() and GetMeshDescriptionCopy() in now take FGetMeshParameters argument.
Removed bWantMeshTangents param to GetMeshDescriptionCopy(), now done via FGetMeshParameters. Updated call sites.
TransferMeshesTool now supports specifying read and write LOD (numbered or HiRes) for StaticMeshComponent source/target, via above functions.
TransferMeshesTool can now also target a new LOD in a StaticMeshComponent, index is 1 larger than current maximum source LOD.
#rb lonnie.li, rinat.abdrashitov
#rnx
#jira none
#preflight 61b8d56b2e65a1df046aa5e1
#ROBOMERGE-AUTHOR: ryan.schmidt
#ROBOMERGE-SOURCE: CL 18461686 in //UE5/Release-5.0/... via CL 18461725
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v899-18417669)
[CL 18461778 by ryan schmidt in ue5-release-engine-test branch]
2021-12-14 18:40:01 -05:00
|
|
|
* Return a copy of the MeshDescription underlying a ToolTarget
|
2021-06-15 17:05:40 -04:00
|
|
|
* @return a new MeshDescription, which may be empty if the Target doesn't have a mesh
|
|
|
|
|
*/
|
ModelingTools: Add support for reading and writing to a specific LOD via IMeshDescriptionProvider/Committer. Refactor various other aspects of MeshDescription access. Update MeshTransferTool to be able to transfer from and to specific LODs.
Add new MeshTargetInterfaceTypes.h file, move EStaticMeshEditingLOD there and rename to EMeshLODIdentifier. Add FGetMeshParameters and FCommitMeshParameters types.
IMeshDescriptionProvider::GetMeshDescription() now takes FGetMeshParameters to optionally specify LOD.
Added IMeshDescriptionProvider::GetMeshDescriptionCopy() function, to handle copy-case.
removed IMeshDescriptionProvider::CalculateAutoGeneratedAttributes(). This was only being used to force Tangents computation, which can now be done via GetMeshDescriptionCopy() and FGetMeshParameters.bWantMeshTangents option
IMeshDescriptionCommitter commit functions now take a FCommitMeshParameters to optionally specify target LOD.
StaticMeshComponentToolTarget::GetMeshDescriptionCopy() added, optionally computes auto-generated MeshDescription attributes on the copy
StaticMesh(Component)ToolTarget updated to support FCommitMeshParameters target-LOD.
SkeletalMesh, Volume, and DynamicMesh ToolTargets updated for new APIs but do not currently support any of the new LOD parameters. These should never be called w/ LOD parameters in the current codebase, ensures added to catch any errors (they would be non-fatal).
UE::ToolTarget::GetMeshDescription() and GetMeshDescriptionCopy() in now take FGetMeshParameters argument.
Removed bWantMeshTangents param to GetMeshDescriptionCopy(), now done via FGetMeshParameters. Updated call sites.
TransferMeshesTool now supports specifying read and write LOD (numbered or HiRes) for StaticMeshComponent source/target, via above functions.
TransferMeshesTool can now also target a new LOD in a StaticMeshComponent, index is 1 larger than current maximum source LOD.
#rb lonnie.li, rinat.abdrashitov
#rnx
#jira none
#preflight 61b8d56b2e65a1df046aa5e1
#ROBOMERGE-AUTHOR: ryan.schmidt
#ROBOMERGE-SOURCE: CL 18461686 in //UE5/Release-5.0/... via CL 18461725
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v899-18417669)
[CL 18461778 by ryan schmidt in ue5-release-engine-test branch]
2021-12-14 18:40:01 -05:00
|
|
|
MODELINGCOMPONENTS_API FMeshDescription GetMeshDescriptionCopy(
|
|
|
|
|
UToolTarget* Target,
|
|
|
|
|
const FGetMeshParameters& GetMeshParams = FGetMeshParameters());
|
2021-06-15 17:05:40 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Fetch a DynamicMesh3 representing the given ToolTarget. This may be a conversion of the output of GetMeshDescription().
|
2021-05-28 02:09:37 -04:00
|
|
|
* This function returns a copy, so the caller can take ownership of this Mesh.
|
2021-06-11 22:42:32 -04:00
|
|
|
* @param bWantMeshTangents if true, tangents will be returned if the target has them available. This may require that they be auto-calculated in some cases (which may be expensive)
|
2021-05-28 02:09:37 -04:00
|
|
|
* @return a created DynamicMesh3, which may be empty if the Target doesn't have a mesh
|
|
|
|
|
*/
|
2021-06-11 22:42:32 -04:00
|
|
|
MODELINGCOMPONENTS_API UE::Geometry::FDynamicMesh3 GetDynamicMeshCopy(UToolTarget* Target, bool bWantMeshTangents = false);
|
2021-05-28 02:09:37 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* EDynamicMeshUpdateResult is returned by functions below that update a ToolTarget with a new Mesh
|
|
|
|
|
*/
|
|
|
|
|
enum class EDynamicMeshUpdateResult
|
|
|
|
|
{
|
|
|
|
|
/** Update was successful */
|
|
|
|
|
Ok = 0,
|
|
|
|
|
/** Update failed */
|
|
|
|
|
Failed = 1,
|
|
|
|
|
/** Update was successful, but required that the entire target mesh be replaced, instead of a (requested) partial update */
|
|
|
|
|
Ok_ForcedFullUpdate = 2
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2021-06-08 03:51:23 -04:00
|
|
|
/**
|
|
|
|
|
* Update the Mesh in a ToolTarget based on the provided MeshDescription, and optional material set
|
|
|
|
|
* @return EDynamicMeshUpdateResult::Ok on success
|
|
|
|
|
*/
|
|
|
|
|
MODELINGCOMPONENTS_API EDynamicMeshUpdateResult CommitMeshDescriptionUpdate(
|
|
|
|
|
UToolTarget* Target,
|
|
|
|
|
const FMeshDescription* UpdatedMesh,
|
|
|
|
|
const FComponentMaterialSet* UpdatedMaterials = nullptr);
|
|
|
|
|
|
2021-12-06 12:42:19 -05:00
|
|
|
/**
|
|
|
|
|
* Update the Mesh in a ToolTarget based on the provided MeshDescription, and optional material set
|
|
|
|
|
* @return EDynamicMeshUpdateResult::Ok on success
|
|
|
|
|
*/
|
|
|
|
|
MODELINGCOMPONENTS_API EDynamicMeshUpdateResult CommitMeshDescriptionUpdate(
|
|
|
|
|
UToolTarget* Target,
|
|
|
|
|
FMeshDescription&& UpdatedMesh);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Update the Mesh in a ToolTarget based on the provided MeshDescription, and optional material set
|
|
|
|
|
* @return EDynamicMeshUpdateResult::Ok on success
|
|
|
|
|
*/
|
|
|
|
|
MODELINGCOMPONENTS_API EDynamicMeshUpdateResult CommitMeshDescriptionUpdateViaDynamicMesh(
|
|
|
|
|
UToolTarget* Target,
|
|
|
|
|
const UE::Geometry::FDynamicMesh3& UpdatedMesh,
|
|
|
|
|
bool bHaveModifiedTopology);
|
|
|
|
|
|
|
|
|
|
|
2021-06-11 22:42:32 -04:00
|
|
|
/**
|
|
|
|
|
* Update the Mesh in a ToolTarget based on the provided DynamicMesh, and optional material set
|
|
|
|
|
* @param bHaveModifiedTopology If the update only changes vertex or attribute values (but not counts), then in some cases a more efficient and/or less destructive update can be applied to the Target
|
|
|
|
|
* @param ConversionOptions if the commit to the Target involves conversion to MeshDescription, these options can configure that conversion
|
|
|
|
|
* @param UpdatedMaterials optional new material set that will be applied to the updated Target, and the Target Asset if available. If more control is needed use CommitMaterialSetUpdate()
|
|
|
|
|
* @return EDynamicMeshUpdateResult::Ok on success
|
|
|
|
|
*/
|
|
|
|
|
MODELINGCOMPONENTS_API EDynamicMeshUpdateResult CommitDynamicMeshUpdate(
|
|
|
|
|
UToolTarget* Target,
|
|
|
|
|
const UE::Geometry::FDynamicMesh3& UpdatedMesh,
|
|
|
|
|
bool bHaveModifiedTopology,
|
|
|
|
|
const FConversionToMeshDescriptionOptions& ConversionOptions = FConversionToMeshDescriptionOptions(),
|
|
|
|
|
const FComponentMaterialSet* UpdatedMaterials = nullptr);
|
2021-06-08 03:51:23 -04:00
|
|
|
|
2021-05-28 02:09:37 -04:00
|
|
|
/**
|
|
|
|
|
* Update the UV sets of the ToolTarget's mesh (assuming it has one) based on the provided UpdatedMesh.
|
|
|
|
|
* @todo: support updating a specific UV set/index, rather than all sets
|
|
|
|
|
* @return EDynamicMeshUpdateResult::Ok on success, or Ok_ForcedFullUpdate if any dependent mesh topology was modified
|
|
|
|
|
*/
|
|
|
|
|
MODELINGCOMPONENTS_API EDynamicMeshUpdateResult CommitDynamicMeshUVUpdate(UToolTarget* Target, const UE::Geometry::FDynamicMesh3* UpdatedMesh);
|
|
|
|
|
|
2021-12-06 12:42:19 -05:00
|
|
|
/**
|
|
|
|
|
* Update the Normals/Tangents of the ToolTarget's mesh (assuming it has one) based on the provided UpdatedMesh.
|
|
|
|
|
* @return EDynamicMeshUpdateResult::Ok on success, or Ok_ForcedFullUpdate if any dependent mesh topology was modified
|
|
|
|
|
*/
|
|
|
|
|
MODELINGCOMPONENTS_API EDynamicMeshUpdateResult CommitDynamicMeshNormalsUpdate(UToolTarget* Target, const UE::Geometry::FDynamicMesh3* UpdatedMesh, bool bUpdateTangents = false);
|
|
|
|
|
|
ModelingTools: add support for creating Volumes directly from DrawPolygon, DrawRevolve, DrawPolyPath, and AddPrimitive, CombineMeshes, CutMeshWithMesh, PlaneCut, BaseCreateFromSelected Tools. Improve support for Editing volumes, eg handling mesh/volume interactions, and add configurable auto-simplification for volumes to avoid painful Editor hangs.
- Move ToolTarget implementations, DynamicMeshToVolume to ModelingComponentsEditorOnly module
- move VolumeToDynamicMesh, DynamicMeshProvider/Commiter interfaces to ModelingComponents module
- Add UCreateMeshObjectTypeProperties property set to expose mesh/volume options
- Add FCreateMeshObjectParams::TypeHintClass to allow AVolume type (or other UClass hints) to be passed to creation APIs
- Add UE::ToolTarget::ConfigureCreateMeshObjectParams() util function in ModelingToolTargetUtil, tries to determine output type in a FCreateMeshObjectParams based on input ToolTarget
- Add UEditorModelingObjectsCreationAPI::CreateVolume() implementation
- Add UEditorModelingObjectsCreationAPI::FilterMaterials() that strips out any internal materials and replaces with WorldGridMaterial. This occurs when (eg) subtracting a Volume from a StaticMesh, because the temporary volume mesh gets assigned internal materials, but the Tools don't know this. Use in EditorModelingObjectsCreationAPI when creating new objects. UStaticMeshComponentToolTarget also does this filtering in ::CommitMaterialSetUpdate().
- Add ::ComponentTypeSupportsCollision() function to ComponentCollisionUtil, use to avoid checks/ensures for Volume targets
- Add support for automatic mesh simplification in DynamicMeshToVolume. Add CVar to VolumeDynamicMeshToolTarget.h to control max triangle count (default 500). Apply auto-simplify when creating or updating an AVolume. This prevents the Editor from blocking for long periods on meshes that are too high-res for volumes (even 500 is quite high).
- DynamicMeshToVolume now emits polygroup-faces that contain holes (ie multiple boundary loops) as a set of triangles, rather than emitting separate overlapping faces for each boundary loop
#rb none
#rnx
#jira none
#preflight 60ba50632c42ea0001cb54c5
[CL 16561742 by Ryan Schmidt in ue5-main branch]
2021-06-04 16:04:03 -04:00
|
|
|
/**
|
|
|
|
|
* FCreateMeshObjectParams::TypeHint is used by the ModelingObjectsCreationAPI to suggest what type of mesh object to create
|
|
|
|
|
* inside various Tools. This should often be derived from the input mesh object type (eg if you plane-cut a Volume, the output
|
|
|
|
|
* should be Volumes). This function interrogates the ToolTarget to try to determine this information
|
|
|
|
|
* @return true if a known type was detected and configured in FCreateMeshObjectParams::TypeHint (and possibly FCreateMeshObjectParams::TypeHintClass)
|
|
|
|
|
*/
|
|
|
|
|
MODELINGCOMPONENTS_API bool ConfigureCreateMeshObjectParams(UToolTarget* SourceTarget, FCreateMeshObjectParams& DerivedParamsOut);
|
|
|
|
|
|
|
|
|
|
|
2021-11-24 23:55:31 -05:00
|
|
|
namespace Internal
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* Not intended for direct use by tools, just for use by tool target util functions and tool target
|
|
|
|
|
* implementations that may need to do this operation. Uses the IPersistentDynamicMeshSource interface
|
|
|
|
|
* to perform an update of the dynamic mesh.
|
|
|
|
|
* Currently ignores bHaveModifiedTopology.
|
|
|
|
|
*/
|
|
|
|
|
MODELINGCOMPONENTS_API void CommitDynamicMeshViaIPersistentDynamicMeshSource(
|
|
|
|
|
IPersistentDynamicMeshSource& DynamicMeshSource,
|
|
|
|
|
const UE::Geometry::FDynamicMesh3& UpdatedMesh, bool bHaveModifiedTopology);
|
|
|
|
|
}
|
ModelingTools: add support for creating Volumes directly from DrawPolygon, DrawRevolve, DrawPolyPath, and AddPrimitive, CombineMeshes, CutMeshWithMesh, PlaneCut, BaseCreateFromSelected Tools. Improve support for Editing volumes, eg handling mesh/volume interactions, and add configurable auto-simplification for volumes to avoid painful Editor hangs.
- Move ToolTarget implementations, DynamicMeshToVolume to ModelingComponentsEditorOnly module
- move VolumeToDynamicMesh, DynamicMeshProvider/Commiter interfaces to ModelingComponents module
- Add UCreateMeshObjectTypeProperties property set to expose mesh/volume options
- Add FCreateMeshObjectParams::TypeHintClass to allow AVolume type (or other UClass hints) to be passed to creation APIs
- Add UE::ToolTarget::ConfigureCreateMeshObjectParams() util function in ModelingToolTargetUtil, tries to determine output type in a FCreateMeshObjectParams based on input ToolTarget
- Add UEditorModelingObjectsCreationAPI::CreateVolume() implementation
- Add UEditorModelingObjectsCreationAPI::FilterMaterials() that strips out any internal materials and replaces with WorldGridMaterial. This occurs when (eg) subtracting a Volume from a StaticMesh, because the temporary volume mesh gets assigned internal materials, but the Tools don't know this. Use in EditorModelingObjectsCreationAPI when creating new objects. UStaticMeshComponentToolTarget also does this filtering in ::CommitMaterialSetUpdate().
- Add ::ComponentTypeSupportsCollision() function to ComponentCollisionUtil, use to avoid checks/ensures for Volume targets
- Add support for automatic mesh simplification in DynamicMeshToVolume. Add CVar to VolumeDynamicMeshToolTarget.h to control max triangle count (default 500). Apply auto-simplify when creating or updating an AVolume. This prevents the Editor from blocking for long periods on meshes that are too high-res for volumes (even 500 is quite high).
- DynamicMeshToVolume now emits polygroup-faces that contain holes (ie multiple boundary loops) as a set of triangles, rather than emitting separate overlapping faces for each boundary loop
#rb none
#rnx
#jira none
#preflight 60ba50632c42ea0001cb54c5
[CL 16561742 by Ryan Schmidt in ue5-main branch]
2021-06-04 16:04:03 -04:00
|
|
|
|
2021-11-26 16:37:25 -05:00
|
|
|
/**
|
|
|
|
|
* @return the Physics UBodySetup for the given ToolTarget, or nullptr if it does not exist
|
|
|
|
|
*/
|
|
|
|
|
MODELINGCOMPONENTS_API UBodySetup* GetPhysicsBodySetup(UToolTarget* Target);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return the Physics CollisionDataProvider (ie Complex Collision source) for the given ToolTarget, or nullptr if it does not exist
|
|
|
|
|
*/
|
|
|
|
|
MODELINGCOMPONENTS_API IInterface_CollisionDataProvider* GetPhysicsCollisionDataProvider(UToolTarget* Target);
|
|
|
|
|
|
|
|
|
|
|
ModelingTools: add support for creating Volumes directly from DrawPolygon, DrawRevolve, DrawPolyPath, and AddPrimitive, CombineMeshes, CutMeshWithMesh, PlaneCut, BaseCreateFromSelected Tools. Improve support for Editing volumes, eg handling mesh/volume interactions, and add configurable auto-simplification for volumes to avoid painful Editor hangs.
- Move ToolTarget implementations, DynamicMeshToVolume to ModelingComponentsEditorOnly module
- move VolumeToDynamicMesh, DynamicMeshProvider/Commiter interfaces to ModelingComponents module
- Add UCreateMeshObjectTypeProperties property set to expose mesh/volume options
- Add FCreateMeshObjectParams::TypeHintClass to allow AVolume type (or other UClass hints) to be passed to creation APIs
- Add UE::ToolTarget::ConfigureCreateMeshObjectParams() util function in ModelingToolTargetUtil, tries to determine output type in a FCreateMeshObjectParams based on input ToolTarget
- Add UEditorModelingObjectsCreationAPI::CreateVolume() implementation
- Add UEditorModelingObjectsCreationAPI::FilterMaterials() that strips out any internal materials and replaces with WorldGridMaterial. This occurs when (eg) subtracting a Volume from a StaticMesh, because the temporary volume mesh gets assigned internal materials, but the Tools don't know this. Use in EditorModelingObjectsCreationAPI when creating new objects. UStaticMeshComponentToolTarget also does this filtering in ::CommitMaterialSetUpdate().
- Add ::ComponentTypeSupportsCollision() function to ComponentCollisionUtil, use to avoid checks/ensures for Volume targets
- Add support for automatic mesh simplification in DynamicMeshToVolume. Add CVar to VolumeDynamicMeshToolTarget.h to control max triangle count (default 500). Apply auto-simplify when creating or updating an AVolume. This prevents the Editor from blocking for long periods on meshes that are too high-res for volumes (even 500 is quite high).
- DynamicMeshToVolume now emits polygroup-faces that contain holes (ie multiple boundary loops) as a set of triangles, rather than emitting separate overlapping faces for each boundary loop
#rb none
#rnx
#jira none
#preflight 60ba50632c42ea0001cb54c5
[CL 16561742 by Ryan Schmidt in ue5-main branch]
2021-06-04 16:04:03 -04:00
|
|
|
|
2021-05-28 02:09:37 -04:00
|
|
|
} // end namespace ToolTarget
|
|
|
|
|
} // end namespace UE
|