From c3c157a0195e7a3d8ccc4d4bede2a8d7d4401485 Mon Sep 17 00:00:00 2001
From: Shon Ferguson <shonferg@users.sourceforge.net>
Date: Tue, 4 Jul 2006 16:02:15 +0000
Subject: [PATCH] Applied latest XML changes. Split some things that were
 previously part of NIF_IO.h into their own files to make SWIG wrapping work
 better.

---
 NIF_IO.h              | 149 +-----------------------------------------
 gen/AVObject.cpp      |   2 +-
 gen/AVObject.h        |   2 +-
 gen/SkinPartition.cpp |  12 ----
 gen/obj_defines.h     |  21 ++++--
 gen/obj_impl.cpp      |  97 +++++++++++++++------------
 niflib.vcproj         |   8 +++
 pyniflib.i            |   3 +-
 8 files changed, 83 insertions(+), 211 deletions(-)

diff --git a/NIF_IO.h b/NIF_IO.h
index 6b2c2f19..351f06c4 100644
--- a/NIF_IO.h
+++ b/NIF_IO.h
@@ -5,11 +5,11 @@ All rights reserved.  Please see niflib.h for licence. */
 #define _NIF_IO_H
 
 /* INCLUDES */
-#include <iostream>
-#include <iomanip>
 #include <string>
 #include <sstream>
 #include <vector>
+#include "Key.h"
+#include "nif_basic_types.h"
 #include "nif_math.h"
 #include "nif_versions.h"
 namespace Niflib {
@@ -25,19 +25,6 @@ typedef unsigned char	byte;
 typedef unsigned short	ushort;
 typedef unsigned int	uint;
 
-/*! Stores an animation key and the time in the animation that it takes affect. It is a template class so it can hold any kind of data as different blocks key different sorts of information to the animation timeline.*/
-template <class T> 
-struct Key {
-	float time; /*!< The time on the animation timeline that this keyframe takes affect. */ 
-	T data; /*!< The data being keyed to the timeline. */ 
-	T forward_tangent; /*!< A piece of data of the same type as is being keyed to the time line used as the forward tangent in quadratic interpolation.  Ignored if key type is set as something else. */ 
-	T backward_tangent; /*!< A piece of data of the same type as is being keyed to the time line used as the backward tangent in quadratic interpolation.  Ignored if key type is set as something else. */ 
-	float tension; /*!< The amount of tension to use in tension, bias, continuity interpolation.  Ignored if key type is something else.*/
-	float bias; /*!< The amount of bias to use in tension, bias, continuity interpolation.  Ignored if key type is something else.*/
-	float continuity; /*!< The amount of continuity to use in tension, bias, continuity interpolation.  Ignored if key type is something else.*/
-};
-
-
 //! NVector Traits:  Class overridable alloc/release methods
 template<typename T>
 class array_Traits
@@ -185,121 +172,6 @@ private:
    T v_[len_]; //! Vector data
 };
 
-struct HeaderString {
-	string header;
-};
-
-struct ShortString {
-	string str;
-};
-
-//TODO:  This is temporary to make it compile.  Should eventually be adjusted to display 1's and 0's insted of as an int.
-typedef ushort Flags;
-
-/*! Lists the basic texture types availiable from the ITexturingProperty interface*/
-enum TexType {
-	BASE_MAP = 0, /*!< The basic texture used by most meshes. */ 
-	DARK_MAP = 1, /*!< Used to darken the model with false lighting. */ 
-	DETAIL_MAP = 2, /*!< Combined with base map for added detail. */ 
-	GLOSS_MAP = 3, /*!< Allows the glossyness of an object to differ across its surface. */ 
-	GLOW_MAP = 4, /*!< Creates a glowing effect. */ 
-	BUMP_MAP = 5, /*!< Used to make the object appear to have more detail than it really does. */ 
-	DECAL_0_MAP = 6, /*!< For placing images on the object like stickers. */ 
-	DECAL_1_MAP = 7 /*!< For placing images on the object like stickers. */ 
-};
-
-/*! Specifies the availiable texture apply modes.  Affects the way colors are composed together. */
-enum ApplyMode {
-   APPLY_REPLACE = 0, /*!< Replaces existing color */ 
-   APPLY_DECAL = 1, /*!< For placing images on the object like stickers. */ 
-   APPLY_MODULATE = 2, /*!< Modulates existing color. */ 
-   APPLY_HILIGHT = 3, /*!< PS2 Only */
-   APPLY_HILIGHT2 = 4 /*!< PS2 Only */
-};
-
-/*! Specifies the availiable texture clamp modes.  That is, the behavior of pixels outside the range of the texture.*/
-enum TexClampMode {
-	CLAMP_S_CLAMP_T = 0, /*!< Clamp in both directions. */ 
-	CLAMP_S_WRAP_T = 1, /*!< Clamp in the S direction but wrap in the T direction. */ 
-	WRAP_S_CLAMP_T = 2, /*!< Wrap in the S direction but clamp in the T direction. */ 
-	WRAP_S_WRAP_T = 3 /*!< Wrap in both directions. */ 
-};
-
-/*! Specifies the availiable texture filter modes.  That is, the way pixels within a texture are blended together when textures are displayed on the screen at a size other than their original dimentions.*/
-enum TexFilterMode {
-	FILTER_NEAREST = 0, /*!< Simply uses the nearest pixel.  Very grainy. */ 
-	FILTER_BILERP = 1, /*!< Uses bilinear filtering. */ 
-	FILTER_TRILERP = 2, /*!< Uses trilinear filtering. */ 
-	FILTER_NEAREST_MIPNEAREST = 3, /*!< Uses the nearest pixel from the mipmap that is closest to the display size. */ 
-	FILTER_NEAREST_MIPLERP = 4, /*!< Blends the two mipmaps closest to the display size linearly, and then uses the nearest pixel from the result. */ 
-	FILTER_BILERP_MIPNEAREST = 5, /*!< Uses the closest mipmap to the display size and then uses bilinear filtering on the pixels. */ 
-};
-
-/*! Specifies the availiable alpha formats.  That is, the type of alpha blending (transparency) that will be used on a particular texture.*/
-enum AlphaFormat {
-   ALPHA_NONE = 0, /*!< No alpha blending, the texture is fully opaque */ 
-   ALPHA_BINARY = 1, /*!< Texture is either fully transparent or fully opaque.  There are no partially transparent areas. */ 
-   ALPHA_SMOOTH = 2, /*!< Full range of alpha values can be used from fully transparent to fully opaque including all partially transparent values in between. */ 
-   ALPHA_DEFAULT = 3 /*!< Use default setting. */ 
-};
-
-/*!
- * This enum contains all the animation key types used by Niflib.
- */
-enum KeyType {
-	LINEAR_KEY = 1, /*!< Use linear interpolation. */ 
-	QUADRATIC_KEY = 2, /*!< Use quadratic interpolation.  Forward and back tangents will be stored.*/ 
-	TBC_KEY = 3, /*!< Use Tension Bias Continuity interpolation.  Tension, bias, and continuity will be stored.*/ 
-	XYZ_ROTATION_KEY = 4 /*!< For use only with rotation data.  Separate X, Y, and Z keys will be stored instead of using quaternions. */ 
-};
-
-/*!
- * Specifies the pixel format used by the NiPixelData block to store a texture.
- */
-enum PixelFormat {
-	PX_FMT_RGB8 = 0, /*!< 24-bit color: uses 8 bit to store each red, blue, and green component. */
-	PX_FMT_RGBA8 = 1, /*!< 32-bit color with alpha: uses 8 bits to store each red, blue, green, and alpha component. */
-	PX_FMT_PAL8 = 2 /*!< 8-bit palette index: uses 8 bits to store an index into the palette stored in a NiPallete block. */
-};
-
-/*!
- * Specifies the mip map format of a texture.
- */
-enum MipMapFormat {
-	MIP_FMT_NO = 0, /*!< Texture does not use mip maps. */
-	MIP_FMT_YES = 1,/*!< Texture uses mip maps. */
-	MIP_FMT_DEFAULT = 2, /*!< Use default setting. */
-};
-
-/*!
- * Specifies the pixel layout of a texture.  That is, the format of the image data.
- */
-enum PixelLayout {
-	PIX_LAY_PALETTISED = 0, /*!< Texture is in 8-bit paletized format. */
-	PIX_LAY_HIGH_COLOR_16 = 1, /*!< Texture is in 16-bit high color format. */
-	PIX_LAY_TRUE_COLOR_32 = 2, /*!< Texture is in 32-bit true color format. */
-	PIX_LAY_COMPRESSED = 3, /*!< Texture is compressed. */
-	PIX_LAY_BUMPMAP = 4, /*!< Texture is a grayscale bump map. */
-	PIX_LAY_DEFAULT = 5 /*!< Use default setting. */
-};
-
-/*!
- * Specifies what type of light is active on the shape.
- */
-enum VertMode {
-	VERT_MODE_SRC_IGNORE = 0, /*!< Source Ignore. */
-	VERT_MODE_SRC_EMISSIVE = 1, /*!< Source Emissive. */
-	VERT_MODE_SRC_AMB_DIF = 2, /*!< Source Ambient/Diffuse. */
-};
-
-/*!
- * Specifies the light mode.
- */
-enum LightMode {
-	LIGHT_MODE_EMISSIVE = 0, /*!< Emissive. */
-	LIGHT_MODE_EMI_AMB_DIF = 1, /*!< Emissive + Ambient + Diffuse. */
-};
-
 //--IO Functions--//
 
 int BlockSearch( istream& in );
@@ -549,23 +421,6 @@ void NifStream( Key<T> const & key, ostream & file, uint version, int type ) {
 	NifStream( key, file, version, (KeyType)type );
 }
 
-//These operators cause SWIG warnings
-#ifndef SWIG
-template <class T> 
-ostream & operator<<( ostream & out, Key<T> const & val ) {
-	return out << "Time:  " << val.time << endl
-			   << "Data:  " << val.data << endl
-			   << "Forward Tangent:  " << val.forward_tangent << endl
-			   << "Backward Tangent:  " << val.backward_tangent << endl
-			   << "Bias:  " << val.bias << endl
-			   << "Continuity:  " << val.continuity << endl;
-}
-#endif
-
-//Key<Quaternion>
-//void StreamQuatKey( Key<Quaternion> & key, istream& file, uint version, KeyType type );
-//void StreamQuatKey( Key<Quaternion> const & key, ostream& file, uint version, KeyType type );
-
 //The HexString function creates a formatted hex display of the given data for use in printing
 //a debug string for information that is not understood
 string HexString( const byte * src, uint len );
diff --git a/gen/AVObject.cpp b/gen/AVObject.cpp
index 00240675..c5043ade 100644
--- a/gen/AVObject.cpp
+++ b/gen/AVObject.cpp
@@ -6,7 +6,7 @@ All rights reserved.  Please see niflib.h for licence. */
 using namespace Niflib;
 
 //Constructor
-AVObject::AVObject() : object(NULL) {};
+AVObject::AVObject() : avObject(NULL) {};
 
 //Destructor
 AVObject::~AVObject() {};
diff --git a/gen/AVObject.h b/gen/AVObject.h
index 0b183091..beffc877 100644
--- a/gen/AVObject.h
+++ b/gen/AVObject.h
@@ -26,7 +26,7 @@ struct NIFLIB_API AVObject {
 	/*!
 	 * Object reference.
 	 */
-	NiAVObject * object;
+	NiAVObject * avObject;
 };
 
 }
diff --git a/gen/SkinPartition.cpp b/gen/SkinPartition.cpp
index 56c6136d..ee42ad3e 100644
--- a/gen/SkinPartition.cpp
+++ b/gen/SkinPartition.cpp
@@ -9,15 +9,3 @@ SkinPartition::SkinPartition() : numVertices((ushort)0), numTriangles((ushort)0)
 
 //Destructor
 SkinPartition::~SkinPartition() {};
-
-// needs to be moved elsewhere but this will work for now
-ushort SkinPartition::CalcNumTriangles() const {
-   ushort size = 0;
-   if (stripLengths.empty()) {
-      size = (ushort)triangles.size();
-   } else {
-      for (size_t i=0; i<stripLengths.size(); ++i)
-         size += ((ushort)stripLengths[i] - 2);
-   }
-   return size;
-}
\ No newline at end of file
diff --git a/gen/obj_defines.h b/gen/obj_defines.h
index 3b5ac3d7..9ab7c252 100644
--- a/gen/obj_defines.h
+++ b/gen/obj_defines.h
@@ -2118,14 +2118,14 @@ InternalFixLinks( objects, link_stack, version, user_version ); \
 return InternalGetRefs(); \
 
 #define NI_B_SPLINE_BASIS_DATA_MEMBERS \
-uint unknownInt; \
+uint numControlPt; \
 
 #define NI_B_SPLINE_BASIS_DATA_INCLUDE "NiObject.h" \
 
 #define NI_B_SPLINE_BASIS_DATA_PARENT NiObject \
 
 #define NI_B_SPLINE_BASIS_DATA_CONSTRUCT \
- : unknownInt((uint)0) \
+ : numControlPt((uint)0) \
 
 #define NI_B_SPLINE_BASIS_DATA_READ \
 InternalRead( in, link_stack, version, user_version ); \
@@ -2196,14 +2196,23 @@ return InternalGetRefs(); \
 #define NI_B_SPLINE_COMP_TRANSFORM_INTERPOLATOR_MEMBERS \
 Ref<NiBSplineData > data; \
 Ref<NiBSplineBasisData > basisData; \
-array<float,17> unknown4; \
+Vector3 translation; \
+Quaternion rotation; \
+float scale; \
+Vector3 unkVector1; \
+float translateBias; \
+float translateMultiplier; \
+float rotationBias; \
+float rotationMultiplier; \
+float scaleBias; \
+float scaleMultiplier; \
 
 #define NI_B_SPLINE_COMP_TRANSFORM_INTERPOLATOR_INCLUDE "NiBSplineInterpolator.h" \
 
 #define NI_B_SPLINE_COMP_TRANSFORM_INTERPOLATOR_PARENT NiBSplineInterpolator \
 
 #define NI_B_SPLINE_COMP_TRANSFORM_INTERPOLATOR_CONSTRUCT \
- : data(NULL), basisData(NULL) \
+ : data(NULL), basisData(NULL), scale(0.0f), translateBias(0.0f), translateMultiplier(0.0f), rotationBias(0.0f), rotationMultiplier(0.0f), scaleBias(0.0f), scaleMultiplier(0.0f) \
 
 #define NI_B_SPLINE_COMP_TRANSFORM_INTERPOLATOR_READ \
 InternalRead( in, link_stack, version, user_version ); \
@@ -2223,7 +2232,7 @@ return InternalGetRefs(); \
 #define NI_B_SPLINE_DATA_MEMBERS \
 uint unknownInt; \
 mutable uint count; \
-vector< array<byte,2> > unknownData; \
+vector<short > controlPoints; \
 
 #define NI_B_SPLINE_DATA_INCLUDE "NiObject.h" \
 
@@ -2411,7 +2420,7 @@ float stopTime; \
 float unknownFloat2; \
 byte unknownByte; \
 NiControllerManager * manager; \
-string unknownString; \
+string targetName; \
 Ref<NiStringPalette > stringPalette; \
 
 #define NI_CONTROLLER_SEQUENCE_INCLUDE "NiObject.h" \
diff --git a/gen/obj_impl.cpp b/gen/obj_impl.cpp
index 50a3c699..0131e7f8 100644
--- a/gen/obj_impl.cpp
+++ b/gen/obj_impl.cpp
@@ -4409,18 +4409,18 @@ std::list<NiObjectRef> NiBSBoneLODController::InternalGetRefs() const {
 
 void NiBSplineBasisData::InternalRead( istream& in, list<uint> & link_stack, unsigned int version, unsigned int user_version ) {
 	NiObject::Read( in, link_stack, version, user_version );
-	NifStream( unknownInt, in, version );
+	NifStream( numControlPt, in, version );
 }
 
 void NiBSplineBasisData::InternalWrite( ostream& out, map<NiObjectRef,uint> link_map, unsigned int version, unsigned int user_version ) const {
 	NiObject::Write( out, link_map, version, user_version );
-	NifStream( unknownInt, out, version );
+	NifStream( numControlPt, out, version );
 }
 
 std::string NiBSplineBasisData::InternalAsString( bool verbose ) const {
 	stringstream out;
 	out << NiObject::asString();
-	out << "  Unknown Int:  " << unknownInt << endl;
+	out << "  Num Control Pt:  " << numControlPt << endl;
 	return out.str();
 }
 
@@ -4552,9 +4552,16 @@ void NiBSplineCompTransformInterpolator::InternalRead( istream& in, list<uint> &
 	link_stack.push_back( block_num );
 	NifStream( block_num, in, version );
 	link_stack.push_back( block_num );
-	for (uint i1 = 0; i1 < 17; i1++) {
-		NifStream( unknown4[i1], in, version );
-	};
+	NifStream( translation, in, version );
+	NifStream( rotation, in, version );
+	NifStream( scale, in, version );
+	NifStream( unkVector1, in, version );
+	NifStream( translateBias, in, version );
+	NifStream( translateMultiplier, in, version );
+	NifStream( rotationBias, in, version );
+	NifStream( rotationMultiplier, in, version );
+	NifStream( scaleBias, in, version );
+	NifStream( scaleMultiplier, in, version );
 }
 
 void NiBSplineCompTransformInterpolator::InternalWrite( ostream& out, map<NiObjectRef,uint> link_map, unsigned int version, unsigned int user_version ) const {
@@ -4567,9 +4574,16 @@ void NiBSplineCompTransformInterpolator::InternalWrite( ostream& out, map<NiObje
 		NifStream( link_map[StaticCast<NiObject>(basisData)], out, version );
 	else
 		NifStream( 0xffffffff, out, version );
-	for (uint i1 = 0; i1 < 17; i1++) {
-		NifStream( unknown4[i1], out, version );
-	};
+	NifStream( translation, out, version );
+	NifStream( rotation, out, version );
+	NifStream( scale, out, version );
+	NifStream( unkVector1, out, version );
+	NifStream( translateBias, out, version );
+	NifStream( translateMultiplier, out, version );
+	NifStream( rotationBias, out, version );
+	NifStream( rotationMultiplier, out, version );
+	NifStream( scaleBias, out, version );
+	NifStream( scaleMultiplier, out, version );
 }
 
 std::string NiBSplineCompTransformInterpolator::InternalAsString( bool verbose ) const {
@@ -4577,13 +4591,16 @@ std::string NiBSplineCompTransformInterpolator::InternalAsString( bool verbose )
 	out << NiBSplineInterpolator::asString();
 	out << "  Data:  " << data << endl;
 	out << "  Basis Data:  " << basisData << endl;
-	for (uint i1 = 0; i1 < 17; i1++) {
-		if ( !verbose && ( i1 > MAXARRAYDUMP ) ) {
-			out << "<Data Truncated. Use verbose mode to see complete listing.>" << endl;
-			break;
-		};
-		out << "    Unknown4[" << i1 << "]:  " << unknown4[i1] << endl;
-	};
+	out << "  Translation:  " << translation << endl;
+	out << "  Rotation:  " << rotation << endl;
+	out << "  Scale:  " << scale << endl;
+	out << "  Unk Vector 1:  " << unkVector1 << endl;
+	out << "  Translate Bias:  " << translateBias << endl;
+	out << "  Translate Multiplier:  " << translateMultiplier << endl;
+	out << "  Rotation Bias:  " << rotationBias << endl;
+	out << "  Rotation Multiplier:  " << rotationMultiplier << endl;
+	out << "  Scale Bias:  " << scaleBias << endl;
+	out << "  Scale Multiplier:  " << scaleMultiplier << endl;
 	return out.str();
 }
 
@@ -4623,40 +4640,34 @@ void NiBSplineData::InternalRead( istream& in, list<uint> & link_stack, unsigned
 	NiObject::Read( in, link_stack, version, user_version );
 	NifStream( unknownInt, in, version );
 	NifStream( count, in, version );
-	unknownData.resize(count);
-	for (uint i1 = 0; i1 < unknownData.size(); i1++) {
-		for (uint i2 = 0; i2 < 2; i2++) {
-			NifStream( unknownData[i1][i2], in, version );
-		};
+	controlPoints.resize(count);
+	for (uint i1 = 0; i1 < controlPoints.size(); i1++) {
+		NifStream( controlPoints[i1], in, version );
 	};
 }
 
 void NiBSplineData::InternalWrite( ostream& out, map<NiObjectRef,uint> link_map, unsigned int version, unsigned int user_version ) const {
 	NiObject::Write( out, link_map, version, user_version );
-	count = uint(unknownData.size());
+	count = uint(controlPoints.size());
 	NifStream( unknownInt, out, version );
 	NifStream( count, out, version );
-	for (uint i1 = 0; i1 < unknownData.size(); i1++) {
-		for (uint i2 = 0; i2 < 2; i2++) {
-			NifStream( unknownData[i1][i2], out, version );
-		};
+	for (uint i1 = 0; i1 < controlPoints.size(); i1++) {
+		NifStream( controlPoints[i1], out, version );
 	};
 }
 
 std::string NiBSplineData::InternalAsString( bool verbose ) const {
 	stringstream out;
 	out << NiObject::asString();
-	count = uint(unknownData.size());
+	count = uint(controlPoints.size());
 	out << "  Unknown Int:  " << unknownInt << endl;
 	out << "  Count:  " << count << endl;
-	for (uint i1 = 0; i1 < unknownData.size(); i1++) {
-		for (uint i2 = 0; i2 < 2; i2++) {
-			if ( !verbose && ( i2 > MAXARRAYDUMP ) ) {
-				out << "<Data Truncated. Use verbose mode to see complete listing.>" << endl;
-				break;
-			};
-			out << "      Unknown Data[" << i1 << "][" << i2 << "]:  " << unknownData[i1][i2] << endl;
+	for (uint i1 = 0; i1 < controlPoints.size(); i1++) {
+		if ( !verbose && ( i1 > MAXARRAYDUMP ) ) {
+			out << "<Data Truncated. Use verbose mode to see complete listing.>" << endl;
+			break;
 		};
+		out << "    Control Points[" << i1 << "]:  " << controlPoints[i1] << endl;
 	};
 	return out.str();
 }
@@ -5133,7 +5144,7 @@ void NiControllerSequence::InternalRead( istream& in, list<uint> & link_stack, u
 	if ( version >= 0x0A01006A ) {
 		NifStream( block_num, in, version );
 		link_stack.push_back( block_num );
-		NifStream( unknownString, in, version );
+		NifStream( targetName, in, version );
 	};
 	if ( version >= 0x0A020000 ) {
 		NifStream( block_num, in, version );
@@ -5255,7 +5266,7 @@ void NiControllerSequence::InternalWrite( ostream& out, map<NiObjectRef,uint> li
 			NifStream( link_map[StaticCast<NiObject>(manager)], out, version );
 		else
 			NifStream( 0xffffffff, out, version );
-		NifStream( unknownString, out, version );
+		NifStream( targetName, out, version );
 	};
 	if ( version >= 0x0A020000 ) {
 		if ( stringPalette != NULL )
@@ -5303,7 +5314,7 @@ std::string NiControllerSequence::InternalAsString( bool verbose ) const {
 	out << "  Unknown Float 2:  " << unknownFloat2 << endl;
 	out << "  Unknown Byte:  " << unknownByte << endl;
 	out << "  Manager:  " << manager << endl;
-	out << "  Unknown String:  " << unknownString << endl;
+	out << "  Target Name:  " << targetName << endl;
 	out << "  String Palette:  " << stringPalette << endl;
 	return out.str();
 }
@@ -5453,8 +5464,8 @@ void NiDefaultAVObjectPalette::InternalWrite( ostream& out, map<NiObjectRef,uint
 	NifStream( numObjs, out, version );
 	for (uint i1 = 0; i1 < objs.size(); i1++) {
 		NifStream( objs[i1].name, out, version );
-		if ( objs[i1].object != NULL )
-			NifStream( link_map[StaticCast<NiObject>(objs[i1].object)], out, version );
+		if ( objs[i1].avObject != NULL )
+			NifStream( link_map[StaticCast<NiObject>(objs[i1].avObject)], out, version );
 		else
 			NifStream( 0xffffffff, out, version );
 	};
@@ -5468,7 +5479,7 @@ std::string NiDefaultAVObjectPalette::InternalAsString( bool verbose ) const {
 	out << "  Num Objs:  " << numObjs << endl;
 	for (uint i1 = 0; i1 < objs.size(); i1++) {
 		out << "    Name:  " << objs[i1].name << endl;
-		out << "    Object:  " << objs[i1].object << endl;
+		out << "    AV Object:  " << objs[i1].avObject << endl;
 	};
 	return out.str();
 }
@@ -5479,11 +5490,11 @@ void NiDefaultAVObjectPalette::InternalFixLinks( const vector<NiObjectRef> & obj
 		if (link_stack.empty())
 			throw runtime_error("Trying to pop a link from empty stack. This is probably a bug.");
 		if (link_stack.front() != 0xffffffff) {
-			objs[i1].object = DynamicCast<NiAVObject>(objects[link_stack.front()]);
-			if ( objs[i1].object == NULL )
+			objs[i1].avObject = DynamicCast<NiAVObject>(objects[link_stack.front()]);
+			if ( objs[i1].avObject == NULL )
 				throw runtime_error("Link could not be cast to required type during file read. This NIF file may be invalid or improperly understood.");
 		} else
-			objs[i1].object = NULL;
+			objs[i1].avObject = NULL;
 		link_stack.pop_front();
 	};
 }
diff --git a/niflib.vcproj b/niflib.vcproj
index f3a06801..6ce39fc8 100644
--- a/niflib.vcproj
+++ b/niflib.vcproj
@@ -1398,10 +1398,18 @@
 				RelativePath=".\dll_export.h"
 				>
 			</File>
+			<File
+				RelativePath=".\Key.h"
+				>
+			</File>
 			<File
 				RelativePath=".\kfm.h"
 				>
 			</File>
+			<File
+				RelativePath=".\nif_basic_types.h"
+				>
+			</File>
 			<File
 				RelativePath=".\NIF_IO.h"
 				>
diff --git a/pyniflib.i b/pyniflib.i
index 7c894f9c..f9653462 100644
--- a/pyniflib.i
+++ b/pyniflib.i
@@ -316,7 +316,8 @@ POSSIBILITY OF SUCH DAMAGE. */
 		#include "gen/LimitedHingeDescriptor.h"
 	using namespace Niflib;
 %}
-
+%include "Key.h"
+%include "nif_basic_types.h"
 %template(vector_byte) std::vector<Niflib::byte>;
 %template(vector_ushort) std::vector<Niflib::ushort>;
 %template(vector_SkinShape) std::vector<Niflib::SkinShape>;
-- 
GitLab