| 405 | } |
| 406 | |
| 407 | FString MjUtils::PrettifyName(const FString& Name, const FString& PrefixToStrip) |
| 408 | { |
| 409 | FString Result = Name; |
| 410 | |
| 411 | // 1. Strip the Articulation name prefix if provided |
| 412 | if (!PrefixToStrip.IsEmpty() && Result.StartsWith(PrefixToStrip)) |
| 413 | { |
| 414 | Result = Result.RightChop(PrefixToStrip.Len()); |
| 415 | if (Result.StartsWith(TEXT("_"))) |
| 416 | Result = Result.RightChop(1); |
| 417 | } |
| 418 | |
| 419 | // 2. Strip UAID suffix: everything from the first _UAID_ (common in UE) |
| 420 | int32 UaidIdx = Result.Find(TEXT("_UAID_")); |
| 421 | if (UaidIdx != INDEX_NONE) |
| 422 | { |
| 423 | Result = Result.Left(UaidIdx); |
| 424 | } |
| 425 | |
| 426 | // 3. Strip _C_ suffix (common for Blueprint classes) |
| 427 | int32 CIdx = Result.Find(TEXT("_C_"), ESearchCase::CaseSensitive, ESearchDir::FromEnd); |
| 428 | if (CIdx != INDEX_NONE && CIdx == Result.Len() - 3) |
| 429 | { |
| 430 | Result = Result.Left(CIdx); |
| 431 | } |
| 432 | |
| 433 | // 4. Final cleanup of leading/trailing underscores |
| 434 | Result = Result.TrimStartAndEnd().TrimChar('_'); |
| 435 | |
| 436 | return Result.IsEmpty() ? Name : Result; |
| 437 | } |
| 438 | |
| 439 | bool MjUtils::ReadVec3InMeters(const FXmlNode* Node, const TCHAR* Attr, FVector& Out, bool& bOverride) |
| 440 | { |