2021-05-13 13:22:55 -04:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "CoreMinimal.h"
|
|
|
|
|
#include "UObject/Interface.h"
|
|
|
|
|
|
|
|
|
|
#include "GeometryBase.h"
|
|
|
|
|
|
|
|
|
|
#include "DynamicMeshCommitter.generated.h"
|
|
|
|
|
|
|
|
|
|
PREDECLARE_GEOMETRY(class FDynamicMesh3);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UINTERFACE()
|
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 MODELINGCOMPONENTS_API UDynamicMeshCommitter : public UInterface
|
2021-05-13 13:22:55 -04:00
|
|
|
{
|
|
|
|
|
GENERATED_BODY()
|
|
|
|
|
};
|
|
|
|
|
|
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 MODELINGCOMPONENTS_API IDynamicMeshCommitter
|
2021-05-13 13:22:55 -04:00
|
|
|
{
|
|
|
|
|
GENERATED_BODY()
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Extra information that can be passed to a CommitMesh call to potentially make
|
|
|
|
|
* the commit faster. Note that setting any of these to false doesn't mean that
|
|
|
|
|
* the corresponding data won't be updated, because a target may choose to always
|
|
|
|
|
* update everything. But it may help some targets do faster updates by not
|
|
|
|
|
* updating things that stayed the same.
|
|
|
|
|
*/
|
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 MODELINGCOMPONENTS_API FDynamicMeshCommitInfo
|
2021-05-13 13:22:55 -04:00
|
|
|
{
|
2021-08-11 20:29:24 -04:00
|
|
|
/** Initializes each of the b*Changed members to bInitValue */
|
2021-05-13 13:22:55 -04:00
|
|
|
FDynamicMeshCommitInfo(bool bInitValue)
|
|
|
|
|
{
|
|
|
|
|
bPositionsChanged =
|
|
|
|
|
bTopologyChanged =
|
|
|
|
|
bPolygroupsChanged =
|
|
|
|
|
bNormalsChanged =
|
|
|
|
|
bTangentsChanged =
|
|
|
|
|
bUVsChanged =
|
|
|
|
|
bVertexColorsChanged = bInitValue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** Leaves everything initialized to default (true) */
|
|
|
|
|
FDynamicMeshCommitInfo() {}
|
|
|
|
|
|
|
|
|
|
bool bPositionsChanged = true;
|
|
|
|
|
bool bTopologyChanged = true;
|
|
|
|
|
bool bPolygroupsChanged = true;
|
|
|
|
|
bool bNormalsChanged = true;
|
|
|
|
|
bool bTangentsChanged = true;
|
|
|
|
|
bool bUVsChanged = true;
|
|
|
|
|
bool bVertexColorsChanged = true;
|
2021-08-11 20:29:24 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Intentionally left out of the constructor. This is a different
|
|
|
|
|
* parameter than the b*Changed members that augments how vertex
|
|
|
|
|
* colors are transformed during the commit.
|
|
|
|
|
*/
|
|
|
|
|
bool bTransformVertexColorsSRGBToLinear = false;
|
2021-05-13 13:22:55 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
virtual void CommitDynamicMesh(const UE::Geometry::FDynamicMesh3& Mesh)
|
|
|
|
|
{
|
|
|
|
|
FDynamicMeshCommitInfo CommitInfo;
|
|
|
|
|
CommitDynamicMesh(Mesh, CommitInfo);
|
|
|
|
|
};
|
|
|
|
|
virtual void CommitDynamicMesh(const UE::Geometry::FDynamicMesh3& Mesh, const FDynamicMeshCommitInfo& CommitInfo) = 0;
|
|
|
|
|
};
|