Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Add NPCsHead tests suite to detect neck seams #9

Merged
merged 1 commit into from
Jan 18, 2021
Merged
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
Binary file modified Data/AutoTest.esp
Binary file not shown.
2 changes: 1 addition & 1 deletion Data/Source/Scripts/AutoTest_Suite_NPCs.psc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Scriptname AutoTest_Suite_NPCs extends AutoTest_Suite
{
Collection of script functions testing NPCs (using screenshots of nakes actors).
Collection of script functions testing NPCs (using screenshots of naked actors).
This helps in finding issues with missing textures, not fitting body types...
Dependencies:
* ConsoleUtil (https://www.nexusmods.com/skyrimspecialedition/mods/24858)
Expand Down
45 changes: 45 additions & 0 deletions Data/Source/Scripts/AutoTest_Suite_NPCsHead.psc
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
Scriptname AutoTest_Suite_NPCsHead extends AutoTest_Suite_NPCs
{
Collection of script functions testing NPCs head (using screenshots of naked actors).
This helps in finding issues with neck seams
Dependencies:
* ConsoleUtil (https://www.nexusmods.com/skyrimspecialedition/mods/24858)
* SKSE for StringUtil (https://skse.silverlock.org/)
}

int gPreviousFov = 90

; Initialize the script
; [API] This function is mandatory and has to use SetTestType
function InitTests()
SetTestType("NPCsHead")
endFunction

; Prepare the runs of tests
; [API] This function is optional
function BeforeTestsRun()
; Get the fov value so that we can reset it at the end of the tests run
gPreviousFov = Utility.GetINIFloat("fDefault1stPersonFOV:Display")
ConsoleUtil.ExecuteCommand("tgm")
ConsoleUtil.ExecuteCommand("tcai")
ConsoleUtil.ExecuteCommand("tai")
ConsoleUtil.ExecuteCommand("fov 20")
endFunction

; Finalize the runs of tests
; [API] This function is optional
function AfterTestsRun()
ConsoleUtil.ExecuteCommand("fov " + gPreviousFov)
ConsoleUtil.ExecuteCommand("tai")
ConsoleUtil.ExecuteCommand("tcai")
ConsoleUtil.ExecuteCommand("tgm")
endFunction

; Register a screenshot test of a given BaseID
;
; Parameters:
; * *baseId* (Integer): The BaseID to clone and take screenshot
; * *espName* (String): The name of the ESP containing this base ID
function RegisterScreenshotOf(int baseId, string espName)
RegisterNewTest(espName + "/" + baseId)
endFunction
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,39 @@ Example of Run file for this test, in `SKSE\Plugins\StorageUtilData\AutoTest_NPC

![Example of NPCs test](https://raw.githubusercontent.com/Muriel-Salvan/AutoTest/master/docs/npcs_example.jpg)

#### NPCsHead

The `NPCsHead` tests suite will take screenshots of NPCs' head without any inventory.
This is especially useful to detect neck gaps.
Screenshots are taken in the usual game directory, the same way they are taken with the `PrintScreen` key.

The test names used by this suite have the following format: `esp_name/form_id`.
The `form_id` part can be given either directly as decimal, or hexadecimal (in this case it is prefixed with `0x`).
For example: `skyrim.esm/78433` or `skyrim.esm/0x00013261` for the NPC named Beirand in Skyrim Special Edition.

A test run will:
1. Put the player in god mode (as some NPCs can be hostile or knock the Player).
2. Disable Combat AI, so that NPCs should not attack player.
3. Disable Non-combat AI, so that NPCs should not initiate actions.
4. Change fov to 20 (as it is much easier to detect neck seams this way).
5. Teleport the player to the test cell `AutoTest_TestHall`.
6. Summon a copy of the NPC to be tested in front of him, without any inventory.
7. Take a screenshot.

Example of Run file for this test, in `SKSE\Plugins\StorageUtilData\AutoTest_NPCsHead_Run.json`:
```json
{
"stringList": {
"tests_to_run": [
"skyrim.esm/78433",
"skyrim.esm/78434"
]
}
}
```

![Example of NPCsHead test](https://raw.githubusercontent.com/Muriel-Salvan/AutoTest/master/docs/npcshead_example.jpg)

#### Locations

The `Locations` tests suite will teleport the player to a given location and make a small camera circle around.
Expand Down