diff --git a/AssetEditor/ViewModels/SettingsViewModel.cs b/AssetEditor/ViewModels/SettingsViewModel.cs
index bc8996744..5cb23308b 100644
--- a/AssetEditor/ViewModels/SettingsViewModel.cs
+++ b/AssetEditor/ViewModels/SettingsViewModel.cs
@@ -29,6 +29,7 @@ partial class SettingsViewModel : ObservableObject
[ObservableProperty] private bool _loadCaPacksByDefault;
[ObservableProperty] private bool _loadWemFiles;
[ObservableProperty] private string _wwisePath;
+ [ObservableProperty] private bool _onlyLoadLod0ForReferenceMeshes;
public bool IsLoadWemFilesEnabled => LoadCaPacksByDefault;
@@ -44,6 +45,7 @@ public SettingsViewModel(ApplicationSettingsService settingsService, GameInforma
CurrentGame = _settingsService.CurrentSettings.CurrentGame;
LoadCaPacksByDefault = _settingsService.CurrentSettings.LoadCaPacksByDefault;
LoadWemFiles = _settingsService.CurrentSettings.LoadWemFiles;
+ OnlyLoadLod0ForReferenceMeshes = _settingsService.CurrentSettings.OnlyLoadLod0ForReferenceMeshes;
foreach (var game in gameInformationFactory.Games.OrderBy(g => g.DisplayName))
{
GameDirectores.Add(
@@ -72,6 +74,7 @@ [RelayCommand] private void Save()
_settingsService.CurrentSettings.CurrentGame = CurrentGame;
_settingsService.CurrentSettings.LoadCaPacksByDefault = LoadCaPacksByDefault;
_settingsService.CurrentSettings.LoadWemFiles = LoadWemFiles;
+ _settingsService.CurrentSettings.OnlyLoadLod0ForReferenceMeshes = OnlyLoadLod0ForReferenceMeshes;
_settingsService.CurrentSettings.GameDirectories.Clear();
foreach (var item in GameDirectores)
_settingsService.CurrentSettings.GameDirectories.Add(new ApplicationSettings.GamePathPair() { Game = item.GameType, Path = item.Path });
diff --git a/AssetEditor/Views/Settings/SettingsView.xaml b/AssetEditor/Views/Settings/SettingsView.xaml
index 54a857043..793b113b6 100644
--- a/AssetEditor/Views/Settings/SettingsView.xaml
+++ b/AssetEditor/Views/Settings/SettingsView.xaml
@@ -33,7 +33,7 @@
-
+
@@ -47,6 +47,7 @@
+
@@ -72,7 +73,10 @@
-
+
+
+
+
diff --git a/Editors/AnimationMeta/Visualisation/MetaDataFactory.cs b/Editors/AnimationMeta/Visualisation/MetaDataFactory.cs
index a16415fd7..01ba6e813 100644
--- a/Editors/AnimationMeta/Visualisation/MetaDataFactory.cs
+++ b/Editors/AnimationMeta/Visualisation/MetaDataFactory.cs
@@ -137,7 +137,7 @@ private IMetaDataInstance CreateAnimatedProp(IAnimatedPropMeta animatedPropMeta,
var propPlayer = _animationsContainerComponent.RegisterAnimationPlayer(new AnimationPlayer(), propName + Guid.NewGuid());
// Configure the mesh
- var loadedNode = _complexMeshLoader.Load(meshPath, new GroupNode(propName), propPlayer);
+ var loadedNode = _complexMeshLoader.Load(meshPath, new GroupNode(propName), propPlayer, false); // TODO: Could last arg be true? WOuld be better
// Configure animation
if (animationPath != null)
diff --git a/Editors/KitbasherEditor/DependencyInjectionContainer.cs b/Editors/KitbasherEditor/DependencyInjectionContainer.cs
index 36687d3c8..e1db1c83d 100644
--- a/Editors/KitbasherEditor/DependencyInjectionContainer.cs
+++ b/Editors/KitbasherEditor/DependencyInjectionContainer.cs
@@ -1,6 +1,7 @@
using Editors.KitbasherEditor.EventHandlers;
using Editors.KitbasherEditor.Services;
using Editors.KitbasherEditor.UiCommands;
+using Editors.KitbasherEditor.ViewModels;
using Editors.KitbasherEditor.ViewModels.PinTool;
using Editors.KitbasherEditor.ViewModels.SaveDialog;
using Editors.KitbasherEditor.ViewModels.SceneExplorer;
diff --git a/Editors/KitbasherEditor/Services/KitbashSceneCreator.cs b/Editors/KitbasherEditor/Services/KitbashSceneCreator.cs
index 4c9ee8556..39938198a 100644
--- a/Editors/KitbasherEditor/Services/KitbashSceneCreator.cs
+++ b/Editors/KitbasherEditor/Services/KitbashSceneCreator.cs
@@ -1,14 +1,15 @@
using System.IO;
+using Editors.KitbasherEditor.ViewModels;
using GameWorld.Core.Components;
using GameWorld.Core.SceneNodes;
using GameWorld.Core.Services;
using GameWorld.Core.Services.SceneSaving;
using GameWorld.Core.Utility;
-using KitbasherEditor.ViewModels;
using Serilog;
using Shared.Core.ErrorHandling;
using Shared.Core.PackFiles;
using Shared.Core.PackFiles.Models;
+using Shared.Core.Services;
using Shared.GameFormats.RigidModel;
using Shared.GameFormats.WsModel;
using Xceed.Wpf.AvalonDock.Layout;
@@ -19,6 +20,7 @@ public class KitbashSceneCreator
{
private readonly ILogger _logger = Logging.Create();
private readonly PackFileService _packFileService;
+ private readonly ApplicationSettingsService _settingsService;
private readonly KitbasherRootScene _kitbasherRootScene;
private readonly ComplexMeshLoader _complexMeshLoader;
private readonly SceneManager _sceneManager;
@@ -26,6 +28,7 @@ public class KitbashSceneCreator
private readonly GeometrySaveSettings _saveSettings;
public KitbashSceneCreator(
+ ApplicationSettingsService settingsService,
KitbasherRootScene kitbasherRootScene,
ComplexMeshLoader complexMeshLoader,
SceneManager sceneManager,
@@ -34,6 +37,7 @@ public KitbashSceneCreator(
GeometrySaveSettings saveSettings)
{
_packFileService = packFileService;
+ _settingsService = settingsService;
_kitbasherRootScene = kitbasherRootScene;
_complexMeshLoader = complexMeshLoader;
_sceneManager = sceneManager;
@@ -63,7 +67,7 @@ public void CreateFromPackFile(PackFile file)
rmv = ModelFactory.Create().Load(file.DataSource.ReadData());
}
- var lodNodes = _rmv2ModelNodeLoader.CreateModelNodesFromFile(rmv, modelFullPath, _kitbasherRootScene.Player, wsModel);
+ var lodNodes = _rmv2ModelNodeLoader.CreateModelNodesFromFile(rmv, modelFullPath, _kitbasherRootScene.Player, false, wsModel);
mainNode.Children.Clear();
foreach(var lodNode in lodNodes)
mainNode.AddObject(lodNode);
@@ -81,15 +85,15 @@ public void CreateFromPackFile(PackFile file)
public void LoadReference(PackFile file)
{
_logger.Here().Information($"Loading reference model - {_packFileService.GetFullPath(file)}");
- var result = LoadModel(file);
+ var result = LoadModel(file, _settingsService.CurrentSettings.OnlyLoadLod0ForReferenceMeshes);
var referenceMeshNode = _sceneManager.GetNodeByName(SpecialNodes.ReferenceMeshs);
referenceMeshNode.AddObject(result!);
}
- SceneNode? LoadModel(PackFile file)
+ SceneNode? LoadModel(PackFile file, bool onlyLoadRootNode)
{
- var loadedNode = _complexMeshLoader.Load(file, _kitbasherRootScene.Player);
+ var loadedNode = _complexMeshLoader.Load(file, _kitbasherRootScene.Player, onlyLoadRootNode);
if (loadedNode == null)
{
_logger.Here().Error("Unable to load model");
@@ -104,6 +108,7 @@ public void LoadReference(PackFile file)
if (node is Rmv2MeshNode mesh && string.IsNullOrWhiteSpace(mesh.AttachmentPointName) == false)
{
+ mesh.AnimationPlayer = _kitbasherRootScene.Player;
if (_kitbasherRootScene.Skeleton != null)
{
var boneIndex = _kitbasherRootScene.Skeleton.GetBoneIndexByName(mesh.AttachmentPointName);
diff --git a/Editors/KitbasherEditor/UiCommands/BrowseForReferenceCommand.cs b/Editors/KitbasherEditor/UiCommands/BrowseForReferenceCommand.cs
index d87982fc3..55cecfab8 100644
--- a/Editors/KitbasherEditor/UiCommands/BrowseForReferenceCommand.cs
+++ b/Editors/KitbasherEditor/UiCommands/BrowseForReferenceCommand.cs
@@ -3,6 +3,7 @@
using KitbasherEditor.ViewModels.MenuBarViews;
using Shared.Core.Events;
using Shared.Core.PackFiles;
+using Shared.Core.PackFiles.Models;
using Shared.Ui.Common.MenuSystem;
namespace Editors.KitbasherEditor.UiCommands
@@ -81,6 +82,11 @@ public void Execute(string path)
_kitbashSceneCreator.LoadReference(packFile);
}
+
+ public void Execute(PackFile file)
+ {
+ _kitbashSceneCreator.LoadReference(file);
+ }
}
public class ImportGoblinReferenceCommand : BaseImportReferenceCommand
diff --git a/Editors/KitbasherEditor/UiCommands/OpenReriggingToolCommand.cs b/Editors/KitbasherEditor/UiCommands/OpenReriggingToolCommand.cs
index 333f481db..1d162dd31 100644
--- a/Editors/KitbasherEditor/UiCommands/OpenReriggingToolCommand.cs
+++ b/Editors/KitbasherEditor/UiCommands/OpenReriggingToolCommand.cs
@@ -1,9 +1,9 @@
using System.Windows;
using CommonControls.Editors.BoneMapping.View;
+using Editors.KitbasherEditor.ViewModels;
using Editors.Shared.Core.Services;
using GameWorld.Core.Components.Selection;
using GameWorld.Core.SceneNodes;
-using KitbasherEditor.ViewModels;
using KitbasherEditor.ViewModels.MenuBarViews;
using KitbasherEditor.ViewModels.MeshFitter;
using Shared.Core.PackFiles;
diff --git a/Editors/KitbasherEditor/ViewModels/AnimationControllerViewModel.cs b/Editors/KitbasherEditor/ViewModels/AnimationControllerViewModel.cs
index 267dfa444..9607fa960 100644
--- a/Editors/KitbasherEditor/ViewModels/AnimationControllerViewModel.cs
+++ b/Editors/KitbasherEditor/ViewModels/AnimationControllerViewModel.cs
@@ -1,4 +1,7 @@
-using CommunityToolkit.Mvvm.Input;
+using System.Collections.ObjectModel;
+using System.IO;
+using System.Windows.Input;
+using CommunityToolkit.Mvvm.Input;
using Editors.KitbasherEditor.Events;
using Editors.Shared.Core.Services;
using GameWorld.Core.Animation;
@@ -7,13 +10,10 @@
using Shared.Core.PackFiles;
using Shared.Core.PackFiles.Models;
using Shared.GameFormats.Animation;
-using System.Collections.ObjectModel;
-using System.IO;
-using System.Windows.Input;
using static CommonControls.FilterDialog.FilterUserControl;
using static Editors.Shared.Core.Services.SkeletonAnimationLookUpHelper;
-namespace KitbasherEditor.ViewModels
+namespace Editors.KitbasherEditor.ViewModels
{
public class AnimationControllerViewModel : NotifyPropertyChangedImpl
{
diff --git a/Editors/KitbasherEditor/ViewModels/KitbashViewDropHandler.cs b/Editors/KitbasherEditor/ViewModels/KitbashViewDropHandler.cs
index 490278a9a..14e892e9f 100644
--- a/Editors/KitbasherEditor/ViewModels/KitbashViewDropHandler.cs
+++ b/Editors/KitbasherEditor/ViewModels/KitbashViewDropHandler.cs
@@ -1,16 +1,17 @@
-using Editors.KitbasherEditor.Services;
+using System.IO;
+using Editors.KitbasherEditor.UiCommands;
+using Shared.Core.Events;
using Shared.Ui.BaseDialogs.PackFileBrowser;
-using System.IO;
-namespace KitbasherEditor.ViewModels
+namespace Editors.KitbasherEditor.ViewModels
{
public class KitbashViewDropHandler
{
- private readonly KitbashSceneCreator _kitbashSceneCreator;
+ private readonly IUiCommandFactory _uiCommandFactory;
- public KitbashViewDropHandler(KitbashSceneCreator kitbashSceneCreator)
+ public KitbashViewDropHandler(IUiCommandFactory uiCommandFactory)
{
- _kitbashSceneCreator = kitbashSceneCreator;
+ _uiCommandFactory = uiCommandFactory;
}
public bool AllowDrop(TreeNode node, TreeNode targeNode = null)
@@ -24,9 +25,9 @@ public bool AllowDrop(TreeNode node, TreeNode targeNode = null)
return false;
}
- public bool Drop(TreeNode node, TreeNode targeNode = null)
+ public bool Drop(TreeNode node)
{
- _kitbashSceneCreator.LoadReference(node.Item);
+ _uiCommandFactory.Create().Execute(node.Item);
return true;
}
}
diff --git a/Editors/KitbasherEditor/ViewModels/KitbasherRootScene.cs b/Editors/KitbasherEditor/ViewModels/KitbasherRootScene.cs
index 3a84f9347..7406b427b 100644
--- a/Editors/KitbasherEditor/ViewModels/KitbasherRootScene.cs
+++ b/Editors/KitbasherEditor/ViewModels/KitbasherRootScene.cs
@@ -7,7 +7,7 @@
using Shared.Core.PackFiles;
using Shared.GameFormats.Animation;
-namespace KitbasherEditor.ViewModels
+namespace Editors.KitbasherEditor.ViewModels
{
public class KitbasherRootScene : ISkeletonProvider
{
diff --git a/Editors/KitbasherEditor/ViewModels/KitbasherViewModel.cs b/Editors/KitbasherEditor/ViewModels/KitbasherViewModel.cs
index c0ef8120e..6d33b0d95 100644
--- a/Editors/KitbasherEditor/ViewModels/KitbasherViewModel.cs
+++ b/Editors/KitbasherEditor/ViewModels/KitbasherViewModel.cs
@@ -1,5 +1,4 @@
using System.IO;
-using System.Windows;
using CommunityToolkit.Mvvm.ComponentModel;
using Editors.KitbasherEditor.EventHandlers;
using Editors.KitbasherEditor.Services;
@@ -18,7 +17,7 @@
using Shared.Ui.BaseDialogs.PackFileBrowser;
using Shared.Ui.Common;
-namespace KitbasherEditor.ViewModels
+namespace Editors.KitbasherEditor.ViewModels
{
public partial class KitbasherViewModel : ObservableObject,
IEditorInterface,
@@ -107,7 +106,7 @@ public bool HasUnsavedChanges
}
public bool AllowDrop(TreeNode node, TreeNode targeNode = null) => _dropHandler.AllowDrop(node, targeNode);
- public bool Drop(TreeNode node, TreeNode targeNode = null) => _dropHandler.Drop(node, targeNode);
+ public bool Drop(TreeNode node, TreeNode targeNode = null) => _dropHandler.Drop(node);
void OnFileSaved(ScopedFileSavedEvent notification)
{
diff --git a/Editors/KitbasherEditor/ViewModels/SceneNodeEditor/Nodes/MainEditableNode/MainEditableNodeViewModel.cs b/Editors/KitbasherEditor/ViewModels/SceneNodeEditor/Nodes/MainEditableNode/MainEditableNodeViewModel.cs
index 7079af3d3..66fc31f36 100644
--- a/Editors/KitbasherEditor/ViewModels/SceneNodeEditor/Nodes/MainEditableNode/MainEditableNodeViewModel.cs
+++ b/Editors/KitbasherEditor/ViewModels/SceneNodeEditor/Nodes/MainEditableNode/MainEditableNodeViewModel.cs
@@ -5,7 +5,6 @@
using Editors.Shared.Core.Services;
using GameWorld.Core.Components.Rendering;
using GameWorld.Core.SceneNodes;
-using KitbasherEditor.ViewModels;
using KitbasherEditor.Views.EditorViews;
using Shared.Core.Events;
using Shared.Ui.Common.DataTemplates;
diff --git a/Editors/KitbasherEditor/ViewModels/SceneNodeEditor/Nodes/MeshNode/Mesh.Animation/AnimationViewModel.cs b/Editors/KitbasherEditor/ViewModels/SceneNodeEditor/Nodes/MeshNode/Mesh.Animation/AnimationViewModel.cs
index 99e9341d8..1de3dbc04 100644
--- a/Editors/KitbasherEditor/ViewModels/SceneNodeEditor/Nodes/MeshNode/Mesh.Animation/AnimationViewModel.cs
+++ b/Editors/KitbasherEditor/ViewModels/SceneNodeEditor/Nodes/MeshNode/Mesh.Animation/AnimationViewModel.cs
@@ -2,7 +2,6 @@
using Editors.Shared.Core.Services;
using GameWorld.Core.SceneNodes;
using GameWorld.Core.Utility;
-using KitbasherEditor.ViewModels;
using Shared.Core.PackFiles;
using Shared.Ui.Common;
using Shared.Ui.Editors.BoneMapping;
diff --git a/Editors/KitbasherEditor/ViewModels/SceneNodeEditor/Nodes/MeshNode/Mesh.Geometry/MeshViewModel.cs b/Editors/KitbasherEditor/ViewModels/SceneNodeEditor/Nodes/MeshNode/Mesh.Geometry/MeshViewModel.cs
index f1a70790c..9bbf023f5 100644
--- a/Editors/KitbasherEditor/ViewModels/SceneNodeEditor/Nodes/MeshNode/Mesh.Geometry/MeshViewModel.cs
+++ b/Editors/KitbasherEditor/ViewModels/SceneNodeEditor/Nodes/MeshNode/Mesh.Geometry/MeshViewModel.cs
@@ -2,7 +2,6 @@
using CommunityToolkit.Mvvm.Input;
using GameWorld.Core.Components;
using GameWorld.Core.SceneNodes;
-using KitbasherEditor.ViewModels;
using Microsoft.Xna.Framework;
using Shared.GameFormats.RigidModel;
using Shared.Ui.BaseDialogs.MathViews;
diff --git a/Editors/Shared/Editors.Shared.Core/Common/SceneObjectEditor.cs b/Editors/Shared/Editors.Shared.Core/Common/SceneObjectEditor.cs
index 9a8a49f5b..91cad9a00 100644
--- a/Editors/Shared/Editors.Shared.Core/Common/SceneObjectEditor.cs
+++ b/Editors/Shared/Editors.Shared.Core/Common/SceneObjectEditor.cs
@@ -61,7 +61,7 @@ public void SetMesh(SceneObject sceneObject, PackFile file)
{
_logger.Here().Information($"Loading reference model - {_packFileService.GetFullPath(file)}");
- var loadedNode = _complexMeshLoader.Load(file, sceneObject.Player);
+ var loadedNode = _complexMeshLoader.Load(file, sceneObject.Player, false);// TODO: Could last arg be true? WOuld be better
if (loadedNode == null)
{
_logger.Here().Error("Unable to load model");
diff --git a/GameWorld/View3D/SceneNodes/Rmv2MeshNode.cs b/GameWorld/View3D/SceneNodes/Rmv2MeshNode.cs
index 12de76a09..f1f6206be 100644
--- a/GameWorld/View3D/SceneNodes/Rmv2MeshNode.cs
+++ b/GameWorld/View3D/SceneNodes/Rmv2MeshNode.cs
@@ -64,7 +64,7 @@ private Rmv2MeshNode() { }
public void Render(RenderEngineComponent renderEngine, Matrix parentWorld)
{
- var animationCapability = Material.GetCapability();
+ var animationCapability = Material.TryGetCapability();
if (animationCapability != null)
{
var data = new Matrix[256];
@@ -83,7 +83,7 @@ public void Render(RenderEngineComponent renderEngine, Matrix parentWorld)
animationCapability.AnimationTransforms = data;
animationCapability.AnimationWeightCount = Geometry.WeightCount;
- animationCapability.ApplyAnimation = AnimationPlayer != null && AnimationPlayer.IsEnabled;
+ animationCapability.ApplyAnimation = AnimationPlayer != null && AnimationPlayer.IsEnabled && Geometry.VertexFormat != UiVertexFormat.Static;
}
if (AttachmentBoneResolver != null)
diff --git a/GameWorld/View3D/SceneNodes/Rmv2ModelNodeLoader.cs b/GameWorld/View3D/SceneNodes/Rmv2ModelNodeLoader.cs
index d5f0fa732..669c8e9b4 100644
--- a/GameWorld/View3D/SceneNodes/Rmv2ModelNodeLoader.cs
+++ b/GameWorld/View3D/SceneNodes/Rmv2ModelNodeLoader.cs
@@ -5,6 +5,8 @@
using GameWorld.Core.Rendering.Materials;
using GameWorld.Core.Rendering.Materials.Shaders;
using GameWorld.Core.Services;
+using Serilog;
+using Shared.Core.ErrorHandling;
using Shared.Core.ErrorHandling.Exceptions;
using Shared.Core.PackFiles;
using Shared.GameFormats.RigidModel;
@@ -14,6 +16,7 @@ namespace GameWorld.Core.SceneNodes
{
public class Rmv2ModelNodeLoader
{
+ private readonly ILogger _logger = Logging.Create();
private readonly MeshBuilderService _meshBuilderService;
private readonly PackFileService _packFileService;
private readonly CapabilityMaterialFactory _capabilityMaterialFactory;
@@ -27,7 +30,7 @@ public Rmv2ModelNodeLoader(MeshBuilderService meshBuilderService, PackFileServic
_exceptionService = exceptionService;
}
- public List CreateModelNodesFromFile(RmvFile model, string modelFullPath, AnimationPlayer animationPlayer, WsModelFile? wsModel = null)
+ public List CreateModelNodesFromFile(RmvFile model, string modelFullPath, AnimationPlayer animationPlayer, bool onlyLoadRootNode, WsModelFile? wsModel = null)
{
WsModelMaterialProvider wsMaterialProvider;
if(wsModel != null)
@@ -71,6 +74,12 @@ public List CreateModelNodesFromFile(RmvFile model, string modelFul
var node = new Rmv2MeshNode(geometry, rmvModel.Material, shader, animationPlayer);
currentNode.AddObject(node);
}
+
+ if (onlyLoadRootNode)
+ {
+ _logger.Here().Information($"Only loading root node for mesh - {modelFullPath}");
+ break;
+ }
}
return output;
diff --git a/GameWorld/View3D/Services/ComplexMeshLoader.cs b/GameWorld/View3D/Services/ComplexMeshLoader.cs
index 01de61be6..1521049bc 100644
--- a/GameWorld/View3D/Services/ComplexMeshLoader.cs
+++ b/GameWorld/View3D/Services/ComplexMeshLoader.cs
@@ -26,17 +26,17 @@ public ComplexMeshLoader(Rmv2ModelNodeLoader rmv2ModelNodeLoader, PackFileServic
_rmv2ModelNodeLoader = rmv2ModelNodeLoader;
}
- public SceneNode Load(PackFile file, SceneNode parent, AnimationPlayer player)
+ public SceneNode Load(PackFile file, SceneNode parent, AnimationPlayer player, bool onlyLoadRootNode)
{
- return Load(file, parent, player, null);
+ return Load(file, parent, player, null, onlyLoadRootNode);
}
- public SceneNode Load(PackFile file, AnimationPlayer player)
+ public SceneNode Load(PackFile file, AnimationPlayer player, bool onlyLoadRootNode)
{
- return Load(file, null, player, null);
+ return Load(file, null, player, null, onlyLoadRootNode);
}
- SceneNode Load(PackFile file, SceneNode parent, AnimationPlayer player, string attachmentPointName)
+ SceneNode Load(PackFile file, SceneNode parent, AnimationPlayer player, string attachmentPointName, bool onlyLoadRootNode)
{
try
{
@@ -48,15 +48,15 @@ SceneNode Load(PackFile file, SceneNode parent, AnimationPlayer player, string a
switch (file.Extention)
{
case ".variantmeshdefinition":
- LoadVariantMesh(file, ref parent, player, attachmentPointName);
+ LoadVariantMesh(file, ref parent, player, attachmentPointName, onlyLoadRootNode);
break;
case ".rigid_model_v2":
- LoadRigidMesh(file, ref parent, player, attachmentPointName);
+ LoadRigidMesh(file, ref parent, player, attachmentPointName, onlyLoadRootNode);
break;
case ".wsmodel":
- LoadWsModel(file, ref parent, player, attachmentPointName);
+ LoadWsModel(file, ref parent, player, attachmentPointName, onlyLoadRootNode);
break;
default:
throw new Exception("Unknown mesh extention");
@@ -75,7 +75,7 @@ SceneNode Load(PackFile file, SceneNode parent, AnimationPlayer player, string a
}
}
- void Load(string path, SceneNode parent, AnimationPlayer player, string attachmentPointName)
+ void Load(string path, SceneNode parent, AnimationPlayer player, string attachmentPointName, bool onlyLoadRootNode)
{
var file = _packFileService.FindFile(path);
if (file == null)
@@ -84,11 +84,11 @@ void Load(string path, SceneNode parent, AnimationPlayer player, string attachme
return;
}
- Load(file, parent, player, attachmentPointName);
+ Load(file, parent, player, attachmentPointName, onlyLoadRootNode);
}
- void LoadVariantMesh(PackFile file, ref SceneNode parent, AnimationPlayer player, string attachmentPointName)
+ void LoadVariantMesh(PackFile file, ref SceneNode parent, AnimationPlayer player, string attachmentPointName, bool onlyLoadRootNode)
{
var variantMeshElement = new VariantMeshNode(file.Name);
if (parent == null)
@@ -98,27 +98,27 @@ void LoadVariantMesh(PackFile file, ref SceneNode parent, AnimationPlayer player
var meshFile = VariantMeshToXmlConverter.Load(file);
- LoadVariantMesh(meshFile, variantMeshElement, player, attachmentPointName);
+ LoadVariantMesh(meshFile, variantMeshElement, player, attachmentPointName, onlyLoadRootNode);
}
- void LoadVariantMesh(VariantMesh mesh, SceneNode root, AnimationPlayer player, string attachmentPointName)
+ void LoadVariantMesh(VariantMesh mesh, SceneNode root, AnimationPlayer player, string attachmentPointName, bool onlyLoadRootNode)
{
if (mesh.ChildSlots.Count != 0)
root = root.AddObject(new SlotsNode("Slots"));
// Load model
if (string.IsNullOrWhiteSpace(mesh.ModelReference) != true)
- Load(mesh.ModelReference.ToLower(), root, player, attachmentPointName);
+ Load(mesh.ModelReference.ToLower(), root, player, attachmentPointName, onlyLoadRootNode);
foreach (var slot in mesh.ChildSlots)
{
var slotNode = root.AddObject(new SlotNode(slot.Name + " " + slot.AttachmentPoint, slot.AttachmentPoint));
foreach (var childMesh in slot.ChildMeshes)
- LoadVariantMesh(childMesh, slotNode, player, attachmentPointName);
+ LoadVariantMesh(childMesh, slotNode, player, attachmentPointName, onlyLoadRootNode);
foreach (var meshReference in slot.ChildReferences)
- Load(meshReference.Reference.ToLower(), slotNode, player, slot.AttachmentPoint);
+ Load(meshReference.Reference.ToLower(), slotNode, player, slot.AttachmentPoint, onlyLoadRootNode);
for (var i = 0; i < slotNode.Children.Count(); i++)
{
@@ -134,13 +134,14 @@ void LoadVariantMesh(VariantMesh mesh, SceneNode root, AnimationPlayer player, s
}
}
- Rmv2ModelNode LoadRigidMesh(PackFile file, ref SceneNode parent, AnimationPlayer player, string attachmentPointName, WsModelFile? wsModel = null)
+ Rmv2ModelNode LoadRigidMesh(PackFile file, ref SceneNode parent, AnimationPlayer player, string attachmentPointName, bool onlyLoadRootNode, WsModelFile? wsModel = null)
{
var rmvModel = ModelFactory.Create().Load(file.DataSource.ReadData());
var modelFullPath = _packFileService.GetFullPath(file);
var modelNode = new Rmv2ModelNode(Path.GetFileName(file.Name));
- var lodNodes = _rmv2ModelNodeLoader.CreateModelNodesFromFile(rmvModel, modelFullPath, player, wsModel);
+ var lodNodes = _rmv2ModelNodeLoader.CreateModelNodesFromFile(rmvModel, modelFullPath, player, onlyLoadRootNode, wsModel);
+
foreach (var lodNode in lodNodes)
modelNode.AddObject(lodNode);
@@ -152,11 +153,10 @@ Rmv2ModelNode LoadRigidMesh(PackFile file, ref SceneNode parent, AnimationPlayer
else
parent.AddObject(modelNode);
-
return modelNode;
}
- void LoadWsModel(PackFile file, ref SceneNode parent, AnimationPlayer player, string attachmentPointName)
+ void LoadWsModel(PackFile file, ref SceneNode parent, AnimationPlayer player, string attachmentPointName, bool onlyLoadRootNode)
{
var wsModelNode = new WsModelGroup("WsModel - " + file.Name);
if (parent == null)
@@ -169,7 +169,7 @@ void LoadWsModel(PackFile file, ref SceneNode parent, AnimationPlayer player, st
{
var modelFile = _packFileService.FindFile(wsMaterial.GeometryPath);
var modelAsBase = wsModelNode as SceneNode;
- var loadedModelNode = LoadRigidMesh(modelFile, ref modelAsBase, player, attachmentPointName, wsMaterial);
+ var loadedModelNode = LoadRigidMesh(modelFile, ref modelAsBase, player, attachmentPointName, onlyLoadRootNode, wsMaterial);
}
}
}
diff --git a/Shared/SharedCore/Services/ApplicationSettingsService.cs b/Shared/SharedCore/Services/ApplicationSettingsService.cs
index 3ab2e9506..fa863c80c 100644
--- a/Shared/SharedCore/Services/ApplicationSettingsService.cs
+++ b/Shared/SharedCore/Services/ApplicationSettingsService.cs
@@ -26,6 +26,7 @@ public class GamePathPair
public bool IsFirstTimeStartingApplication { get; set; } = true;
public bool IsDeveloperRun { get; set; } = false;
public string WwisePath { get; set; }
+ public bool OnlyLoadLod0ForReferenceMeshes { get; set; } = true;
public ApplicationSettings()
{