mirror of
https://github.com/4sval/FModel.git
synced 2026-12-04 23:02:22 -06:00
Houdini Static Mesh support / HDA export
This commit is contained in:
Submodule CUE4Parse updated: 83b7d69304...52f96d60ea
@@ -178,6 +178,7 @@ public enum EAssetFamily
|
||||
Criware,
|
||||
Wwise,
|
||||
FMod,
|
||||
Houdini,
|
||||
}
|
||||
|
||||
public enum EUnluacMode
|
||||
|
||||
@@ -48,6 +48,7 @@ using CUE4Parse.UE4.Assets.Exports.Criware;
|
||||
using CUE4Parse.UE4.Assets.Exports.Engine;
|
||||
using CUE4Parse.UE4.Assets.Exports.Fmod;
|
||||
using CUE4Parse.UE4.Assets.Exports.GeometryCollection;
|
||||
using CUE4Parse.UE4.Assets.Exports.Houdini;
|
||||
using CUE4Parse.UE4.Assets.Exports.Material;
|
||||
using CUE4Parse.UE4.Assets.Exports.Sound;
|
||||
using CUE4Parse.UE4.Assets.Exports.StaticMesh;
|
||||
@@ -1600,6 +1601,7 @@ public class CUE4ParseViewModel : ViewModel
|
||||
case UPaperSprite when isNone && UserSettings.Default.PreviewMaterials:
|
||||
case UStaticMesh when isNone && UserSettings.Default.PreviewStaticMeshes:
|
||||
case UIRMesh when isNone && UserSettings.Default.PreviewStaticMeshes:
|
||||
case UHoudiniStaticMesh when isNone && UserSettings.Default.PreviewStaticMeshes:
|
||||
case UGeometryCollection when isNone && UserSettings.Default.PreviewStaticMeshes:
|
||||
case USkinnedAsset when isNone && UserSettings.Default.PreviewSkeletalMeshes:
|
||||
case USkeleton when isNone && UserSettings.Default.SaveSkeletonAsMesh:
|
||||
@@ -1634,6 +1636,8 @@ public class CUE4ParseViewModel : ViewModel
|
||||
}
|
||||
case UStaticMesh when HasFlag(bulk, EBulkType.Meshes):
|
||||
case UIRMesh when HasFlag(bulk, EBulkType.Meshes):
|
||||
case UHoudiniAsset when HasFlag(bulk, EBulkType.Meshes):
|
||||
case UHoudiniStaticMesh when HasFlag(bulk, EBulkType.Meshes):
|
||||
case UGeometryCollection when HasFlag(bulk, EBulkType.Meshes):
|
||||
case USkinnedAsset when HasFlag(bulk, EBulkType.Meshes):
|
||||
case USkeleton when UserSettings.Default.SaveSkeletonAsMesh && HasFlag(bulk, EBulkType.Meshes):
|
||||
|
||||
@@ -32,6 +32,7 @@ using CUE4Parse.UE4.Assets.Exports.Fmod;
|
||||
using CUE4Parse.UE4.Assets.Exports.FMod;
|
||||
using CUE4Parse.UE4.Assets.Exports.Foliage;
|
||||
using CUE4Parse.UE4.Assets.Exports.GeometryCollection;
|
||||
using CUE4Parse.UE4.Assets.Exports.Houdini;
|
||||
using CUE4Parse.UE4.Assets.Exports.Internationalization;
|
||||
using CUE4Parse.UE4.Assets.Exports.LevelSequence;
|
||||
using CUE4Parse.UE4.Assets.Exports.Material;
|
||||
@@ -220,6 +221,8 @@ public class GameFileViewModel(GameFile asset) : ViewModel
|
||||
UFMODEvent or UFMODBank or UFMODBankLookup or UFMODBus
|
||||
or UFMODSnapshot or UFMODSnapshotReverb or UFMODVCA => EAssetFamily.FMod,
|
||||
|
||||
UHoudiniAsset or UHoudiniStaticMesh => EAssetFamily.Houdini,
|
||||
|
||||
_ => EAssetFamily.None,
|
||||
};
|
||||
|
||||
@@ -235,12 +238,15 @@ public class GameFileViewModel(GameFile asset) : ViewModel
|
||||
UClassCookedMetaData or UStructCookedMetaData or UEnumCookedMetaData => (EAssetCategory.CookedMetaData, EBulkType.None),
|
||||
|
||||
UStaticMesh => (EAssetCategory.StaticMesh, EBulkType.Meshes),
|
||||
UHoudiniStaticMesh => (EAssetCategory.StaticMesh, EBulkType.Meshes),
|
||||
USkeletalMesh => (EAssetCategory.SkeletalMesh, EBulkType.Meshes),
|
||||
UChaosClothAsset => (EAssetCategory.ChaosClothAsset, EBulkType.Meshes),
|
||||
UCustomizableObject => (EAssetCategory.CustomizableObject, EBulkType.None),
|
||||
UNaniteDisplacedMesh => (EAssetCategory.NaniteDisplacedMesh, EBulkType.None),
|
||||
UGeometryCollection => (EAssetCategory.GeometryCollection, EBulkType.Meshes),
|
||||
|
||||
UHoudiniAsset => (EAssetCategory.Data, EBulkType.Meshes),
|
||||
|
||||
UTexture => (EAssetCategory.Texture, EBulkType.Textures),
|
||||
|
||||
UMaterialInterface => (EAssetCategory.Material, EBulkType.None),
|
||||
@@ -369,6 +375,7 @@ public class GameFileViewModel(GameFile asset) : ViewModel
|
||||
"acb" or "acf" or "adx" or "awb" or "hca" or "usm" => EAssetFamily.Criware,
|
||||
"bnk" or "pck" or "wem" => EAssetFamily.Wwise,
|
||||
"bank" or "fsb" => EAssetFamily.FMod,
|
||||
"hda" or "hip" => EAssetFamily.Houdini,
|
||||
_ => EAssetFamily.None,
|
||||
};
|
||||
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
<SolidColorBrush x:Key="CriwareBrush" Color="#005bab" />
|
||||
<SolidColorBrush x:Key="WwiseBrush" Color="#0152a1" />
|
||||
<SolidColorBrush x:Key="FModBrush" Color="#00758f" />
|
||||
<SolidColorBrush x:Key="HoudiniBrush" Color="#ff6600" />
|
||||
|
||||
<!-- For specific games -->
|
||||
<SolidColorBrush x:Key="BorderlandsBrush" Color="Yellow" />
|
||||
|
||||
@@ -118,6 +118,8 @@ public class FileToGeometryConverter : IMultiValueConverter
|
||||
(EAssetFamily.FMod, EAssetCategory.Data) => ("FModIcon", "FModBrush"),
|
||||
(EAssetFamily.FMod, _) => ("FModIcon", brush),
|
||||
|
||||
(EAssetFamily.Houdini, _) => ("HoudiniIcon", "HoudiniBrush"),
|
||||
|
||||
_ => (geometry, brush),
|
||||
};
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -162,7 +162,7 @@ public class Skeleton : IDisposable
|
||||
{
|
||||
bone.AnimatedBySequences.Add(s);
|
||||
}
|
||||
sequence.RetargetTracks(animation.Skeleton);
|
||||
sequence.RetargetTracks(animation.Skeleton.ReferenceSkeleton);
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
|
||||
@@ -2,12 +2,12 @@ using System;
|
||||
using System.Numerics;
|
||||
using CUE4Parse.GameTypes.Nascar.Assets.Exports;
|
||||
using CUE4Parse.UE4.Assets.Exports.GeometryCollection;
|
||||
using CUE4Parse.UE4.Assets.Exports.Houdini;
|
||||
using CUE4Parse.UE4.Assets.Exports.Material;
|
||||
using CUE4Parse.UE4.Assets.Exports.StaticMesh;
|
||||
using CUE4Parse.UE4.Assets.Exports.Texture;
|
||||
using CUE4Parse.UE4.Objects.Core.Math;
|
||||
using CUE4Parse.UE4.Objects.PhysicsEngine;
|
||||
using CUE4Parse.UE4.Objects.UObject;
|
||||
using CUE4Parse_Conversion.Dto;
|
||||
using FModel.Views.Snooper.Shading;
|
||||
using OpenTK.Graphics.OpenGL4;
|
||||
@@ -155,10 +155,16 @@ public class StaticModel : UModel<MeshVertex>
|
||||
public StaticModel(UIRMesh export, StaticMeshDto mesh, int meshIndex)
|
||||
: base(export, mesh.LODs[LodLevel], export.Materials, mesh.LODs[LodLevel].Vertices, mesh.LODs.Count)
|
||||
{
|
||||
Name = meshIndex > 0 ? $"{Name}_{meshIndex}": Name;
|
||||
Name = meshIndex > 0 ? $"{Name}_{meshIndex}" : Name;
|
||||
Box = mesh.Bounds * Constants.SCALE_DOWN_RATIO;
|
||||
}
|
||||
|
||||
public StaticModel(UHoudiniStaticMesh export, StaticMeshDto staticMesh, Transform transform = null)
|
||||
: base(export, staticMesh.LODs[LodLevel], export.Materials, staticMesh.LODs[LodLevel].Vertices, staticMesh.LODs.Count, transform)
|
||||
{
|
||||
Box = staticMesh.Bounds * Constants.SCALE_DOWN_RATIO;
|
||||
}
|
||||
|
||||
public override void RenderCollision(Shader shader)
|
||||
{
|
||||
base.RenderCollision(shader);
|
||||
|
||||
@@ -4,12 +4,14 @@ using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
using CUE4Parse.GameTypes.Nascar.Assets.Exports;
|
||||
using CUE4Parse.UE4.Assets.Exports;
|
||||
using CUE4Parse.UE4.Assets.Exports.Animation;
|
||||
using CUE4Parse.UE4.Assets.Exports.Component.SplineMesh;
|
||||
using CUE4Parse.UE4.Assets.Exports.Component.StaticMesh;
|
||||
using CUE4Parse.UE4.Assets.Exports.Engine;
|
||||
using CUE4Parse.UE4.Assets.Exports.GeometryCollection;
|
||||
using CUE4Parse.UE4.Assets.Exports.Houdini;
|
||||
using CUE4Parse.UE4.Assets.Exports.Material;
|
||||
using CUE4Parse.UE4.Assets.Exports.StaticMesh;
|
||||
using CUE4Parse.UE4.Assets.Exports.Texture;
|
||||
@@ -98,6 +100,9 @@ public class Renderer : IDisposable
|
||||
case UIRMeshComponent when export.Value is UIRMeshComponent meshcomp:
|
||||
LoadIRMeshComponent(meshcomp);
|
||||
break;
|
||||
case UHoudiniStaticMesh when export.Value is UHoudiniStaticMesh hst:
|
||||
LoadHoudiniStaticMesh(hst);
|
||||
break;
|
||||
case UGeometryCollection when export.Value is UGeometryCollection gc:
|
||||
LoadStaticMesh(gc, UserSettings.Default.NaniteMeshExportFormat);
|
||||
break;
|
||||
@@ -408,6 +413,31 @@ public class Renderer : IDisposable
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadHoudiniStaticMesh(UHoudiniStaticMesh original)
|
||||
{
|
||||
var guid = new FGuid((uint) original.GetFullName().GetHashCode());
|
||||
if (Options.TryGetModel(guid, out var model))
|
||||
{
|
||||
model.AddInstance(Transform.Identity);
|
||||
Application.Current.Dispatcher.Invoke(model.SetupInstances);
|
||||
return;
|
||||
}
|
||||
|
||||
StaticMeshDto mesh;
|
||||
try
|
||||
{
|
||||
mesh = new StaticMeshDto(original);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Error(e, "Failed to convert houdini static mesh");
|
||||
return;
|
||||
}
|
||||
|
||||
Options.Models[guid] = new StaticModel(original, mesh);
|
||||
Options.SelectModel(guid);
|
||||
}
|
||||
|
||||
private void LoadStaticMesh(UGeometryCollection original, ENaniteMeshFormat naniteFormat = ENaniteMeshFormat.NoNanite)
|
||||
{
|
||||
var guid = new FGuid((uint) original.GetFullName().GetHashCode());
|
||||
|
||||
Reference in New Issue
Block a user