Files
mesh-project-duplicate-remover/Source/OptimizerEditor/Private/OptimizerReconciler.h
Bonchellon a95b299680 Mesh Optimizer: sibling StaticMesh duplicate remover (UE 5.7)
Editor plugin that detects geometrically-identical sibling StaticMeshes across a
level, rebases each placement onto one canonical mesh with a corrected transform
(W' = D * W, verified by exact vertex matching), and can collapse groups into HISM.
Native Slate tool panel + BlueprintCallable UOptimizerSubsystem.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-01 18:26:45 +03:00

28 lines
1021 B
C++

// Copyright IHY.
#pragma once
#include "CoreMinimal.h"
namespace OptimizerReconciler
{
/**
* Compute the corrected world transform for the canonical mesh so it lands exactly where the
* sibling currently sits. With D = CanonToMember (row-vector matrix) and W = sibling world
* transform: W'_matrix = D * W_matrix (the verified formula).
*
* FTransform cannot represent shear; if the actor's non-uniform scale combined with D's rotation
* produces shear, the reconstructed FTransform deviates from the exact matrix at the bbox corners.
* We measure that deviation and reject (return false) when it exceeds ShearTol — the caller then
* skips and reports the placement rather than silently corrupting it.
*
* @return false if the result shears (unrepresentable) — OutWprime is then not safe to apply.
*/
bool ComputeCorrectedWorld(
const FMatrix& CanonToMember,
const FTransform& W,
const FBox& CanonLocalBounds,
double ShearTol,
FTransform& OutWprime,
double& OutMaxCornerDev);
}