Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions AssetEditor.sln
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Editors.CampaignAnimationSe
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test.CampaignAnimationSetEditor", "Editors\CampaignAnimationSetEditor\Test.CampaignAnimationSetEditor\Test.CampaignAnimationSetEditor.csproj", "{32582784-3E26-44C1-9375-ECE044B4CB4A}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "VfxEditor", "VfxEditor", "{3336CE67-41D1-75E0-AFD7-87A71F549C7C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Editors.VfxEditor", "Editors\VfxEditor\Editors.VfxEditor\Editors.VfxEditor.csproj", "{082015CD-EAD9-4C33-B3A1-B241F05FA778}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test.VfxEditor", "Editors\VfxEditor\Test.VfxEditor\Test.VfxEditor.csproj", "{7C67E9EC-4878-46E8-859E-5A80CFA8FFC7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -692,6 +698,30 @@ Global
{32582784-3E26-44C1-9375-ECE044B4CB4A}.Release|x64.Build.0 = Release|Any CPU
{32582784-3E26-44C1-9375-ECE044B4CB4A}.Release|x86.ActiveCfg = Release|Any CPU
{32582784-3E26-44C1-9375-ECE044B4CB4A}.Release|x86.Build.0 = Release|Any CPU
{082015CD-EAD9-4C33-B3A1-B241F05FA778}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{082015CD-EAD9-4C33-B3A1-B241F05FA778}.Debug|Any CPU.Build.0 = Debug|Any CPU
{082015CD-EAD9-4C33-B3A1-B241F05FA778}.Debug|x64.ActiveCfg = Debug|Any CPU
{082015CD-EAD9-4C33-B3A1-B241F05FA778}.Debug|x64.Build.0 = Debug|Any CPU
{082015CD-EAD9-4C33-B3A1-B241F05FA778}.Debug|x86.ActiveCfg = Debug|Any CPU
{082015CD-EAD9-4C33-B3A1-B241F05FA778}.Debug|x86.Build.0 = Debug|Any CPU
{082015CD-EAD9-4C33-B3A1-B241F05FA778}.Release|Any CPU.ActiveCfg = Release|Any CPU
{082015CD-EAD9-4C33-B3A1-B241F05FA778}.Release|Any CPU.Build.0 = Release|Any CPU
{082015CD-EAD9-4C33-B3A1-B241F05FA778}.Release|x64.ActiveCfg = Release|Any CPU
{082015CD-EAD9-4C33-B3A1-B241F05FA778}.Release|x64.Build.0 = Release|Any CPU
{082015CD-EAD9-4C33-B3A1-B241F05FA778}.Release|x86.ActiveCfg = Release|Any CPU
{082015CD-EAD9-4C33-B3A1-B241F05FA778}.Release|x86.Build.0 = Release|Any CPU
{7C67E9EC-4878-46E8-859E-5A80CFA8FFC7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7C67E9EC-4878-46E8-859E-5A80CFA8FFC7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7C67E9EC-4878-46E8-859E-5A80CFA8FFC7}.Debug|x64.ActiveCfg = Debug|Any CPU
{7C67E9EC-4878-46E8-859E-5A80CFA8FFC7}.Debug|x64.Build.0 = Debug|Any CPU
{7C67E9EC-4878-46E8-859E-5A80CFA8FFC7}.Debug|x86.ActiveCfg = Debug|Any CPU
{7C67E9EC-4878-46E8-859E-5A80CFA8FFC7}.Debug|x86.Build.0 = Debug|Any CPU
{7C67E9EC-4878-46E8-859E-5A80CFA8FFC7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7C67E9EC-4878-46E8-859E-5A80CFA8FFC7}.Release|Any CPU.Build.0 = Release|Any CPU
{7C67E9EC-4878-46E8-859E-5A80CFA8FFC7}.Release|x64.ActiveCfg = Release|Any CPU
{7C67E9EC-4878-46E8-859E-5A80CFA8FFC7}.Release|x64.Build.0 = Release|Any CPU
{7C67E9EC-4878-46E8-859E-5A80CFA8FFC7}.Release|x86.ActiveCfg = Release|Any CPU
{7C67E9EC-4878-46E8-859E-5A80CFA8FFC7}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -758,6 +788,9 @@ Global
{AA14F125-E7D2-8CBC-FC94-A1A6F78D9FAF} = {07AC615B-A8FC-4E1A-BDD5-BC11452429A0}
{417FAB39-3269-4D1C-981B-DD9965E1B26C} = {AA14F125-E7D2-8CBC-FC94-A1A6F78D9FAF}
{32582784-3E26-44C1-9375-ECE044B4CB4A} = {AA14F125-E7D2-8CBC-FC94-A1A6F78D9FAF}
{3336CE67-41D1-75E0-AFD7-87A71F549C7C} = {07AC615B-A8FC-4E1A-BDD5-BC11452429A0}
{082015CD-EAD9-4C33-B3A1-B241F05FA778} = {3336CE67-41D1-75E0-AFD7-87A71F549C7C}
{7C67E9EC-4878-46E8-859E-5A80CFA8FFC7} = {3336CE67-41D1-75E0-AFD7-87A71F549C7C}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {AB5968F3-98ED-4AFF-98EA-0DBEDCACADF2}
Expand Down
1 change: 1 addition & 0 deletions AssetEditor/AssetEditor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<ProjectReference Include="..\Editors\TwuiEditor\Editor.Twui\Editors.Twui.csproj" />
<ProjectReference Include="..\Editors\BmdEditor\Editors.BmdEditor.csproj" />
<ProjectReference Include="..\Editors\CscEditor\Editors.CscEditor\Editors.CscEditor.csproj" />
<ProjectReference Include="..\Editors\VfxEditor\Editors.VfxEditor\Editors.VfxEditor.csproj" />
<ProjectReference Include="..\Editors\CampaignAnimationSetEditor\Editors.CampaignAnimationSetEditor\Editors.CampaignAnimationSetEditor.csproj" />
<ProjectReference Include="..\GameWorld\GameWorldCore\GameWorld.Core\GameWorld.Core.csproj" />
<ProjectReference Include="..\Shared\EmbeddedResources\Shared.EmbeddedResources.csproj" />
Expand Down
3 changes: 3 additions & 0 deletions AssetEditor/Language_Cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,9 @@
"TextureEditor.Labels.NumMipMaps": "MipMap 数量",

"MetadataEditor.Buttons.Refresh": "刷新",
"SuperView.ShowVfx": "显示特效",
"SuperView.VfxFilter": "特效过滤:",
"SuperView.VfxFilter.Tooltip": "单位在 battle_entities 中的 vfx_filter_id。特效标签的 id 若不是 0 也不是此值,就不会在该单位上播放:单位和它的传奇军团常共用一个元数据文件,分别用 id 1 和 id 2。",
"MetadataEditor.Buttons.New": "新建",
"MetadataEditor.Buttons.Delete": "删除",
"MetadataEditor.Buttons.Up": "上移",
Expand Down
3 changes: 3 additions & 0 deletions AssetEditor/Language_En.json
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,9 @@
"TextureEditor.Labels.NumMipMaps": "Num MipMaps",

"MetadataEditor.Buttons.Refresh": "Refresh",
"SuperView.ShowVfx": "Show VFX",
"SuperView.VfxFilter": "VFX filter:",
"SuperView.VfxFilter.Tooltip": "The unit's vfx_filter_id in battle_entities. An effect tag whose id is neither 0 nor this does not play on it: a unit and its Regiment of Renown often share one meta, with id 1 and id 2.",
"MetadataEditor.Buttons.New": "New",
"MetadataEditor.Buttons.Delete": "Delete",
"MetadataEditor.Buttons.Up": "Up",
Expand Down
3 changes: 3 additions & 0 deletions AssetEditor/Language_Fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,9 @@
"TextureEditor.Labels.Height": "Height",
"TextureEditor.Labels.NumMipMaps": "Num MipMaps",
"MetadataEditor.Buttons.Refresh": "Refresh",
"SuperView.ShowVfx": "Afficher les VFX",
"SuperView.VfxFilter": "Filtre VFX :",
"SuperView.VfxFilter.Tooltip": "Le vfx_filter_id de l'unité dans battle_entities. Une balise d'effet dont l'id n'est ni 0 ni celui-ci n'est pas jouée sur elle : une unité et son régiment de renom partagent souvent un même méta, avec les id 1 et 2.",
"MetadataEditor.Buttons.New": "New",
"MetadataEditor.Buttons.Delete": "Delete",
"MetadataEditor.Buttons.Up": "Up",
Expand Down
1 change: 1 addition & 0 deletions AssetEditor/Services/DependencyInjectionConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public DependencyInjectionConfig(bool loadResources = true)
new Editors.Ipc.DependencyInjectionContainer(),
new Editors.BmdEditor.DependencyInjectionContainer(),
new Editors.CscEditor.DependencyInjectionContainer(),
new Editors.VfxEditor.DependencyInjectionContainer(),
new Editors.CampaignAnimationSetEditor.DependencyInjectionContainer(),

// Host application
Expand Down
2 changes: 2 additions & 0 deletions AssetEditor/Themes/Controls.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3879,6 +3879,8 @@
<Style x:Key="{x:Static ToolBar.ToggleButtonStyleKey}" TargetType="{x:Type ToggleButton}" BasedOn="{StaticResource {x:Type ToggleButton}}"/>
<Style x:Key="{x:Static ToolBar.CheckBoxStyleKey}" TargetType="{x:Type CheckBox}" BasedOn="{StaticResource {x:Type CheckBox}}"/>
<Style x:Key="{x:Static ToolBar.RadioButtonStyleKey}" TargetType="{x:Type RadioButton}" BasedOn="{StaticResource {x:Type RadioButton}}"/>
<Style x:Key="{x:Static ToolBar.ComboBoxStyleKey}" TargetType="{x:Type ComboBox}" BasedOn="{StaticResource {x:Type ComboBox}}"/>
<Style x:Key="{x:Static ToolBar.TextBoxStyleKey}" TargetType="{x:Type TextBox}" BasedOn="{StaticResource {x:Type TextBox}}"/>

<Style TargetType="{x:Type ToolBarTray}">
<Setter Property="Background" Value="{DynamicResource ToolBarTrayBackground}"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
using System.IO;
using Editors.AnimationMeta.SuperView;
using Editors.AnimationMeta.SuperView.Visualisation;
using Editors.Shared.Core.Common.BaseControl;
using Microsoft.Extensions.DependencyInjection;
using Shared.Core.PackFiles;
using Shared.Core.PackFiles.Models;
using Shared.Core.PackFiles.Utility;
using Shared.Core.ToolCreation;
using Shared.GameFormats.AnimationPack;
using Test.TestingUtility.Shared;
using Test.TestingUtility.TestUtility;

namespace Test.AnimationMeta
{
public class SuperViewVfxRebuildTests
{
AssetEditorTestRunner _runner = null!;
SuperViewViewModel _superView = null!;

[SetUp]
public void Setup()
{
_runner = new AssetEditorTestRunner();
_runner.CreateCaContainer();
_runner.LoadPackFile(PathHelper.GetDataFile("Throt.pack"), true);

_superView = (SuperViewViewModel)_runner.ServiceProvider.GetRequiredService<IEditorManager>().Create(EditorEnums.SuperView_Editor)!;
_superView.Load(new AnimationToolInput
{
Mesh = _runner.PackFileService.FindFile(@"variantmeshes\variantmeshdefinitions\skv_throt.variantmeshdefinition")!,
FragmentName = @"animations/database/battle/bin/hu17_dlc16_throt.bin",
AnimationSlot = DefaultAnimationSlotTypeHelper.GetfromValue("ATTACK_5"),
});
}

// A vfx file added or saved in any pack (the VFX editor's save, a replaced texture) rebuilds the scene's effects, so
// SuperView shows it without the tab being reopened, and so does a model, material or animation a rigid particle may
// draw, wherever it lives; any other file leaves the scene alone.
[TestCase(@"vfx\test_smoke.xml", true)]
[TestCase(@"variantmeshes\wh_variantmodels\x\x.rigid_model_v2", true)]
[TestCase(@"variantmeshes\wh_variantmodels\x\x.wsmodel", true)]
[TestCase(@"variantmeshes\wh_variantmodels\x\x.xml.material", true)]
[TestCase(@"animations\battle\x\x.anim", true)]
[TestCase(@"text\notes.txt", false)]
public void AChangedVfxFile_RebuildsTheScene(string path, bool rebuilds)
{
var data = _superView.SceneObjects[0].Data;
var pack = _runner.CreateOutputPack();

var before = data.MetaDataItems;
_runner.PackFileService.AddFilesToPack(pack, [new NewPackFileEntry(Path.GetDirectoryName(path)!, PackFile.CreateFromBytes(Path.GetFileName(path), [1]))]);
Assert.That(data.MetaDataItems, rebuilds ? Is.Not.SameAs(before) : Is.SameAs(before), "on add");

before = data.MetaDataItems;
_runner.PackFileService.SaveFile(_runner.PackFileService.FindFile(path, pack)!, [2]);
Assert.That(data.MetaDataItems, rebuilds ? Is.Not.SameAs(before) : Is.SameAs(before), "on save");
}

// ...and builds every tag again from what the packs now hold, rather than keeping what it built from the old files.
[Test]
public void AChangedVfxFile_BuildsEveryTagAgain()
{
var data = _superView.SceneObjects[0].Data;
var before = data.MetaDataItems.ToList();
Assert.That(before, Is.Not.Empty);
_runner.PackFileService.AddFilesToPack(_runner.CreateOutputPack(), [new NewPackFileEntry("vfx", PackFile.CreateFromBytes("test_smoke.xml", [1]))]);
Assert.That(data.MetaDataItems.Intersect(before), Is.Empty);
}

[Test]
public void TheShowVfxBox_ReachesTheBuilder()
{
var builder = _runner.GetRequiredServiceInCurrentEditorScope<IMetaDataBuilder>();
_superView.ShowVfx = false;
Assert.That(builder.ShowVfx, Is.False);
_superView.ShowVfx = true;
Assert.That(builder.ShowVfx, Is.True);
}
}
}
Loading