C++ NIF library for the Gamebryo/NetImmerse File Format

Related tags

Utilities nifly
Overview

nifly

C++ NIF library for the Gamebryo/NetImmerse File Format.
Created with a clean-room design.

CMake

Features

  • Reading and writing NIF files (Gamebryo/NetImmerse File Format)
  • Cross platform
  • Lots of helper functions
  • Includes basics often used with 3D meshes
  • Unknown NIF blocks are kept untouched
  • No external dependencies except for the test framework

Usage/Building

  • C++ 17 compiler required
  • CMake lists included, or simply include the headers/source in your project
  • To get Catch2, install the CMake package (or vcpkg):
git clone -b v2.x https://github.com/catchorg/Catch2.git
cd Catch2
cmake -Bbuild -H. -DBUILD_TESTING=OFF
cmake --build build/ --target install  #with admin elevation (or sudo) depending on your cmake prefix path

Libraries used

Used by

Credits

This library would not have been possible without the help of:

Comments
  • Templated kd_tree's index type

    Templated kd_tree's index type

    This change is necessary for kd_tree to be able to handle more than 65536 points, which could happen if it's processing a list of triangle centers (since triangle indices are not limited to 65536).

    Unfortunately, this change will probably result in warnings being generated about uint32_t being converted to uint16_t.

    opened by sts1skj 7
  • Issue handling trailing empty segments

    Issue handling trailing empty segments

    Hey, I have a small thing to report:

    For FO4, if you define a set of, say, 7 segments and assign all the tris to the 4th (so 5-7 are empty) then nifly will assign all those tris to the last segment, not the 4th.

    Arguably, this is a case where if you do stupid things, stupid things happen. I found it because all the body parts in FO4 use the same segmentation scheme: 7 segments representing nothing, head, right arm, torso, left arm, right leg, left leg, in that order. So I just defined all the segments and assigned faces as needed. Some of the armors only needed a torso segment, leaving segments 5-7 empty. Took me quite a while to figure out what was going on.

    I dug into the nifly code and the issue is below, in geometry.cpp, SetSegmentation(). The original code is commented out below. It was searching for the last filled part, but the trailing empty segments were confusing it. Capturing lastFilledPart during the first loop fixed the problem. (I can submit this as a pull req if you'd prefer, but I wasn't sure you'd even consider it a real bug.)

    size_t lastFilledPart = 0; for (int i = 0; i < static_cast<int>(triInds.size()); ++i) while (triParts[triInds[i]] >= j) { lastFilledPart = j; partTriInds[j++] = i; };

    //for (size_t i = 0; i < partTriInds.size(); i++) // if (partTriInds[i] > 0) // lastFilledPart = i;

    opened by BadDogSkyrim 7
  • Added MatTransform functions; added constexpr to Object3d.hpp

    Added MatTransform functions; added constexpr to Object3d.hpp

    • Added functions to MatTransform: ToGLMMatrix, ApplyTransformToDiff, ApplyTransformToDir, and ApplyTransformToDist.
    • Made MatTransform::ApplyTransform an inline function.
    • Added some constructors for Matrix3.
    • Made many of the functions in Object3d.hpp constexpr. For some, this necessitated changes to the implementation in order to comply with the rules for constexpr functions, but in no case was functionality changed. I was not thorough; there are lots of functions that could still be made constexpr.
    opened by sts1skj 6
  • static library size is too big.

    static library size is too big.

    Hello! When I'm building nifly DLL as a static library, it's size is 18 mb(in Release mode). Is this normal or am I doing something wrong? I previously used cmake-gui to build the .sln project. This is my first time building dependencies on other libraries so I'd appreciate help with this.

    opened by TommInfinite 5
  • Minor inconsistency of parameters in

    Minor inconsistency of parameters in "Get/Set...ForShape" methods of NifFile class

    Almost all "Get/Set...ForShape" methods of NifFile class identify the shape by its pointer:

    const std::vector<Vector3>* GetVertsForShape(NiShape* shape);
    const std::vector<Vector3>* GetNormalsForShape(NiShape* shape);
    and so on
    

    But a couple of "Colors" methods go with the name of the shape instead:

    const std::vector<Color4>* GetColorsForShape(const std::string& shapeName);
    void SetColorsForShape(const std::string& shapeName, const std::vector<Color4>& colors);
    

    And this is a bit confusing. I would suggest adding NiShape* shape overloads of these two for consistency and predictability.

    opened by gavrant 4
  • Fix the bugs in SetSegmentation, both the original and new

    Fix the bugs in SetSegmentation, both the original and new

    The original (written by me) had two bugs. One would make the code segfault if a partition number in inTriParts was negative; it was probably never triggered. The main bug would cause all triangle segment assignments to be lost if there was an empty partition at the end of the list.

    Two commits were added to this code over the past two years to try to fix the empty-partition-at-end bug and additional bugs introduced in those commits: eae5755 and https://github.com/ousnius/nifly/commit/bb1f7a6f56f045ddb321b329a3bfc8542b5eaa92. Neither fixed the original bug, and each had problems: the resulting code would tend to reassign triangles in some circumstances. So I reverted both of those commits and fixed the original bug.

    The mistakes in the two bug-fix commits suggest that the original code was unclear. I've tried to make it more clear by adding comments, renaming variables, and deleting blank lines that made closely related code seem unrelated.

    opened by sts1skj 4
  • FO76 - NifFile::GetTextureSlot returning empty strings

    FO76 - NifFile::GetTextureSlot returning empty strings

    Hello!

    I know Fallout 76 isn't fully supported as of now, but I did some testing with a modified version of PyNifly and found most models, skeletons, and etc seem to load perfectly. The only issue I've come across so far is that texture are not populated correctly it seems. I'd be willing to toss a PR your way if you could give me some pointers on where to get started. 😄

    opened by SK83RJOSH 3
  • Auto-correct env map and external emittance flags in optimization

    Auto-correct env map and external emittance flags in optimization

    For OptimizeFor and SSE NIF Optimizer, add a new option to find mismatching external emittance flags between BSXFlags and shaders and env map shader type without the env map shader flag.

    See https://gitlab.com/G_ka/Cathedral_Assets_Optimizer/-/issues/116

    enhancement 
    opened by ousnius 3
  • request for reuse

    request for reuse

    Hey, I have made a fork of this for use as a git submodule in a separate repository that adds C# adaptation via SWIG. I want to use that SWIG repository to output a Nuget package in support of a planned Synthesis patcher that updates NIF files. I'd like to include a DLL built from my fork, and credit you, in my Nuget package. Is this OK? Thanks for the library.

    opened by SteveTownsend 2
  • Mostly memory management

    Mostly memory management

    For review, I suggest looking at each commit individually.

    For 05db039 (memory management), I suggest you do not look at the headers. It's only noise, the real changes are in the source files

    Going to test the changes soon

    opened by Guekka 2
  • NifFile::SetVertsForShape resets shape's flags under certain conditions

    NifFile::SetVertsForShape resets shape's flags under certain conditions

    NifFile::SetVertsForShape calls BSTriShape::Create if shape is a BSTriShape and the size of verts does not match the old number of vertices. And the first thing BSTriShape::Create does is flags = 14; So in my case it resulted in the flags switching to 14 seemingly out of nowhere when I added a vertex here, deleted a vertex there in already existing files/shapes.

    opened by gavrant 1
  • Nifly doesn't read NIFs with skinned meshes without Vertex Weights in NiSkinData properly

    Nifly doesn't read NIFs with skinned meshes without Vertex Weights in NiSkinData properly

    It works in Skyrim SE, it probably works in other games that use a NiSkinPartition too, it works in NifSkope, it works in the NifTools Blender NIF Plugin.

    But it doesn't work properly in any program based on Nifly.

    opened by ja231c 0
Owner
null
C ANSI Library to work with BER-TLV format data.

BER-TLV Challenge Library As requested a shared library(.so) were developed using C programming language to interpret and works with BER-TLV objects.

null 1 Oct 14, 2021
code (written in C) to check day by entering Date in DD/MM/YYYY format

Minimal Calendar Last Updated : Oct. 26, 2021 This code(written in C) can be used to know the day of the entered date in DD/MM/YYYY format. This c

Priyanshu Gupta 1 Oct 29, 2021
convert elf file to single c/c++ header file

elf-to-c-header Split ELF to single C/C++ header file

Musa Ünal 2 Nov 4, 2021
A linux library to get the file path of the currently running shared library. Emulates use of Win32 GetModuleHandleEx/GetModuleFilename.

whereami A linux library to get the file path of the currently running shared library. Emulates use of Win32 GetModuleHandleEx/GetModuleFilename. usag

Blackle Morisanchetto 3 Sep 24, 2022
Locate the current executable and the current module/library on the file system

Where Am I? A drop-in two files library to locate the current executable and the current module on the file system. Supported platforms: Windows Linux

Gregory Pakosz 382 Dec 27, 2022
A small and portable INI file library with read/write support

minIni minIni is a portable and configurable library for reading and writing ".INI" files. At just below 900 lines of commented source code, minIni tr

Thiadmer Riemersma 293 Dec 29, 2022
Small configuration file parser library for C.

libConfuse Introduction Documentation Examples Build & Install Origin & References Introduction libConfuse is a configuration file parser library writ

null 419 Dec 14, 2022
Dead simple C logging library contained in a single header (.h) file

Seethe Logging so simple, you only need to include a single header file. seethe supports 6 different log levels (DEBUG, INFO, NOTICE, WARNING, ERROR,

Jason Nguyen 28 Nov 24, 2022
Simple .INI file parser in C, good for embedded systems

inih (INI Not Invented Here) inih (INI Not Invented Here) is a simple .INI file parser written in C. It's only a couple of pages of code, and it was d

Ben Hoyt 1.9k Jan 2, 2023
ini file parser

Iniparser 4 I - Overview This modules offers parsing of ini files from the C level. See a complete documentation in HTML format, from this directory o

Nicolas D 845 Jan 1, 2023
Beacon Object File (BOF) for remote process injection via thread hijacking

cThreadHijack ___________.__ .______ ___ .__ __ __ ___\__ ___/| |_________ ____ _____

Connor McGarr 158 Dec 28, 2022
A Cobalt Strike Beacon Object File (BOF) project which uses direct system calls to enumerate processes for specific loaded modules or process handles.

FindObjects-BOF A Cobalt Strike Beacon Object File (BOF) project which uses direct system calls to enumerate processes for specific modules or process

Outflank B.V. 247 Dec 28, 2022
A Beacon Object File (BOF) for Cobalt Strike which uses direct system calls to enable WDigest credential caching.

WdToggle A Proof of Concept Cobalt Strike Beacon Object File which uses direct system calls to enable WDigest credential caching and circumvent Creden

Outflank B.V. 205 Dec 3, 2022
Example of transferring file data over BLE using an Arduino Nano Sense and WebBLE

BLE File Transfer Example of transferring file data over BLE to an Arduino Nano Sense using WebBLE. Overview This is an example of how to use Bluetoot

Pete Warden 33 Dec 19, 2022
featured cs:go internal hack, one file and less than 1000 lines.

singlefile This is a featured CS:GO internal cheat written in less than 1000 lines, and in one C++ file. I encourage you to submit feature suggestions

null 49 Dec 21, 2022
An asynchronous directory file change watcher module for Windows, macOS and Linux wrapped for V

A V module for asynchronously watching for file changes in a directory. The module is essentially a wrapper for septag/dmon. It works for Windows, macOS and Linux.

null 18 Dec 14, 2022
PhysicsFS; a portable, flexible file i/o abstraction.

PhysicsFS; a portable, flexible file i/o abstraction.

Ryan C. Gordon 300 Jan 7, 2023
mpiFileUtils - File utilities designed for scalability and performance.

mpiFileUtils provides both a library called libmfu and a suite of MPI-based tools to manage large datasets, which may vary from large directory trees to large files.

High-Performance Computing 133 Jan 4, 2023
Simple and lightweight pathname parser for C. This module helps to parse dirname, basename, filename and file extension .

Path Module For C File name and extension parsing functionality are removed because it's difficult to distinguish between a hidden dir (ex: .git) and

Prajwal Chapagain 3 Feb 25, 2022