diff --git a/.gitignore b/.gitignore index 23c75da21..6dbe1446b 100644 --- a/.gitignore +++ b/.gitignore @@ -72,3 +72,6 @@ vc100.pdb # OS [Tt]humbs.db *.DS_Store + +# VSCode +.vscode/ \ No newline at end of file diff --git a/build.bat b/build.bat new file mode 100644 index 000000000..83df21a5c --- /dev/null +++ b/build.bat @@ -0,0 +1,18 @@ +@echo off +SETLOCAL + +set WIN_VER=10.0.20348.0 +set CONFIGURATION=debug + +set QTDIR=C:\Qt\5.15.2\msvc2019_64 +set "MSBUILD_DIR=C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin" + +set "PATH=%QTDIR%\bin;%PATH%" +set "PATH=%MSBUILD_DIR%;%PATH%" + +REM make sure the correct environment variables are set for qmake +call "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x64 %WIN_VER% +REM run qmake +qmake CONFIG+=%CONFIGURATION% WINDOWS_TARGET_PLATFORM_VERSION=%WIN_VER% -Wall -spec win32-msvc -tp vc NifSkope.pro +REM run msbuild +msbuild NifSkope.vcxproj /t:Build /p:Configuration=%configuration% /m:2 \ No newline at end of file diff --git a/build/nif.xml b/build/nif.xml index 832a539e7..ef58996e1 100644 --- a/build/nif.xml +++ b/build/nif.xml @@ -1,106 +1,6 @@ - - - - Dark Age of Camelot - Star Trek: Bridge Commander - Dark Age of Camelot - Dark Age of Camelot, Star Trek: Bridge Commander - {{Munch's Oddysee}}, Oblivion - Freedom Force - {{Morrowind}}, {{Freedom Force}} - Dark Age of Camelot - Civilization IV - Dark Age of Camelot, Civilization IV - {{Culpa Innata}}, Civilization IV, Dark Age of Camelot, Empire Earth II - {{Zoo Tycoon 2}}, Civilization IV, Oblivion - Oblivion - {{Freedom Force vs. the 3rd Reich}}, {{Axis and Allies}}, {{Empire Earth II}}, {{Kohan 2}}, {{Sid Meier's Pirates!}}, Dark Age of Camelot, Civilization IV, Wildlife Park 2, The Guild 2, NeoSteam - Oblivion - Oblivion - {{Pro Cycling Manager}}, {{Prison Tycoon}}, {{Red Ocean}}, {{Wildlife Park 2}}, Civilization IV, Loki - {{Blood Bowl}} - Oblivion - WorldShift - WorldShift - {{WorldShift}} - {{Civilization IV}}, {{Sid Meier's Railroads}}, Florensia, Ragnarok Online 2, IRIS Online - {{Oblivion KF}} - Fallout 3 - {{Oblivion}} - {{Shin Megami Tensei: Imagine}} - {{Florensia}}, Empire Earth III, Atlantica Online, IRIS Online, Wizard101 - Fallout 3, Fallout NV - Fallout 3 - Fallout 3, Fallout NV - Fallout 3, Fallout NV - Fallout 3, Fallout NV - Fallout 3, Fallout NV - Fallout 3, Fallout NV - Fallout 3, Fallout NV - {{Fallout 3}}, {{Fallout NV}} - {{Skyrim}} - {{Skyrim SE}} - {{Fallout 4}} - Fallout 4 (LS_Mirelurk.nif, Screen.nif) - {{Fallout 76}} - {{Empire Earth III}}, {{FFT Online}}, Atlantica Online, IRIS Online, Wizard101 - Emerge - Emerge - Emerge - Emerge - {{Bully SE}}, Warhammer, Lazeska, Howling Sword, Ragnarok Online 2, Divinity 2 (0x10000) - {{Divinity 2}} - MicroVolts, KrazyRain - {{MicroVolts}}, {{IRIS Online}}, {{Ragnarok Online 2}}, KrazyRain, Atlantica Online, Wizard101 - Epic Mickey - Epic Mickey - Epic Mickey 2 - Emerge - Emerge - Rocksmith, Rocksmith 2014 - Ghost In The Shell: First Assault, MapleStory 2 - - - - - - - - - - - - - - - + Commonly used version expressions. @@ -119,6 +19,8 @@ FO3 and later. Skyrim and later. SSE and later. + Fallout 76 and later. + Starfield and later. SSE only. Fallout 4 strictly, excluding stream 132 and 139 in dev files. Fallout 4/76 including dev files. @@ -127,26 +29,28 @@ Bethesda 132 and later. Bethesda 152 and later. Fallout 76 stream 155 only. - Fallout 76 stream 152 and higher + SSE, FO4, FO76 Bethesda 20.2 only. Divinity 2 - - + + + - The set of versions that any Basic, Compound, NiObject, Enum, or Bitflags is restricted to. - + The set of versions that any Basic, Struct, NiObject, Enum, or Bitflags is restricted to. + - - + + + @@ -167,9 +71,17 @@ + + + + + + + + @@ -199,7 +111,7 @@ - + Global Tokens. NOTE: These must be listed after the above tokens so that they replace last. For example, `verexpr` uses these tokens. @@ -207,7 +119,7 @@ - + All Operators except for unary not (!), parentheses, and member of (\) NOTE: These can be ignored entirely by string substitution and dealt with directly. NOTE: These must be listed after the above tokens so that they replace last. For example, `verexpr` uses these tokens. @@ -229,6 +141,116 @@ + + + + + + + Dark Age of Camelot + Star Trek: Bridge Commander + Dark Age of Camelot + Dark Age of Camelot, Star Trek: Bridge Commander + {{Munch's Oddysee}}, Oblivion + Freedom Force + {{Morrowind}}, {{Freedom Force}} + Dark Age of Camelot + Civilization IV + Dark Age of Camelot, Civilization IV + {{Culpa Innata}}, Civilization IV, Dark Age of Camelot, Empire Earth II + {{Zoo Tycoon 2}}, Civilization IV, Oblivion + Oblivion + {{Freedom Force vs. the 3rd Reich}}, {{Axis and Allies}}, {{Empire Earth II}}, {{Kohan 2}}, {{Sid Meier's Pirates!}}, Dark Age of Camelot, Civilization IV, Wildlife Park 2, The Guild 2, NeoSteam + Oblivion + Oblivion + {{Pro Cycling Manager}}, {{Prison Tycoon}}, {{Red Ocean}}, {{Wildlife Park 2}}, Civilization IV, Loki + {{Blood Bowl}} + Oblivion + WorldShift + WorldShift + {{WorldShift}} + {{Civilization IV}}, {{Sid Meier's Railroads}}, Florensia, Ragnarok Online 2, IRIS Online + {{Oblivion KF}}, Oblivion + Oblivion, Fallout 3 + {{Oblivion}} + {{Shin Megami Tensei: Imagine}} + {{Florensia}}, Empire Earth III, Atlantica Online, IRIS Online, Wizard101 + Fallout 3, Fallout NV + Fallout 3 + Fallout 3, Fallout NV + Fallout 3, Fallout NV + Fallout 3, Fallout NV + Fallout 3, Fallout NV + Fallout 3, Fallout NV + Fallout 3, Fallout NV + {{Fallout 3}}, {{Fallout NV}} + {{Skyrim}} + {{Skyrim SE}} + {{Fallout 4}} + Fallout 4 (LS_Mirelurk.nif, Screen.nif) + {{Fallout 76}} + {{Starfield}} + {{Empire Earth III}}, {{FFT Online}}, Atlantica Online, IRIS Online, Wizard101 + QQSpeed + Emerge + Emerge + Emerge + Emerge + {{Bully SE}}, {{LEGO Universe}}, Warhammer, Lazeska, Howling Sword, Ragnarok Online 2, Divinity 2 (0x10000), Digimon Masters Online + {{Divinity 2}} + Fantasy Frontier, Aura Kingdom + {{Fantasy Frontier}}, {{Aura Kingdom}} + MicroVolts, KrazyRain + {{MicroVolts}}, {{IRIS Online}}, {{Ragnarok Online 2}}, KrazyRain, Atlantica Online, Wizard101, Archlord 2 + {{MXM}} + Epic Mickey + Epic Mickey + Epic Mickey 2 + Emerge + Emerge + Rocksmith, Rocksmith 2014 + Ghost In The Shell: First Assault, MapleStory 2 + + + + + + + + + + + + + + + + @@ -263,12 +285,20 @@ An 8-bit character. + + A signed 8-bit integer. + + An unsigned 8-bit integer. + + A float in the range -1.0:1.0, stored as a byte. + + - A boolean; 32-bit from 4.0.0.2, and 8-bit from 4.1.0.1 on. + A boolean; 32-bit up to and including 4.0.0.2, 8-bit from 4.1.0.1 on. @@ -327,6 +357,10 @@ A 32-bit unsigned integer, used to refer to strings in the header. + + Describes the options for the accum root on NiControllerSequence. @@ -544,9 +578,11 @@ - Bethesda Havok. Material descriptor for a Havok shape in Skyrim. + Bethesda Havok. Material descriptor for a Havok shape in Skyrim. CRC32 of the lowercase of the Creation Kit Material Name. + + @@ -559,6 +595,7 @@ + @@ -588,6 +625,7 @@ + @@ -595,6 +633,7 @@ + @@ -603,24 +642,19 @@ + + + + - - - - - @@ -783,10 +817,14 @@ - - - - + + + + + + + + @@ -1395,6 +1433,8 @@ + @@ -1508,10 +1548,10 @@ Flags for NiTimeController - + - + @@ -1520,7 +1560,7 @@ - + Bethesda-only. Always true for weapon blood after FO3. @@ -1609,6 +1649,10 @@ If Layer is CHARCONTROLLER (CC), true means "CC Trigger Only". + + A string of given length. The string length. @@ -1697,7 +1741,7 @@ The distance range where a specific level of detail applies. - Begining of range. + Beginning of range. End of Range. @@ -1722,11 +1766,18 @@ Third coordinate. - + A vector in 3D space (x,y,z). - First coordinate. - Second coordinate. - Third coordinate. + First coordinate. + Second coordinate. + Third coordinate. + + + + A vector in 3D space (x,y,z). + First coordinate. + Second coordinate. + Third coordinate. @@ -1907,9 +1958,9 @@ - + - + @@ -2029,17 +2080,17 @@ The bits of BSVertexDesc that describe the enabled vertex attributes. - @@ -2058,6 +2109,7 @@ + Byte fields for normal, tangent and bitangent map [0, 255] to [-1, 1]. @@ -2066,36 +2118,36 @@ - - - + + + - - - - - + + + + + - + - - - + + + - - - - - + + + + + Skinning data for a submesh, optimized for hardware skinning. Part of NiSkinPartition. Number of vertices in this submesh. - Number of triangles in this submesh. + Number of triangles in this submesh. Number of bones influencing this submesh. Number of strips in this submesh (zero if not stripped). Number of weight coefficients per vertex. The Gamebryo engine seems to work well only if this number is equal to 4, even if there are less than 4 influences per vertex. @@ -2107,7 +2159,7 @@ The vertex weights. The vertex weights. The strip lengths. - Do we have triangle or strip data? + Do we have triangle or strip data? The strips. The strips. The triangles. @@ -2183,15 +2235,22 @@ Furniture marker orientation. Refers to a furnituremarkerxx.nif file. Always seems to be the same as Position Ref 2. Refers to a furnituremarkerxx.nif file. Always seems to be the same as Position Ref 1. - Similar to Orientation, in float form. + Rotation around z-axis in radians. + + + + + + + Bethesda Havok. A triangle with extra data used for physics. The triangle. - Additional havok information on how triangles are welded. + Additional havok information on how triangles are welded. This is the triangle's normal. @@ -2289,7 +2348,7 @@ Motor damping value A factor of the current error to calculate the recovery velocity A constant velocity which is used to recover from errors - Is Motor enabled + Is Motor enabled @@ -2298,8 +2357,8 @@ Maximum motor force Relative stiffness - - Is Motor enabled + + Is Motor enabled @@ -2309,7 +2368,7 @@ Maximum motor force The spring constant in N/m The spring damping in Nsec/m - Is Motor enabled + Is Motor enabled @@ -2493,7 +2552,7 @@ - + @@ -2555,7 +2614,7 @@ Bethesda extension of hkpCompressedMeshShape::BigTriangle. Triangles that don't fit the maximum size. - + @@ -2563,21 +2622,21 @@ A vector that moves the chunk by the specified amount. W is not used. Rotation. Reference point for rotation is bhkRigidBody translation. - + Bethesda extension of hkpCompressedMeshShape::Chunk. A compressed chunk of hkpCompressedMeshShape geometry. Index of material in bhkCompressedMeshShapeData::Chunk Materials Index of another chunk in the chunks list. Index of transformation in bhkCompressedMeshShapeData::Chunk Transforms - - + Number of vertices, multiplied by 3. + Vertex positions in havok coordinates*1000. - + Vertex indices as used by strips. - - - + Length of strips longer than one triangle. + Generally the same as Num Indices field. + @@ -2608,6 +2667,13 @@ + + Abstract object type. @@ -2618,7 +2684,7 @@ - + @@ -2812,7 +2878,7 @@ A good choice is 5% - 20% of the smallest diameter of the object. Motion system? Overrides Quality when on Keyframed? - + The initial deactivator type of the body. How aggressively the engine will try to zero the velocity for slow objects. This does not save CPU. The type of interaction with other objects. @@ -2845,7 +2911,7 @@ Maximal linear velocity. Maximal angular velocity. Motion system? Overrides Quality when on Keyframed? - + The initial deactivator type of the body. How aggressively the engine will try to zero the velocity for slow objects. This does not save CPU. @@ -2950,7 +3016,7 @@ Bethesda extension of hkpBallSocketChainData. A chain of ball and socket constraints. - Should equal (Num Chained Entities - 1) * 2 + Should equal (Num Chained Entities - 1) * 2 Two pivot points A and B for each constraint. High values are harder and more reactive, lower values are smoother. Defines damping strength for the current velocity. @@ -3078,9 +3144,11 @@ Number of bytes for MOPP data. - XYZ: Origin of the object in mopp coordinates. This is the minimum of all vertices in the packed shape along each axis, minus 0.1. + XYZ: Origin of the object in mopp coordinates. This is the minimum of all vertices in the packed shape along each axis, minus the radius of the child bhkPackedNiTriStripsShape/ + bhkCompressedMeshShape. W: The scaling factor to quantize the MOPP: the quantization factor is equal to 256*256 divided by this number. - In Oblivion files, scale is taken equal to 256*256*254 / (size + 0.2) where size is the largest dimension of the bounding box of the packed shape. + In Oblivion and Skyrim files, scale is taken equal to 256*256*254 / (size + 2 * radius) where size is the largest dimension of the bounding box of the packed shape, + and radius is the radius of the child bhkPackedNiTriStripsShape/bhkCompressedMeshShape. Tells if MOPP Data was organized into smaller chunks (PS3) or not (PC) The tree of bounding volume data. @@ -3249,15 +3317,15 @@ - - - - - - - - - + + + + + + + + + @@ -3271,8 +3339,8 @@ - - + + @@ -3319,7 +3387,7 @@ - + bhkNiCollisionObject flags. 0x100 and 0x200 are only for bhkBlendCollisionObject - The data format of components. + The data format of components. Mask 0x00FF0000 to get the number of subfields. Mask 0x0000FF00 to get the size of each subfield. + It's not a bitfield, because the values are not independent. @@ -7090,6 +7170,7 @@ + @@ -7103,6 +7184,9 @@ + + The data stream as binary (fallback if interpretation with arg2 is not implemented). + @@ -7113,15 +7197,15 @@ The regions in the mesh. Regions can be used to mark off submeshes which are independent draw calls. Number of components of the data (matches corresponding field in MeshData). The format of each component in this data stream. - - + + Type of data (POSITION, POSITION_BP, INDEX, NORMAL, NORMAL_BP, TEXCOORD, BLENDINDICES, BLENDWEIGHT, BONE_PALETTE, COLOR, DISPLAYLIST, - MORPH_POSITION, BINORMAL_BP, TANGENT_BP). + MORPH_POSITION, BINORMAL_BP, TANGENT, TANGENT_BP). An extra index of the data. For example, if there are 3 uv maps, @@ -7132,7 +7216,7 @@ Reference to a data stream object which holds the data used by this reference. - Sets whether this stream data is per-instance data for use in hardware instancing. + Sets whether this stream data is per-instance data for use in hardware instancing. The number of submesh-to-region mappings that this data stream has. A lookup table that maps submeshes to regions. @@ -7195,9 +7279,9 @@ - - - + 1 if it has weights, 0 otherwise. + Total number of floats in the bone transform matrices - divide by 16 to get the number of matrices. + Transform matrices corresponding to the bones. Note: Stored transposed to normally. @@ -7268,7 +7352,7 @@ The number of bones referenced by this mesh modifier. Pointers to the bone nodes that affect this skin. The transforms that go from bind-pose space to bone space. - The bounds of the bones. Only stored if the RECOMPUTE_BOUNDS bit is set. + The bounds of the bones. Only stored if the RECOMPUTE_BOUNDS bit is set. @@ -7337,7 +7421,7 @@ - + @@ -7472,15 +7556,15 @@ The force type is set by each derived class and cannot be changed. - - - - - - - - - + + + + + + + + + @@ -7976,7 +8060,7 @@ The name of the NiAVObject serving as the accumulation root. This is where all accumulated translations, scales, and rotations are applied. - + @@ -8032,6 +8116,10 @@ + + Epic Mickey specific block. + + Compressed collision mesh. Points to root node? @@ -8052,7 +8140,7 @@ - + hkpCompressedMeshShape::MaterialType @@ -8098,8 +8186,8 @@ using the default values. Name should be 'INV' (without the quotes). For rotations, a short of "4712" appears as "4.712" but "959" appears as "0.959" meshes\weapons\daedric\daedricbowskinned.nif - - + + Zoom factor. @@ -8152,7 +8240,7 @@ Fallout 4 Tri Shape - + @@ -8188,7 +8276,7 @@ - > + @@ -8424,4 +8512,136 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 01 in the example nifs + + + + + Seemingly always zeros. + Always 3 in tested mesh. + Middle entry seemingly always 10^8, other two the same as LOD Distances + Entries corresponding to LODDistance specification in the block's NiStringExtraData, in the order of 1, 3, 2 + + + + + Guess is that this is the number of LOD entries, but unsure given that there was only one example. + + + + + + + + + Object name. + + + + + + + + + + A KFM without header + + + + + + + + + + + + + + + + diff --git a/src/io/nifstream.cpp b/src/io/nifstream.cpp index 70636dbea..a8c1264f9 100644 --- a/src/io/nifstream.cpp +++ b/src/io/nifstream.cpp @@ -637,7 +637,7 @@ bool NifOStream::write( const NifValue & val ) v[1] = (uint16_t) round(vec->xyz[1]); v[2] = (uint16_t) round(vec->xyz[2]); - return device->write( (char*)v, 6 ) == 3; + return device->write( (char*)v, 6 ) == 6; } case NifValue::tHalfVector3: {