Difference between revisions of "Talk:Static"

From the CreationKit Wiki
Jump to navigation Jump to search
(No difference)

Revision as of 21:53, 4 July 2024

LOD meshes: Auto-populate

When picking LOD meshes, you can click on an "Auto-populate" button. The intended function of this button appears to be as follows, assuming a Static whose normal model path is "Data/Meshes/Foo.nif", the Creation Kit runs the following algorithm:

  • Take the filename (sans extension) of the Static's normal model path: Foo. We'll call this the base filename.
  • Recursively search Data/Meshes/LOD/ and all subfolders.
    • If a directory entry is flagged as "normal" or "archived" (i.e. it's a file and not a folder or something strange), then:
      • For each number n from 0 through 3:
        • If we see a filename of the form basename_LOD_n (e.g. Foo_LOD_0), then use that as the level-specific LOD file for level n.
        • If we see a filename of the form basename_LOD (e.g. Foo_LOD), then use that as the default LOD file.
  • After the search:
    • Let k be the lowest LOD Level for which we found a level-specific LOD file. If k is greater than 0:
      • If we have a default LOD file, then use the default LOD file for all LOD levels from 0 up to (and not including) k.
      • If we don't have a default LOD file, then abort the algorithm now without changing any LOD levels' files.
    • For each number n from k through 3:
      • If there exists a level-specific LOD file for level n, then use that file for LOD level n.
      • Otherwise, use the previous level-specific LOD file we've seen.

All filename checks are case-insensitive.

So for example, if you have a Static whose model path is Marker_Map.NIF, and there exist the following files:

  • Data/meshes/LOD/marker_map_LOD_0.nif
  • Data/meshes/LOD/marker_map_LOD_1.nif

then the first file will be used for LOD level 0, and the second file will be used for LOD levels 1, 2, and 3. However, if you only had map_marker_LOD_1.nif, then none of the files would be used, because the game would fail to find a file for LOD level 0, and you cannot skip LOD levels.

If instead the following files exist:

  • Data/meshes/LOD/marker_map_LOD.nif
  • Data/meshes/LOD/marker_map_LOD_2.nif

then the first file will be used for LOD levels 0 and 1, and the second file will be used for LOD levels 2 and 3.

If instead the following files exist:

  • Data/meshes/LOD/marker_map_LOD_1.nif
  • Data/meshes/LOD/marker_map_LOD_2.nif

then no changes will be made, because this arrangement would result in skipping LOD level 0, and you aren't allowed to skip LOD levels.

There are two problems with this feature:

  • It only checks loose files and folders. It cannot see anything packed in a BSA.
  • It doesn't care about any subfolders in the Static's original model path. If your Static's path is Foo/Bar.nif, then this feature will happily use LOD/yahoo/bar_LOD.nif or LOD/pineapple/under/the/sea/bar_LOD_1.nif. It can even use multiple files nested in different folders for the same form.
    • The feature will use the first LOD file it sees for any given LOD level. It searches folders and files in alphabetical order (per the underlying Windows APIs).
      • That said, the feature can tolerate seeing levels out of order, e.g. finding the Level 1 file before it finds the Level 0 file. It only checks for skipped LOD levels after the file search is done.

DavidJCobb (talk) 22:53, 4 July 2024 (EDT)