diff --git a/.gitignore b/.gitignore index ee2f449..4593989 100644 --- a/.gitignore +++ b/.gitignore @@ -12,7 +12,8 @@ build # misc .DS_Store *.pem -test/ +test/data/* +!test/data/*.md *.log # Rust build cache diff --git a/dar2oar_core/benches/convert_n_thread.rs b/dar2oar_core/benches/convert_n_thread.rs index 35ec953..533dff8 100644 --- a/dar2oar_core/benches/convert_n_thread.rs +++ b/dar2oar_core/benches/convert_n_thread.rs @@ -7,7 +7,7 @@ use tokio::fs; const REMOVE_TARGET: &str = "../test/data/UNDERDOG Animations/meshes/actors/character/animations/OpenAnimationReplacer"; const TARGET: &str = "../test/data/UNDERDOG Animations"; -const TABLE_PATH: &str = "../test/settings/UnderDog Animations_v1.9.6_mapping_table.txt"; +const TABLE_PATH: &str = "../test/mapping_tables/UnderDog Animations_v1.9.6_mapping_table.txt"; fn criterion_benchmark(c: &mut Criterion) { let mut group = c.benchmark_group("dar2oar sequential vs parallel"); diff --git a/dar2oar_core/src/fs/converter/mod.rs b/dar2oar_core/src/fs/converter/mod.rs index 1aff8ae..edc15f2 100644 --- a/dar2oar_core/src/fs/converter/mod.rs +++ b/dar2oar_core/src/fs/converter/mod.rs @@ -116,7 +116,7 @@ mod test { use anyhow::Result; const DAR_DIR: &str = "../test/data/UNDERDOG Animations"; - const TABLE_PATH: &str = "../test/settings/UnderDog Animations_v1.9.6_mapping_table.txt"; + const TABLE_PATH: &str = "../test/mapping_tables/UnderDog Animations_v1.9.6_mapping_table.txt"; async fn create_options() -> Result { Ok(ConvertOptions { diff --git a/frontend/src/components/buttons/index.ts b/frontend/src/components/buttons/index.ts index f8d789c..1db4241 100644 --- a/frontend/src/components/buttons/index.ts +++ b/frontend/src/components/buttons/index.ts @@ -1,7 +1,7 @@ // @index('./*', f => `export * from '${f.path}'`) export * from './convert_btn'; -export * from './log_file_btn'; export * from './log_dir_btn'; +export * from './log_file_btn'; export * from './path_selector'; export * from './remove_oar_btn'; export * from './unhide_dar_btn'; diff --git a/frontend/src/components/lists/translation_list.tsx b/frontend/src/components/lists/translation_list.tsx index c6e9c77..22d571a 100644 --- a/frontend/src/components/lists/translation_list.tsx +++ b/frontend/src/components/lists/translation_list.tsx @@ -30,6 +30,7 @@ export const TranslationList = () => { Auto English(US) Japanese + Custom diff --git a/frontend/src/hooks/dyn_style.ts b/frontend/src/hooks/dyn_style.ts index e07df71..5f1fe9c 100644 --- a/frontend/src/hooks/dyn_style.ts +++ b/frontend/src/hooks/dyn_style.ts @@ -45,7 +45,8 @@ export function useInjectScript(initialState = (() => localStorage.getItem('cust const scriptElement = document.createElement('script'); if (pathname !== window.location.pathname) { try { - scriptElement.innerText = script; + // comment remove script + scriptElement.innerHTML = script; scriptElement.id = 'custom-script'; if (!document.getElementById('custom-script')) { document.body.appendChild(scriptElement); diff --git a/frontend/src/utils/translation.ts b/frontend/src/utils/translation.ts index ddb862f..34917e6 100644 --- a/frontend/src/utils/translation.ts +++ b/frontend/src/utils/translation.ts @@ -1,10 +1,19 @@ 'use client'; import { use, type Resource } from 'i18next'; +import { toast } from 'react-hot-toast'; import { initReactI18next } from 'react-i18next'; import dictEnUS from '@/../../locales/en-US.json'; import dictJaJP from '@/../../locales/ja-JP.json'; +function getCustomTranslationDict() { + try { + return JSON.parse(localStorage.getItem('custom-translation-dict') ?? '{}'); + } catch (error) { + toast.error(`${error}`); + } +} + // The keys in RESOURCE are language tags according to the BCP-47 standard. // See: https://partnerhub.warnermediagroup.com/metadata/languages const resources = { @@ -14,7 +23,9 @@ const resources = { 'ja-JP': { translation: dictJaJP, }, + custom: { translation: getCustomTranslationDict() }, } as const satisfies Resource; + export type I18nKeys = keyof (typeof resources)['en-US']['translation']; use(initReactI18next) // passes i18n down to react-i18next diff --git a/test/data/download-mods.ps1.md b/test/data/download-mods.ps1.md new file mode 100644 index 0000000..3f4b9b9 --- /dev/null +++ b/test/data/download-mods.ps1.md @@ -0,0 +1,29 @@ +# Setup test mods + +At this time, automatic installation is not possible and must be downloaded +manually. + +```powershell +<# function Get-Mod([string]$dist, [string]$url) { + Invoke-WebRequest $url -OutFile "$dist.zip" + + 7zip "$dist.zip" -DestinationPath $dist + # Remove-Item "$dist.zip" +} #> + +@( + @( + $dist = 'Animated Armoury DAR Modified Conditions' + $url = 'https://www.nexusmods.com/skyrimspecialedition/mods/74320?tab=files&file_id=395456' + ), + @( + $dist = 'Modern Female Sitting Animations Overhaul' + $url = 'https://www.nexusmods.com/skyrimspecialedition/mods/85599?tab=files&file_id=444438' + ), + @( + $dist = 'UNDERDOG - Animations' + $url = 'https://www.nexusmods.com/skyrimspecialedition/mods/51811?tab=files&file_id=461119' + ) +) +# Get-Mod $dist $url +``` diff --git a/test/generators/generate-from-dirname.ps1 b/test/generators/generate-from-dirname.ps1 new file mode 100644 index 0000000..45403b4 --- /dev/null +++ b/test/generators/generate-from-dirname.ps1 @@ -0,0 +1,39 @@ +<# +How to use? +Execute this powershell file by double-clicking it in the root of the mod (where mesh, etc. are located). + +PowerShell files written on someone else's PC may be blocked for security reasons. +In that case, you can create a new file by yourself and copy the contents of this file. +#> + +$target = "." # target dir(. == current dir) +$mappingFile = "mapping_table.txt" + +# Search for the path containing the "_CustomConditions" directory +$dirPath = $(Get-ChildItem -Path $target -Directory -Recurse -Filter "_CustomConditions").FullName + +# Get the list of directories +$directories = Get-ChildItem -Path $dirPath -Directory | Sort-Object Name + +# Define a regular expression pattern to extract the desired information +$pattern = '(\d+)\s*-\s*(.+)' + +# Initialize an array to store the results +$results = @() + +# Process each directory +foreach ($directory in $directories) { + $name = $directory.Name + if ($name -match $pattern) { + $number = $matches[1] + $name = $matches[2] + $results += "$number $name" + } else { + $results += $directory.Name + } +} + +# Write the results to the mapping_table.txt file in UTF-8 encoding +$results | Out-File -FilePath $mappingFile -Encoding utf8 + +Write-Host "Mapping table has been written to $mappingFile" diff --git a/test/generators/generate_table_from_txt.ps1 b/test/generators/generate_table_from_txt.ps1 new file mode 100644 index 0000000..d6ea17d --- /dev/null +++ b/test/generators/generate_table_from_txt.ps1 @@ -0,0 +1,39 @@ +<# +- How to use? +Execute this powershell file by double-clicking it in the root of the mod (where mesh, etc. are located). + +PowerShell files written on someone else's PC may be blocked for security reasons. +In that case, you can create a new file by yourself and copy the contents of this file. + +- When use powershell command +powershell.exe -ExecutionPolicy Bypass -File "./generate_table_from_txt.ps1" +#> + +$target = "." # target dir(. == current dir) +$mappingFile = "mapping_table.txt" +$renameFrom = "\s*\d+\s*" # Regexp +$renameTo = "" + +# Search for the path containing the "_CustomConditions" directory +$dirPath = $(Get-ChildItem -Path $target -Directory -Recurse -Filter "_CustomConditions").FullName + +# Get the list of directories +$directories = Get-ChildItem -Path $dirPath -Recurse -Filter '*.txt' | Sort-Object Name + +# Initialize an array to store the results +$results = @() +foreach ($dir in $directories) +{ + $number = Split-Path $dir -Parent | Split-Path -Leaf # Get DAR priority dirname + if ($dir.Name -match '\s*\d+\s*') + { + $name = $dir.BaseName -replace $renameFrom, $renameTo + $results += "$number $name" + } +} + +# Write the results to the mapping_table.txt file in UTF-8 encoding +$results | Out-File -FilePath $mappingFile -Encoding utf8 + +Write-Host $results +Write-Host "Mapping table has been written to $mappingFile" diff --git a/test/generators/generate_table_from_txt2.ps1 b/test/generators/generate_table_from_txt2.ps1 new file mode 100644 index 0000000..ef2f9fc --- /dev/null +++ b/test/generators/generate_table_from_txt2.ps1 @@ -0,0 +1,36 @@ +<# +How to use? +Execute this powershell file by double-clicking it in the root of the mod (where mesh, etc. are located). + +PowerShell files written on someone else's PC may be blocked for security reasons. +In that case, you can create a new file by yourself and copy the contents of this file. +#> + +$target = "." # target dir(. == current dir) +$mappingFile = "mapping_table.txt" +$renameFrom = "" # Regexp +$renameTo = "" + +# Search for the path containing the "_CustomConditions" directory +$dirPath = $(Get-ChildItem -Path $target -Directory -Recurse -Filter "_CustomConditions").FullName + +# Get the list of directories +$directories = Get-ChildItem -Path $dirPath -Recurse -Filter '*.txt' | Sort-Object Name + +# Initialize an array to store the results +$results = @() +foreach ($dir in $directories) +{ + $number = Split-Path $dir -Parent | Split-Path -Leaf # Get DAR priority dirname + if ($dir.Name -ne '_condition.txt') + { + $name = $dir.BaseName -replace $renameFrom, $renameTo + $results += "$number $name" + } +} + +# Write the results to the mapping_table.txt file in UTF-8 encoding +$results | Out-File -FilePath $mappingFile -Encoding utf8 + +Write-Host $results +Write-Host "Mapping table has been written to $mappingFile" diff --git a/test/mapping_tables/Animated Armoury DAR Modified Conditions_v2.3.2.d_mapping_table.txt b/test/mapping_tables/Animated Armoury DAR Modified Conditions_v2.3.2.d_mapping_table.txt new file mode 100644 index 0000000..d97d0b3 --- /dev/null +++ b/test/mapping_tables/Animated Armoury DAR Modified Conditions_v2.3.2.d_mapping_table.txt @@ -0,0 +1,20 @@ +10 Rapier +11 Pikes +12 Halberds +13 QuarterStaffs +14 Claw-in-Right-hand +15 Cestus +18 Whips +19 Katana-with-Something-in-Left-hand +29 Claw-in-Left-hand +30 Claws-in-both-hands +31 Whip-in-Left-hand +32 Whip-in-both-hands-left-hand +42 QuarterStaffs +43 Maces +44 Daggers-in-Right-Hand +45 Katana-with-Nothing-in-Left-hand +46 Claws-in-both-hands +47 Whip-in-Left-hand +48 Pikes +49 Halberds diff --git a/test/mapping_tables/Animated Armoury DAR Modified Conditions_v2.3.2.d_mapping_table_1stperson.txt b/test/mapping_tables/Animated Armoury DAR Modified Conditions_v2.3.2.d_mapping_table_1stperson.txt new file mode 100644 index 0000000..a9fabfe --- /dev/null +++ b/test/mapping_tables/Animated Armoury DAR Modified Conditions_v2.3.2.d_mapping_table_1stperson.txt @@ -0,0 +1,12 @@ +10 Rapier +11 Pikes +12 Halberds +13 QuarterStaffs +14 Claw +15 Cestus +18 Whips +19 Katanas + +29 Claw-in-Left-hand +30 Claws-in-both-hands +31 Whip-in-Left-hand diff --git a/test/mapping_tables/EVG Conditional Idles_v1.4.2_mapping_table.txt b/test/mapping_tables/EVG Conditional Idles_v1.4.2_mapping_table.txt new file mode 100644 index 0000000..ae910b5 --- /dev/null +++ b/test/mapping_tables/EVG Conditional Idles_v1.4.2_mapping_table.txt @@ -0,0 +1,49 @@ +// This file is generated by the following powershell script +// ```PowerShell +// # Search for the path containing the "_CustomConditions" directory +// $dirPath = $(Get-ChildItem -Path "." -Directory -Recurse -Filter "_CustomConditions").FullName +// $mappingFile = "mapping_table.txt" +// $renameFrom = "" # Regexp +// $renameTo = "" +// +// # Get the list of directories +// $directories = Get-ChildItem -Path $dirPath -Recurse -Filter '*.txt' | Sort-Object Name +// +// # Initialize an array to store the results +// $results = @() +// foreach ($dir in $directories) +// { +// $number = Split-Path $dir -Parent | Split-Path -Leaf # Get DAR priority dirname +// if ($dir.Name -ne '_conditions.txt') +// { +// $name = $dir.BaseName -replace $renameFrom, $renameTo +// $results += "$number $name" +// } +// } +// +// # Write the results to the mapping_table.txt file in UTF-8 encoding +// $results | Out-File -FilePath $mappingFile -Encoding utf8 +// +// Write-Host $results +// Write-Host "Mapping table has been written to $mappingFile" +// ``` + +6002125 Cold Player +6002102 Female Modesty Player +6002121 Headache Alt 50 Percent Player +6002120 Headache Player +6002135 Injured Player +6002101 Male Modesty Player +6001925 NPC cold +6001902 NPC Female Modesty +6001921 NPC Headache 50 Alt +6001920 NPC Headache w Fist +6001935 NPC Injured +6001901 NPC Male Modesty +6001910 NPC Shield Cover +6001908 NPC Stamina Stage 1 at 50 +6001926 NPC Stamina Stage 2 at 25 +6002110 Shield Cover Player +6002108 Stamina Stage 1 at 50 Player +6002126 Stamina Stage 2 at 25 Player +6002090 Stretch 2 Percent diff --git a/test/mapping_tables/Smooth Moveset_v3.3_mapping_table.txt b/test/mapping_tables/Smooth Moveset_v3.3_mapping_table.txt new file mode 100644 index 0000000..99b7f3d --- /dev/null +++ b/test/mapping_tables/Smooth Moveset_v3.3_mapping_table.txt @@ -0,0 +1,172 @@ +8000000 Combat +8000001 +8000001 Base +8000005 +8000005 Female +8001000 +8001000 Unarmed +8001010 +8001010 Sword +8001020 +8001020 Sword+Shield +8001040 +8001040 Spear+Shield +8001041 +8001050 +8001050 Rapier +8001055 +8001055 Rapier+shield +8001060 +8001060 Katana Male +8001065 +8001065 Katana Female +8002000 +8002000 Dagger +8002005 +8002005 Dagger+Shield +8002010 +8002010 Claw +8002020 +8002020 Claw+shield +8003000 +8003000 Axe +8003010 +8003010 Axe+Shield +8004000 +8004000 Mace +8004010 +8004010 Mace+Shield +8004100 +8004100 Javelin +8004200 +8004200 Javelin+Shield +8004300 +8004300 LargeShield +8005000 +8005000 2hm Sword +8005010 +8005010 2hm Katana +8005030 +8005030 Giant Sword +8006000 +8006000 Hammer, Axe +8006020 +8006020 Halberd +8006030 +8006030 Pike +8006040 +8006045 +8006045 Scythe +8006050 +8006050 QuarterStaff +8007004 Bow +8011000 +8011000 Dual Sword +8012000 +8012000 Dual Dagger +8012010 +8012010 Dual Claw +8013000 +8013003 +8013004 +8013004 Dual Axe, Mace +8056030 +8100000 Non Combat +8100001 +8100001 Base +8101000 +8101000 Unarmed +8101010 +8101011 +8101019 Sword +8101020 +8101021 +8101029 Sword+Shield +8102000 +8102001 +8102004 Dagger +8102005 +8102005 Dagger+Shield +8102010 +8102010 Claw +8102020 +8102020 Claw+shield +8103000 +8103000 Axe +8103010 +8103010 Axe+Shield +8104000 +8104000 Mace +8104010 +8104010 Mace+Shield +8104300 +8104300 LargeShield +8104400 +8104400 1hm + gun +8105000 +8105000 2hm Sword, Katana +8105030 +8105030 Giant Sword +8106000 +8106020 Hammer, Axe, Halberd +8106030 +8106030 Pike, Javelin +8106040 +8106045 Scythe +8106050 +8106050 QuarterStaff +8107000 +8107004 Bow +8111000 +8111000 Dual Sword +8112000 +8112000 Dual Dagger +8112010 +8112010 Dual Claw +8113000 +8113000 Dual Axe, Mace +8114000 +8114000 Pike, Scythe, Javelin move +8201010 +8201011 +8201019 Sword +8201020 +8201021 +8201029 Sword+Shield +8201040 +8201040 Spear +8201050 +8201050 Rapier +8201060 +8201060 1hm Katana +8204100 +8204100 Javelin +8204200 +8204200 Javelin+Shield +8204300 +8204300 LargeShield +8204400 +8204400 1hm + gun +8205000 +8205000 2hm Sword, Katana +8205030 +8205030 Giant Sword +8206000 +8206000 Axe, Hammer +8206020 +8206020 Halberd +8206030 +8206030 Pike +8206040 +8206040 Scythe +8206050 +8206050 QuarterStaff +8207000 Bow +8211000 +8211000 Dual Sword +8212000 +8212000 Dual Dagger +8212010 +8212010 Dual Claw +8213000 +8213000 Dual Axe, Mace diff --git a/test/mapping_tables/UnderDog Animations_v1.9.6_mapping_table.txt b/test/mapping_tables/UnderDog Animations_v1.9.6_mapping_table.txt new file mode 100644 index 0000000..96b9529 --- /dev/null +++ b/test/mapping_tables/UnderDog Animations_v1.9.6_mapping_table.txt @@ -0,0 +1,85 @@ +2000000026 ConfidentWalk +2000000007 CrouchIdleLookingAround +2000000008 CrouchIdleLookingOver +2000000043 Death Animations DeathAnimations +2000000044 DefaultDeath +2000000050 Dying (4) +2000000063 Dying(4) +90046070 exterior stool override +2000000034 Falling Falling +2000000024 FasterSprintStamina150 +2000000011 FastRunSpeed +2000000083 FlipKickJump +2000000068 Flying Back Death +2000000081 FlyingKick +2000000062 InCombatNoWeaponsFrwDeath +2000000018 Injured Idles InjuredIdles +2000000080 InjuredJump +2000000031 InjuredLegMedium60 +2000000032 InjuredLegMedium60Random +2000000030 InjuredLegMinor80 +2000000021 InjuredLegSevere +2000000033 InjuredLegSevere40 +2000000028 Injured Movement InjuredMovement +2000000019 InjuredStandard +2000000020 InjuredStumble +2000000082 InsideCrescentKick +2000000078 Jump Jump +2000000016 LowCrawlNotWpnDrawn +2000000017 LowCrawlWpnDrawn +2000000012 MediumRunSneak +2000000029 MinorInjuredHand +2000000022 Movement Movement +2000000038 NinjaIdle +2000000039 NinjaIdleLookingAround +2000000037 NINJA Idles NinjaIdles +2000000040 NinjaIdleStretch +2000000041 NINJA Movement NinjaSprint +2000000042 NinjaSprintForward +2000000023 NormalRunWalkSprint +2000000014 SlowWalkSneak +2000000000 sneak right att intro VANILA ANIMATION +2000000002 Sneak right att var1 +2000000001 Sneak right att var2 +2000000003 Sneak right att var3 +2000000004 Sneak right power att +1999999999 Sneak attacks SneakAttacks +2000000005 Sneak Idles SneakIdles +2000000010 Sneak Movement SneakMovement +2000000013 SneakRunForBOW +2000000015 SneakWalkForBOW VANILLA ANIMATIONS +2000000027 SneakyWalkSneak50 +2000000052 Standing Death Backward 01 +2000000053 Standing Death Backward 02 +2000000055 Standing Death Forward 01 +2000000056 Standing Death Forward 02 +2000000061 Standing Death Left 01 +2000000054 Standing Death Left 02 +2000000051 Standing Death Right 01 +2000000050 Standing Death Right 02 +2000000060 Standing React Death Backward +2000000057 Standing React Death Forward +2000000059 Standing React Death Left +2000000058 Standing React Death Right +2000000070 StandingTorchIdle 01 +2000000071 StandingTorchIdle 02 +2000000072 StandingTorchIdle 03 +2000000073 StandingTorchIdle 04 +2000000077 StandingTorchInspectDownward +2000000075 StandingTorchInspectForward +2000000076 StandingTorchInspectUpward +2000000067 Sword And Shield Death (1) +2000000066 Sword And Shield Death +2000000025 Tired Run +2000000006 TorchIdles +2000000074 Torch Idles Indoors Only TorchIdlesIndoorsOnly +2000000069 Torch Idles Universal TorchIdlesUniversal +2000000065 Two Handed Sword Death +2000000009 UnarmedNinjaIdle +2000000048 UniversalStandingDeathBwrd +2000000047 UniversalStandingDeathFrw +2000000046 UniversalStandingDeathLeft +2000000045 UniversalStandingDeathNoCombat +2000000049 UniversalStandingDeathRight +2000000079 WaterDive +2000000064 Zombie Death diff --git a/test/mapping_tables/UnderDog Animations_v2.0.0_mapping_table.txt b/test/mapping_tables/UnderDog Animations_v2.0.0_mapping_table.txt new file mode 100644 index 0000000..c940b99 --- /dev/null +++ b/test/mapping_tables/UnderDog Animations_v2.0.0_mapping_table.txt @@ -0,0 +1,237 @@ +2000000456 Angry Female +2000000457 Angry Frown +2000000409 Bashful +2000000103 Battle Taunts NPC Battle Taunts NPC +2000000455 Being Cocky +2000000171 Belly Dance +2000000172 Bellydancing +2000000384 Big Body Blow +2000000254 Catwalk Walk Forward 02 Market Female +2000000252 Catwalk Walk Forward Wenches +2000000160 Cheer Male Hopping +2000000161 Cheer Rally +2000000155 Cheer Cheer +2000000158 Cheering Male +2000000192 Cheering While Sitting 2 +2000000191 Cheering While Sitting +2000000090 Combat Idle Combat Idle +2000000170 Dance Drunk Dance Drunk +2000000173 Dancing Unisex +2000000330 Death Animations Death Animations +2000000340 Death From Back Headshot +2000000342 Death From Front Headshot +2000000390 Death From Front Riffle Death +2000000343 Death From Left +2000000344 Death From Right +2000000339 Death From The Back +2000000341 Death From The Front +2000000391 Death Hit High +2000000458 Dismissing Gesture +2000000178 Drunk Idle Variation 1 +2000000179 Drunk Idle Variation 2 +2000000177 Drunk Idle +2000000358 Dying Backwards Faster Folded Hands +2000000359 Dying Backwards Slow Folded Hands +2000000360 Dying Front Both Knees Both hands face down +2000000361 Dying Front Walk Back Both Knees +2000000362 Dying Front Walk Both knees +2000000363 Dying Hanging a bit +2000000364 Dying Looking at wound +2000000357 Dying +2000000392 Electrocuted +2000000380 Fall Flat +2000000377 Falling Back Death +2000000378 Falling Forward Death +2000000071 Falling Idle +2000000072 Falling In Style +2000000070 Falling Falling +2000000078 FlipKickJump +2000000356 Flying Back Death +2000000076 FlyingKick +2000000414 Forsworn Ritual var 1 +2000000415 Forsworn Ritual var 2 +2000000385 Getting Hit Backwards +2000000450 Greet Greet +2000000468 Greeting Female 10 Drinking +2000000468 Greeting Female 10 Sitting Drinking +2000000468 Greeting Female 10 Sitting +2000000468 Greeting Female 10 +2000000469 Greeting Female 50 Drinking +2000000469 Greeting Female 50 +2000000470 Greeting Male 0 Drinking +2000000470 Greeting Male 0 Sitting Drinking +2000000470 Greeting Male 0 +2000000471 Greeting Male 2 Drinking +2000000471 Greeting Male 2 +2000000264 Happy Walk Child +2000000255 Happy Walking Bar Young +2000000365 Hit To Head +2000000368 Hit To Side Of Body Mirror +2000000367 Hit To Side Of Body +2000000366 Hit To The Legs +2000000461 I kill you Gesture +2000000098 I kill you Gesture +2000000111 I kill you Gesture +2000000400 Idles Idles +2000000423 Injured Idle Hurting Severe +2000000421 Injured Idle Standard Minor +2000000422 Injured Idle Stumble Medium +2000000272 Injured Jog Leg +2000000420 Injured Idles InjuredIdles +2000000075 InjuredJump +2000000273 InjuredLegMedium var +2000000272 InjuredLegMedium +2000000271 InjuredLegMinor +2000000274 InjuredLegSevere +2000000077 InsideCrescentKick +2000000387 Jump Away Mirror +2000000386 Jump Away +2000000073 Jump Jump +2000000379 Kick To The Groin +2000000373 Knocked Out Back Flail 100 +2000000375 Knocked Out Front Flail 0 Impact 50 +2000000374 Knocked Out Front Flail 100 Impact 100 +2000000376 Knocked Out Side Flail 50 Impact 20 +2000000270 MinorInjuredHand +2000000454 My Man Pointing Gesture +2000000174 Northern Soul Floor Combo +2000000175 Northern Soul Spin Combo +2000000411 OhYes 100 Dead Enemy +2000000410 OhYes 65 Dead enemy +2000000162 OhYes 65 +2000000260 Old Man Idle Grelod Calixto +2000000260 Old Man Walk Special +2000000253 Orc Idle Female +2000000253 Orc Idle Male +2000000416 Peeing +2000000462 Pointing Kids +2000000262 Run Forward Courier +2000000261 Running CICERO RUN +2000000263 Running Coward +2000000257 Sad Idle Main +2000000258 Sad Idle Var 1 +2000000257 Sad Walk Sad +2000000465 SaluteImperial +2000000464 SaluteSonsOfSkyrim +2000000417 Scratch Idle Dirty 0 +2000000419 Scratch Idle Dirty 100 +2000000418 Scratch Idle Dirty 50 +2000000381 Shoulder Hit And Fall +2000000205 Sit to Stand Scared 0 50 +2000000207 Sit to Stand Scared 100 50 front exit Faster +2000000207 Sit to Stand Scared 100 50 minimal +2000000206 Sit to Stand Scared 100 50 +2000000202 Sit to Stand Scared 50 0 front exit +2000000202 Sit to Stand Scared 50 0 minimal +2000000201 Sit to Stand Scared 50 0 +2000000204 Sit to Stand Scared 50 50 minimal +2000000203 Sit to Stand Scared 50 50 +2000000194 Sit to Standing Clap 2 +2000000193 Sit to Standing Clap +2000000180 Sit Sit +2000000196 Sitting Clap 1 +2000000197 Sitting Clap 2 +2000000198 Sitting Clap 3 +2000000199 Sitting Clap 4 +2000000200 Sitting Clap 5 +2000000195 Sitting Clap +2000000463 Sitting Dodges +2000000181 Sitting Elder +2000000184 Sitting Fidget 50 +2000000185 Sitting Fidget 80 +2000000188 Sitting Laughing 100 +2000000187 Sitting Laughing 50 +2000000182 Sitting Looking around +2000000183 Sitting Rubbing Arm +2000000186 Sitting Talking +2000000451 Sitting Thumbs Up 0 Left +2000000451 Sitting Thumbs Up 0 +2000000453 Sitting Thumbs Up 100 Left +2000000453 Sitting Thumbs Up 100 +2000000452 Sitting Thumbs Up 50 Left +2000000452 Sitting Thumbs Up 50 +2000000382 Slipping +2000000259 Slow Run Old People +2000000176 Snake Hip Hop Dance +2000000000 Sneak Idles SneakIdles +2000000261 SneakyWalkSneak50 CICERO +2000000370 Soccer Tackle Mirror +2000000372 Soccer Tackle Running Mirror +2000000371 Soccer Tackle Running +2000000369 Soccer Tackle +2000000250 Special Walks Runs Sprints Special Walks Runs Sprints +2000000331 Standing Death Backward 01 +2000000332 Standing Death Backward 02 +2000000333 Standing Death Forward 01 +2000000334 Standing Death Forward 02 +2000000335 Standing Death Left 01 +2000000336 Standing Death Left 02 +2000000337 Standing Death Right 01 +2000000338 Standing Death Right 02 +2000000463 Standing Dodges +2000000345 Standing React Death Backward +2000000346 Standing React Death Forward +2000000347 Standing React Death Left +2000000348 Standing React Death Right +2000000451 Standing Thumbs Up 0 Left Drinking +2000000451 Standing Thumbs Up 0 Left +2000000453 Standing Thumbs Up 100 Left Drinking +2000000453 Standing Thumbs Up 100 Left +2000000452 Standing Thumbs Up 50 Left Drinking +2000000452 Standing Thumbs Up 50 Left +2000000051 StandingTorchIdle 01 +2000000052 StandingTorchIdle 02 +2000000053 StandingTorchIdle 03 +2000000054 StandingTorchIdle 04 +2000000058 StandingTorchInspectDownward +2000000056 StandingTorchInspectForward +2000000057 StandingTorchInspectUpward +2000000388 Stunned +2000000251 Swagger Walk Var 1 Male +2000000251 Swagger Walk Var 2 Female +2000000383 Sweep Fall +2000000352 Sword And Shield Death var 2 +2000000351 Sword And Shield Death +2000000091 Taunt Battlecry +2000000104 Taunt Battlecry +2000000102 TauntBootySpank +2000000115 TauntBootySpank +2000000092 TauntChestPount +2000000105 TauntChestPount +2000000096 TauntClockBack +2000000109 TauntClockBack +2000000097 TauntClockFrwrd +2000000110 TauntClockFrwrd +2000000093 TauntComeOn +2000000106 TauntComeOn +2000000107 TauntFlexHigh +2000000094 TauntFlexHigh +2000000095 TauntFlexLow +2000000108 TauntFlexLow +2000000112 TauntInsult +2000000099 TauntInsult +2000000459 TauntInsult +2000000101 TauntLooser +2000000114 TauntLooser +2000000100 TauntThreatening +2000000113 TauntThreatening +2000000190 Telling A Secret Left Sitting +2000000413 Telling A Secret Left +2000000189 Telling A Secret Right Sitting +2000000412 Telling A Secret Right +2000000460 Threatening +2000000001 Torch Idles +2000000055 Torch Idles Indoors Only TorchIdlesIndoorsOnly +2000000050 Torch Idles Universal TorchIdlesUniversal +2000000350 Two Handed Sword Death var 2 +2000000349 Two Handed Sword Death +2000000259 Unarmed Walk Forward Old +2000000254 Walking Market Male +2000000253 Walking Orc Female +2000000253 Walking Orc Male +2000000256 Walking Strut +2000000074 WaterDive +2000000353 Zombie Death +2000000389 Zombie Forw Death +2000000355 Zombie Stumbling Mirror +2000000354 Zombie Stumbling diff --git a/test/sample_scripts/css/sample1.css b/test/sample_scripts/css/sample1.css new file mode 100644 index 0000000..5991e44 --- /dev/null +++ b/test/sample_scripts/css/sample1.css @@ -0,0 +1,72 @@ +:root { + --theme-color: rgb(185, 185, 90); + --hover-btn-color: #cefb518b; + --convert-btn-color: #94ce7c6e; + --hover-convert-btn-color: #81c462a3; + --image-url: url('https://images.pexels.com/photos/973324/pexels-photo-973324.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1'); +} + +body { + background-attachment: fixed; + background-image: var(--image-url); + background-repeat: no-repeat; + background-position-x: center; + background-position-y: center; + background-color: #000; +} + +main { + background-color: #2229; +} + +.ace_gutter, +.MuiOutlinedInput-root { + background-color: #2424248c !important; +} + +p.Mui-error { + color: var(--error-color); + background-color: #2f2e2eba; +} + +main:has(.ace_editor) > .MuiInputLabel-animated { + padding-right: 1rem !important; + padding-left: 1rem !important; + background-color: #2f2e2eba; +} + +a, +span.Mui-checked > svg, +.MuiInputBase-root.MuiOutlinedInput-root.MuiInputBase-colorPrimary.Mui-focused > fieldset, +.Mui-selected, /* Bottom Navigation */ +.MuiButton-outlined { + color: var(--theme-color) !important; + border-color: var(--theme-color); +} + +label.Mui-focused, +.MuiButton-root.MuiButton-text { + color: var(--theme-color) !important; +} + +.MuiButton-outlined { + background-color: #2424248c; +} + +.MuiButton-outlined:hover { + color: #fff !important; + background-color: var(--hover-btn-color); +} + +.MuiLoadingButton-root { + color: #fff; + background-color: var(--convert-btn-color); +} + +.MuiLoadingButton-root:hover { + background-color: var(--hover-convert-btn-color); +} + +.MuiLinearProgress-bar { + background-color: var(--theme-color); +} diff --git a/test/sample_scripts/custom_translation.js b/test/sample_scripts/custom_translation.js new file mode 100644 index 0000000..894ef69 --- /dev/null +++ b/test/sample_scripts/custom_translation.js @@ -0,0 +1,78 @@ +(() => { + // Origin: https://github.com/SARDONYX-sard/dar-to-oar/blob/main/locales/en-US.json + const i18n = { + 'all-clear-btn': '清除全部输入', + 'conversion-complete': '转换完成', + 'convert-btn': '转换', + 'convert-form-author-name': 'Mod作者名', + 'convert-form-author-name-helper': '[可选]', + 'convert-form-author-placeholder': '作者名', + 'convert-form-dar-helper': '[必填] 包含"DynamicAnimationReplacer"的目录', + 'convert-form-dar-helper2': '"C:\\[...]/Mod Name/" -> 转换第一人称和第三人称', + 'convert-form-dar-helper3': '"[...]/animations/DynamicAnimationReplacer" -> 仅转换第三人称', + 'convert-form-dar-label': 'DAR(src)目录', + 'convert-form-mapping-1st-label': '映射表路径(第一人称用)', + 'convert-form-mapping-helper': '[可选] 指定包含优先级和部分名称对应关系的文件', + 'convert-form-mapping-helper2': '帮助: ', + 'convert-form-mapping-help-link-name': '什么是映射文件?', + 'convert-form-mapping-label': '映射表路径', + 'convert-form-mod-name': 'Mod名称', + 'convert-form-mod-name-helper': '[可选] 推荐使用ASCII(英语)', + 'convert-form-oar-helper': '[可选] 指定OAR的输出位置(例如: "NewMod" -> "NewMod/meshes/[...])"', + 'convert-form-oar-helper2': '如果未指定,OAR将在DAR的同级目录创建。', + 'convert-form-oar-label': 'OAR(dist)目录', + 'converting-btn': '转换中...', + 'css-preset-list-item0': '自定义', + 'css-preset-list-item1': '预设1', + 'css-preset-list-item2': '预设2', + 'css-preset-list-item3': '预设3', + 'css-preset-list-label': '预设', + 'css-preset-list-tooltip': '选择CSS预设', + 'css-preset-list-tooltip2': '注意: 编辑"预设"将覆盖"自定义"', + 'custom-css-label': '当前应用的CSS', + 'custom-js-label': '自定义JavaScript(请勿运行不可信脚本)', + 'editor-mode-list-label': '编辑模式', + 'hide-dar-btn': '隐藏DAR', + 'hide-dar-btn-tooltip': '在转换后,将“.mohidden”添加到DAR的所有文件中,使其不可见(MO2用户专用)', + 'hide-dar-btn-tooltip2': '信息: 如果未指定OAR的输出位置,这特别方便。', + 'log-level-list-label': '日志级别', + 'log-level-list-tooltip': '轻微的日志级别包含更严重的日志级别。(Error ⊂ Info)', + 'log-level-list-tooltip2': 'Debug: 记录转换条件的中间数据', + 'log-level-list-tooltip3': ' Info: 记录转换时间', + 'log-level-list-tooltip4': 'Error: 仅记录严重错误', + 'mapping-wiki-url-leaf': 'wiki#what-is-the-mapping-file', + 'open-log-btn': '查看日志', + 'open-log-dir-btn': '日志(dir)', + 'open-log-tooltip': '打开当前日志文件。(每次启动应用都会轮换到新的日志文件)', + 'open-log-dir-tooltip': '打开日志存储位置。', + 'progress-btn': '进度条', + 'progress-btn-tooltip': '显示详细进度情况', + 'progress-btn-tooltip2': '', + 'remove-oar-btn': '删除OAR', + 'remove-oar-failed': '未找到"OpenAnimationReplacer"目录', + 'remove-oar-specify-error': '未输入DAR或OAR', + 'remove-oar-success': '已删除OAR目录', + 'remove-oar-tooltip': '从OAR(dist)(如果没有则从DAR(src))中搜索并删除OAR目录', + 'run-parallel-btn-tooltip': '使用多线程', + 'run-parallel-btn-tooltip2': + '注意: 可望获得2倍以上的处理速度,但由于并行处理,线程结束的顺序是无序的,日志写入也是无序的,可读性大幅下降。', + 'run-parallel-label': '并行执行', + 'select-btn': '选择', + 'unhide-dar-btn': 'DAR重新显示', + 'unhide-dar-btn-tooltip': '取消"隐藏DAR"使其重新显示(MO2用户专用)', + 'unhide-dar-failed': '未找到带有扩展名“.mohidden”的文件', + 'unhide-dar-specify-error': '请指定DAR(src)', + 'unhide-dar-success': '已取消DAR的隐藏', + }; + + const setCustomTranslation = () => localStorage.setItem('custom-translation-dict', JSON.stringify(i18n)); + const clearCustomTranslation = () => localStorage.removeItem('custom-translation-dict'); + + // You can turn them on and off by deleting the `//` in these functions. + // Perhaps you may have to reload the file twice to apply it. + // Key to reload: Ctrl + Shift + r + // Comment-out toggle key: Ctrl + / + // + // clearCustomTranslation(); + // setCustomTranslation(); +})(); diff --git a/test/sample_scripts/multi-mod-conversion.ps1 b/test/sample_scripts/multi-mod-conversion.ps1 new file mode 100644 index 0000000..4b4bfe2 --- /dev/null +++ b/test/sample_scripts/multi-mod-conversion.ps1 @@ -0,0 +1,35 @@ +<# + +Example dir status + +D:/Programming/rust/dar-to-oar + ├─── test + │ └─── data + │ ├─── Modern Female Sitting Animations Overhaul + │ └─── UNDERDOG Animations + └─── logs + +#> +# Convert target base directory +$base_dir = "D:/Programming/rust/dar-to-oar" + +# Create log dir if it doesn't exist. +if (!$(Test-Path "$base_dir/logs")) { + New-Item -ItemType Directory "$base_dir/logs" +} + +Get-ChildItem "$base_dir/test/data" | +ForEach-Object { + # The following values are expected for `$_.FullName`. + # - D:/Programming/rust/dar-to-oar/test/data/Modern Female Sitting Animations Overhaul + # - D:/Programming/rust/dar-to-oar/test/data/UNDERDOG Animations + + # The following values are expected for `$_.Name`. + # - Modern Female Sitting Animations Overhaul + # - UNDERDOG Animations + cargo run --release -- ` + --src $_.FullName ` + --run-parallel ` + --log-level "info" ` + --log-path "$base_dir/logs/convert-$($_.Name).log" +}