Skyrim Special Edition
0 of 0

File information

Last updated

Original upload

Created by

r

Uploaded by

ry14

Virus scan

Safe to use

About this mod

Python automation script for converting bodyslide .nif mesh files to ground meshes for armor/clothing mods.

Permissions and credits
Bodyslide Ground Mesh Generator

The Bodyslide Ground Mesh Generator is an automation tool for the process of generating ground (GND) mesh files for armor/clothing mods. Using Outfit Studio and Python's pywinauto library, this script automates the task of importing, modifying, and exporting .nif files. I am lazy and creating all of the ground meshes manually is incredibly time consuming and boring, so I came up with this solution instead since using vanilla ground meshes looks bad and not using ground meshes also creates problems.

The default movements to put meshes flat against the floor work the best with meshes covering the upper body, and it tries to avoid adjusting shoes/boots meshes by mesh name filtering. This won't be perfect but it will automate most of the annoying work, giving you a minimally viable ground mesh to further adjust or just use as is. Hopefully this saves other people some time!

This includs a config.json for you to point references/filepaths to custom locations, although the default setup will work out of the box.

Prerequisites

Before you begin, ensure you have met the following requirements:

  • Python 3.6 or newer installed on your machine.
  • The pywinauto Python library for automating the Outfit Studio GUI tasks. (I used pywinauto 0.6.8)
  • Basic knowledge of programming/scripting for modding.

Installation

Python Installation

If you don't have Python installed, download the latest Python version from the official website.

Installing pywinauto

To install pywinauto, open your command prompt or terminal and run the following command:

pip install -r requirements.txt

Configuration

Before running the script, you need to adjust several file paths according to your environment and needs:

  • OUTFITSTUDIO_DIR: Path to your Outfit Studio executable. (defaults to using the 32-bit executable, should probably also work on x64)
  • GND_REF_PATH: Path to the ground reference .nif file. (a default rectangle mesh is included)
  • CONVERTING_MESHES_DIR: Directory containing .nif files to be converted. (the default meshes/to_convert included here will work)
  • FINISHED_GND_MESHES_DIR: Output directory for the processed .nif files. (defaults to meshes/output)

These paths can be set in the config.json file, for which a default config is located in the same directory as the script. Here's an example for the default structure of config.json:

{
  "OUTFITSTUDIO_DIR": "D:\\MO2\\Mods\\BodySlide and Outfit Studio\\CalienteTools\\BodySlide\\OutfitStudio.exe",
  "GND_REF_PATH": "meshes\\gnd_ref\\gnd_ref.nif",
  "CONVERTING_MESHES_DIR": "meshes\\to_convert\\",
  "FINISHED_GND_MESHES_DIR": "meshes\\output\\"
}

There are two other json properties that indicate which base shape mesh names to delete, and which names likely indicate footwear meshes and should not be moved down. You can also adjust these if you want.

Adjust the paths in the config.json file to match your setup.

Using the Script

Grab the mesh .nif files that you want to turn into ground meshes and drop them in the meshes/to_convert folder (or somewhere else specified in config.json)

To run the script, follow these steps:

  • Open a powershell prompt or terminal.
  • Navigate to the directory containing the script.
  • Run the script using Python:

python BS_gnd_meshgen.py

Alternatively, you can also run this in a Jupyter Notebook, whichever you prefer.

Once it starts, let Python automate through Outfit Studio. Don't touch it, go take a walk. Once it's done, the files will be in meshes/output (or wherever you pointed them)

Additional Information

Ensure you are using copies of your .nif mesh files before running the script, as it will delete them from the meshes/to_convert folder after the ground meshes have been generated.

This script assumes familiarity with basic Python and command-line usage. If you're new to Python, consider going through introductory tutorials first.

License

MIT License

Misc Credits

This description was converted from markdown with md2nexus by ceejbot. Thanks!