RaceMenu provides an API allowing you to add new sliders to Skyrim's racemenu without modifying existing RaceMenu or interface files.
To define new sliders you need the following components:
- A set of Tris with keyframes corresponding to the facial morphs you are adding
- A set of definition files to map these Tris and their keyframes to slider variables and import them as resources available to RaceMenu
- Translation files to expose language mapped definitions to the slider variables
Creating the Tris
I'd recommend using the Tri editing programs from Animation Tools N2. Alternatively Blender has some available plugins for Tri creation. The instructions provided here make use of the N2 tools.
A valid Tri consists of the following parts:
- .obj defining the base shape of the part being morphed
- .objs corresponding to the "hi" and "low" morphs of the base shape
- numbered .objs corresponding to preset shape configurations of the base shape (think nose and eye shapes)
- A text file defining all the morphs and presets that can be applied to the base shape
Once you've collected all your base .objs you'll need to name them correctly to be combined into a tri.
There should be 1 .obj corresponding to the base shape called <Base>
There should be 2 or more .objs corresponding to hi and low morphs called <MorphNameLow> and <MorphNameHi>
If defining presets there should be 1 or more .objs corresponding to those presets called <PresetName#>. The value of # begins and 1 and increments by 1 for each additional preset option available.
Create a .txt file encoded in UTF-8 NO BOM. Add the fully qualified path to each of your above ,objs. The .obj corresponding to the base shape should always be on the first line. There must be an empty last line in the file.
At this point you should have a set of files that looks like this
MyBaseShape.obj
MyBaseShape.txt
MyBaseShape_LowKeyframe.obj
MyBaseShape_HiKeyframe.obj
Note the use use of underscores to split the base shape name from the keyframe.
Drag your .txt file over to TriCreator.exe and wait for the process to complete. Repeat for all your tris.
Registering Resources
Before RaceMenu can recognize your .tris you need to make them available to the framework.
To register your new tris create a new file under \meshes\actors\character\facegenmorphs\<your plugin name>\ called "morphs.ini"
Inside the ini add extension lines corresponding to the face part that your .tri is modifying. For example in my mod one line is
extension = Actors\Character\Character Assets\EyesMaleCharGen.tri, spg\SPG_EyesMale.tri
which loads the .tri file associated with eyes on the male characeter.
NOTE: You must always include the vanilla extensions (eg. EyesMaleCharGen.tri) or your sliders will not work.
Defining Valid Races
Create an ini file under \meshes\actors\character\facegenmorphs\<your plugin name>\ called "races.ini".
This file defines which sliders are available to each race through your addon. I'd recommend looking at the one bundled with RaceMenu as it is the most complete and self explanatory.
Defining Your Sliders
With our assets registered we now need to define how our sliders will interact with these assets.
In the previous section you defined what sliders are available to each race.
Now go to \meshes\actors\character\facegenmorphs\<your plugin name>\sliders\ and create a new ini file corresponding to the definitions used in races.ini. Most likely you'll need "human.ini" and "beast.ini" files.
Add [Male]. [Female} and required sections.
Under each section, each new line will define a new slider. Look at the comments at the top of the human.ini file in this mod. Compare these to the format used in the uncommented sections of the file. You can see that each line follows the same syntax:
<Slider Variable Name> = <Category>, <Slider Type>, <Low Morph Keyframe>, <Hi Morph Keyframe>/<Number of Available Presets>
When you save a preset, RaceMenu saves the value of <Slider Variable Name> to the preset file. This is why presets will work across different game languages.
The Category determines if the slider is a morph slider (eg. Eye Height) or a preset slider (eg, Eye Type).
Low and High Keyframes map to the file names you gave your .objs earlier when you were creating the tris.
Create and complete a line for each slider you are adding and save in UTF-8 NO BOM.
Mapping Variables to Language
Create a new txt file under interface\translations\ called <your plugin name>_<language>.txt
For example "ece sliders for racemenu_english.txt"
This file maps the Slider Variables we defined in the previous section (such as in the human.ini file) to language in the RaceMenu interface. It must be encoded as UTF-16 WITH BOM.
Empty lines are ignored so you can format your file to make it a bit more readable. Lines with data should be formatted as follows:
$<Slider Variable Name> *implicit tab, no spaces* <Name of the Slider>
Create one data line for each slider variable that you defined in human.ini, beast.ini, etc.
Genders share the same variable names so there won't be as many lines in this file.
Wrapping Up
Create an empty plugin with file name <your plugin name>. If you're in Skyrim SE/AE be sure to add the ESL flag so it doesn't take up plugin space.
Enabling this plugin tells RaceMenu to load and register the resources located in the \meshes\actors\character\facegenmorphs\<your plugin name>\ folder.
Launch your game and open RaceMenu, if you did everything right your sliders should appear under their respective categories.
1 comment