Skip to content

Commit

Permalink
Fix GLB model export
Browse files Browse the repository at this point in the history
  • Loading branch information
ds5678 committed Feb 1, 2024
1 parent 8bb6695 commit 6dd8ee9
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public override bool TryCreateCollection(IUnityObjectBase asset, [NotNullWhen(tr
}
else if (PrefabExportCollection.IsValidAsset(asset))
{
exportCollection = new GlbPrefabModelExportCollection(this, GetRoot(asset));
exportCollection = new GlbPrefabModelExportCollection(this, asset);
}
else
{
Expand Down Expand Up @@ -68,7 +68,7 @@ public override bool Export(IExportContainer container, IEnumerable<IUnityObject
return ExportModel(assets, path, false); //Called by the prefab exporter
}

public bool ExportModel(IEnumerable<IUnityObjectBase> assets, string path, bool isScene)
public static bool ExportModel(IEnumerable<IUnityObjectBase> assets, string path, bool isScene)
{
ReadOnlySpan<byte> data = ExportBinary(assets, isScene);
if (data.Length == 0)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
using AssetRipper.Assets;
using AssetRipper.Export.UnityProjects.Project;
using AssetRipper.SourceGenerated.Classes.ClassID_1;
using AssetRipper.SourceGenerated.Classes.ClassID_18;
using AssetRipper.SourceGenerated.Extensions;

namespace AssetRipper.Export.UnityProjects.Models
{
public sealed class GlbPrefabModelExportCollection : AssetsExportCollection<IGameObject>
public sealed class GlbPrefabModelExportCollection : PrefabExportCollection
{
public GlbPrefabModelExportCollection(GlbModelExporter assetExporter, IGameObject root) : base(assetExporter, root)
public GlbPrefabModelExportCollection(GlbModelExporter assetExporter, IUnityObjectBase asset) : base(assetExporter, asset)
{
foreach (IEditorExtension extension in root.FetchHierarchy())
{
AddAsset(extension);
}
}

protected override string GetExportExtension(IUnityObjectBase asset) => "glb";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public GlbSceneModelExportCollection(GlbModelExporter assetExporter, SceneDefini

protected override bool ExportScene(IExportContainer container, string folderPath, string filePath, string sceneName)
{
return ((GlbModelExporter)AssetExporter).ExportModel(ExportableAssets, filePath, true);
return GlbModelExporter.ExportModel(ExportableAssets, filePath, true);
}

public override string ExportExtension => "glb";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

namespace AssetRipper.Export.UnityProjects.Project
{
public sealed class PrefabExportCollection : AssetsExportCollection<IPrefabInstance>
public class PrefabExportCollection : AssetsExportCollection<IPrefabInstance>
{
public PrefabExportCollection(IAssetExporter assetExporter, IUnityObjectBase asset)
: this(assetExporter, GetRootGameObjectAndPrefab(asset))
Expand Down

0 comments on commit 6dd8ee9

Please sign in to comment.