From ec842ca3268d3f4607bf5f3abe85849f0a4924f9 Mon Sep 17 00:00:00 2001
From: Tazpn <tazpn@users.sourceforge.net>
Date: Mon, 17 Nov 2008 05:57:50 +0000
Subject: [PATCH] niflib: Add helper properties to shaders and fix type in
 versions.

---
 include/nif_versions.h                   |  2 +-
 include/obj/BSShaderNoLightingProperty.h |  7 +++++++
 include/obj/BSShaderPPLightingProperty.h |  8 ++++++++
 include/obj/BSShaderProperty.h           | 16 ++++++++++++++++
 include/obj/BSShaderTextureSet.h         | 17 +++++++++++++++++
 include/obj/Lighting30ShaderProperty.h   |  2 ++
 include/obj/SkyShaderProperty.h          |  8 ++++++++
 include/obj/TallGrassShaderProperty.h    |  8 ++++++++
 include/obj/TileShaderProperty.h         |  8 ++++++++
 src/obj/BSShaderNoLightingProperty.cpp   |  8 ++++++++
 src/obj/BSShaderPPLightingProperty.cpp   |  8 ++++++++
 src/obj/BSShaderProperty.cpp             | 16 ++++++++++++++++
 src/obj/BSShaderTextureSet.cpp           | 20 ++++++++++++++++++++
 src/obj/Lighting30ShaderProperty.cpp     |  2 ++
 src/obj/SkyShaderProperty.cpp            |  8 ++++++++
 src/obj/TallGrassShaderProperty.cpp      |  8 ++++++++
 src/obj/TileShaderProperty.cpp           |  8 ++++++++
 17 files changed, 153 insertions(+), 1 deletion(-)

diff --git a/include/nif_versions.h b/include/nif_versions.h
index b491ba9c..4aee3f8f 100644
--- a/include/nif_versions.h
+++ b/include/nif_versions.h
@@ -26,7 +26,7 @@ const unsigned VER_10_2_0_0    = 0x0A020000; /*!< NIF Version 10.2.0.0 */
 const unsigned VER_20_0_0_4    = 0x14000004; /*!< NIF Version 20.0.0.4 */ 
 const unsigned VER_20_0_0_5    = 0x14000005; /*!< NIF Version 20.0.0.4 */ 
 const unsigned VER_20_1_0_3    = 0x14010003; /*!< NIF Version 20.1.0.3 */ 
-const unsigned VER_20_2_0_7    = 0x14010007; /*!< NIF Version 20.2.0.7 */ 
+const unsigned VER_20_2_0_7    = 0x14020007; /*!< NIF Version 20.2.0.7 */ 
 const unsigned VER_20_3_0_3    = 0x14030003; /*!< NIF Version 20.3.0.3 */ 
 const unsigned VER_20_3_0_6    = 0x14030006; /*!< NIF Version 20.3.0.6 */ 
 const unsigned VER_UNSUPPORTED = 0xFFFFFFFF; /*!< Unsupported NIF Version */
diff --git a/include/obj/BSShaderNoLightingProperty.h b/include/obj/BSShaderNoLightingProperty.h
index 163924d4..71aa19f8 100644
--- a/include/obj/BSShaderNoLightingProperty.h
+++ b/include/obj/BSShaderNoLightingProperty.h
@@ -54,6 +54,13 @@ public:
 	NIFLIB_API virtual const Type & GetType() const;
 
 	//--BEGIN MISC CUSTOM CODE--//
+	// The texture glow map.
+	// \return The current value.
+	string GetFileName() const;
+
+	// The texture glow map.
+	// \param[in] value The new value.
+	void SetFileName( const string & value );
 
 	//--END CUSTOM CODE--//
 protected:
diff --git a/include/obj/BSShaderPPLightingProperty.h b/include/obj/BSShaderPPLightingProperty.h
index c4a9b896..0b3b0939 100644
--- a/include/obj/BSShaderPPLightingProperty.h
+++ b/include/obj/BSShaderPPLightingProperty.h
@@ -60,6 +60,14 @@ public:
 
 	//--BEGIN MISC CUSTOM CODE--//
 
+	// Texture Set
+	// \return The current value.
+	Ref<BSShaderTextureSet > GetTextureSet() const;
+
+	// Texture Set
+	// \param[in] value The new value.
+	void SetTextureSet( Ref<BSShaderTextureSet > value );
+
 	//--END CUSTOM CODE--//
 protected:
 	/*! Texture Set */
diff --git a/include/obj/BSShaderProperty.h b/include/obj/BSShaderProperty.h
index c22d720b..97e43666 100644
--- a/include/obj/BSShaderProperty.h
+++ b/include/obj/BSShaderProperty.h
@@ -55,6 +55,22 @@ public:
 
 	//--BEGIN MISC CUSTOM CODE--//
 
+	// Unknown
+	// \return The current value.
+	unsigned short GetFlags() const;
+
+	// Unknown
+	// \param[in] value The new value.
+	void SetFlags( unsigned short value );
+
+	// Unknown (Set to 0x21 for NoLighting, 0x11 for Water)
+	// \return The current value.
+	BSShaderType GetShaderType() const;
+
+	// Unknown (Set to 0x21 for NoLighting, 0x11 for Water)
+	// \param[in] value The new value.
+	void SetShaderType( BSShaderType value );
+
 	//--END CUSTOM CODE--//
 protected:
 	/*! Unknown */
diff --git a/include/obj/BSShaderTextureSet.h b/include/obj/BSShaderTextureSet.h
index c549d5e3..d124f86f 100644
--- a/include/obj/BSShaderTextureSet.h
+++ b/include/obj/BSShaderTextureSet.h
@@ -55,6 +55,23 @@ public:
 
 	//--BEGIN MISC CUSTOM CODE--//
 
+	// Textures
+	// \return The current value.
+	vector<string > GetTextures() const;
+
+	// Textures
+	// \param[in] value The new value.
+	void SetTextures( const vector<string >& value );
+
+	// Textures
+	// \return The current value.
+	string GetTexture( size_t i ) const;
+
+	// Textures
+	// \param[in] i Index of texture to set
+	// \param[in] value The new value.
+	void SetTexture( size_t i, const string& value);
+
 	//--END CUSTOM CODE--//
 protected:
 	/*! Number of Textures */
diff --git a/include/obj/Lighting30ShaderProperty.h b/include/obj/Lighting30ShaderProperty.h
index 2a6560e9..0ba0a982 100644
--- a/include/obj/Lighting30ShaderProperty.h
+++ b/include/obj/Lighting30ShaderProperty.h
@@ -53,6 +53,8 @@ public:
 	 */
 	NIFLIB_API virtual const Type & GetType() const;
 
+	//--This object has no eligable attributes.  No example implementation generated--//
+
 	//--BEGIN MISC CUSTOM CODE--//
 
 	//--END CUSTOM CODE--//
diff --git a/include/obj/SkyShaderProperty.h b/include/obj/SkyShaderProperty.h
index 374d5b13..49bbf5dc 100644
--- a/include/obj/SkyShaderProperty.h
+++ b/include/obj/SkyShaderProperty.h
@@ -55,6 +55,14 @@ public:
 
 	//--BEGIN MISC CUSTOM CODE--//
 
+	// The texture.
+	// \return The current value.
+	string GetFileName() const;
+
+	// The texture.
+	// \param[in] value The new value.
+	void SetFileName( const string & value );
+
 	//--END CUSTOM CODE--//
 protected:
 	/*! Unknown */
diff --git a/include/obj/TallGrassShaderProperty.h b/include/obj/TallGrassShaderProperty.h
index a623f58a..64d87f9c 100644
--- a/include/obj/TallGrassShaderProperty.h
+++ b/include/obj/TallGrassShaderProperty.h
@@ -55,6 +55,14 @@ public:
 
 	//--BEGIN MISC CUSTOM CODE--//
 
+	// Texture file name
+	// \return The current value.
+	string GetFileName() const;
+
+	// Texture file name
+	// \param[in] value The new value.
+	void SetFileName( const string & value );
+
 	//--END CUSTOM CODE--//
 protected:
 	/*! Texture file name */
diff --git a/include/obj/TileShaderProperty.h b/include/obj/TileShaderProperty.h
index 55e8a219..2effcf87 100644
--- a/include/obj/TileShaderProperty.h
+++ b/include/obj/TileShaderProperty.h
@@ -55,6 +55,14 @@ public:
 
 	//--BEGIN MISC CUSTOM CODE--//
 
+	// Texture file name
+	// \return The current value.
+	string GetFileName() const;
+
+	// Texture file name
+	// \param[in] value The new value.
+	void SetFileName( const string & value );
+
 	//--END CUSTOM CODE--//
 protected:
 	/*! Texture file name */
diff --git a/src/obj/BSShaderNoLightingProperty.cpp b/src/obj/BSShaderNoLightingProperty.cpp
index 4519ee89..b5a2cea1 100644
--- a/src/obj/BSShaderNoLightingProperty.cpp
+++ b/src/obj/BSShaderNoLightingProperty.cpp
@@ -118,4 +118,12 @@ std::list<NiObjectRef> BSShaderNoLightingProperty::GetRefs() const {
 
 //--BEGIN MISC CUSTOM CODE--//
 
+string BSShaderNoLightingProperty::GetFileName() const {
+	return fileName;
+}
+
+void BSShaderNoLightingProperty::SetFileName( const string & value ) {
+	fileName = value;
+}
+
 //--END CUSTOM CODE--//
diff --git a/src/obj/BSShaderPPLightingProperty.cpp b/src/obj/BSShaderPPLightingProperty.cpp
index 07f442e0..87e8dac7 100644
--- a/src/obj/BSShaderPPLightingProperty.cpp
+++ b/src/obj/BSShaderPPLightingProperty.cpp
@@ -136,4 +136,12 @@ std::list<NiObjectRef> BSShaderPPLightingProperty::GetRefs() const {
 
 //--BEGIN MISC CUSTOM CODE--//
 
+Ref<BSShaderTextureSet > BSShaderPPLightingProperty::GetTextureSet() const {
+	return textureSet;
+}
+
+void BSShaderPPLightingProperty::SetTextureSet( Ref<BSShaderTextureSet > value ) {
+	textureSet = value;
+}
+
 //--END CUSTOM CODE--//
diff --git a/src/obj/BSShaderProperty.cpp b/src/obj/BSShaderProperty.cpp
index 4d1054ba..109426c8 100644
--- a/src/obj/BSShaderProperty.cpp
+++ b/src/obj/BSShaderProperty.cpp
@@ -114,4 +114,20 @@ std::list<NiObjectRef> BSShaderProperty::GetRefs() const {
 
 //--BEGIN MISC CUSTOM CODE--//
 
+unsigned short BSShaderProperty::GetFlags() const {
+	return flags;
+}
+
+void BSShaderProperty::SetFlags( unsigned short value ) {
+	flags = value;
+}
+
+BSShaderType BSShaderProperty::GetShaderType() const {
+	return shaderType;
+}
+
+void BSShaderProperty::SetShaderType( BSShaderType value ) {
+	shaderType = value;
+}
+
 //--END CUSTOM CODE--//
diff --git a/src/obj/BSShaderTextureSet.cpp b/src/obj/BSShaderTextureSet.cpp
index a9e0e528..be58b30f 100644
--- a/src/obj/BSShaderTextureSet.cpp
+++ b/src/obj/BSShaderTextureSet.cpp
@@ -123,4 +123,24 @@ std::list<NiObjectRef> BSShaderTextureSet::GetRefs() const {
 
 //--BEGIN MISC CUSTOM CODE--//
 
+vector<string > BSShaderTextureSet::GetTextures() const {
+	return textures;
+}
+
+void BSShaderTextureSet::SetTextures( const vector<string >& value ) {
+	textures = value;
+}
+
+string BSShaderTextureSet::GetTexture(size_t i) const {
+	if (i >= textures.size())
+		throw runtime_error("Invalid Texture Index specified");
+	return textures[i];
+}
+
+void BSShaderTextureSet::SetTexture( size_t i, const string& value) {
+	if (i >= textures.size())
+		textures.resize(i+1);
+	textures[i] = value;
+}
+
 //--END CUSTOM CODE--//
diff --git a/src/obj/Lighting30ShaderProperty.cpp b/src/obj/Lighting30ShaderProperty.cpp
index df47be16..054bc9bf 100644
--- a/src/obj/Lighting30ShaderProperty.cpp
+++ b/src/obj/Lighting30ShaderProperty.cpp
@@ -97,6 +97,8 @@ std::list<NiObjectRef> Lighting30ShaderProperty::GetRefs() const {
 	return refs;
 }
 
+//--This object has no eligable attributes.  No example implementation generated--//
+
 //--BEGIN MISC CUSTOM CODE--//
 
 //--END CUSTOM CODE--//
diff --git a/src/obj/SkyShaderProperty.cpp b/src/obj/SkyShaderProperty.cpp
index 6127a43d..407f23a8 100644
--- a/src/obj/SkyShaderProperty.cpp
+++ b/src/obj/SkyShaderProperty.cpp
@@ -108,4 +108,12 @@ std::list<NiObjectRef> SkyShaderProperty::GetRefs() const {
 
 //--BEGIN MISC CUSTOM CODE--//
 
+string SkyShaderProperty::GetFileName() const {
+	return fileName;
+}
+
+void SkyShaderProperty::SetFileName( const string & value ) {
+	fileName = value;
+}
+
 //--END CUSTOM CODE--//
diff --git a/src/obj/TallGrassShaderProperty.cpp b/src/obj/TallGrassShaderProperty.cpp
index 5f957a74..829f1314 100644
--- a/src/obj/TallGrassShaderProperty.cpp
+++ b/src/obj/TallGrassShaderProperty.cpp
@@ -102,4 +102,12 @@ std::list<NiObjectRef> TallGrassShaderProperty::GetRefs() const {
 
 //--BEGIN MISC CUSTOM CODE--//
 
+string TallGrassShaderProperty::GetFileName() const {
+	return fileName;
+}
+
+void TallGrassShaderProperty::SetFileName( const string & value ) {
+	fileName = value;
+}
+
 //--END CUSTOM CODE--//
diff --git a/src/obj/TileShaderProperty.cpp b/src/obj/TileShaderProperty.cpp
index 21e9b61d..9bb553cf 100644
--- a/src/obj/TileShaderProperty.cpp
+++ b/src/obj/TileShaderProperty.cpp
@@ -102,4 +102,12 @@ std::list<NiObjectRef> TileShaderProperty::GetRefs() const {
 
 //--BEGIN MISC CUSTOM CODE--//
 
+string TileShaderProperty::GetFileName() const {
+	return fileName;
+}
+
+void TileShaderProperty::SetFileName( const string & value ) {
+	fileName = value;
+}
+
 //--END CUSTOM CODE--//
-- 
GitLab