diff --git a/include/ComplexShape.h b/include/ComplexShape.h index 455e971c1b40a1760171d36af13dea13a58f53c7..47c2711a4a09e532ef9c1e24ae10c6f422b2b06b 100644 --- a/include/ComplexShape.h +++ b/include/ComplexShape.h @@ -5,11 +5,9 @@ All rights reserved. Please see niflib.h for license. */ #define _COMPLEX_SHAPE_H_ #include "Ref.h" -#include "obj/BSDismemberSkinInstance.h" -#include "obj/NiSkinPartition.h" #include "nif_math.h" #include "nif_basic_types.h" -#include "gen/BodyPartList.h" +#include "../include/obj/BSDismemberSkinInstance.h" #include <vector> namespace Niflib { @@ -21,7 +19,6 @@ class NiProperty; class NiNode; class NiAVObject; class NiTriBasedGeom; -class BSDismemberSkinInstance; class NiSkinPartition; /*! Marks empty data indices */ diff --git a/src/ComplexShape.cpp b/src/ComplexShape.cpp index b2988dac042066e26f2f279b10e5f789091c6be4..b7b3b6ffae8e978454ae054e56be8b5cf7d10d30 100644 --- a/src/ComplexShape.cpp +++ b/src/ComplexShape.cpp @@ -15,9 +15,16 @@ All rights reserved. Please see niflib.h for license. */ #include "../include/obj/NiSkinData.h" #include "../include/obj/NiTextureProperty.h" #include "../include/gen/SkinWeight.h" +#include "../include/obj/NiSkinPartition.h" +#include "../include/gen/BodyPartList.h" +#include "../include/obj/BSShaderTextureSet.h" +#include "../include/obj/BSLightingShaderProperty.h" #include <stdlib.h> + + + using namespace Niflib; //Wrape these in the Niflib namespace so they don't polute the Class View @@ -379,13 +386,32 @@ void ComplexShape::Merge( NiAVObject * root ) { if ( niProp != NULL ) { niTexProp = DynamicCast<NiTextureProperty>(niProp); } + BSShaderTextureSetRef bsTexProp = NULL; + niProp = (*geom)->GetPropertyByType(BSShaderTextureSet::TYPE); + if(niProp != NULL) { + bsTexProp = DynamicCast<BSShaderTextureSet>(niProp); + } + niProp = (*geom)->getBsProperties()[0]; + if(niProp != NULL && niProp->GetType().IsSameType(BSLightingShaderProperty::TYPE)) { + BSLightingShaderPropertyRef bs_shader = DynamicCast<BSLightingShaderProperty>(niProp); + if(bs_shader->getTextureSet() != NULL) { + bsTexProp = bs_shader->getTextureSet(); + } + } + niProp = (*geom)->getBsProperties()[1]; + if(niProp != NULL && niProp->GetType().IsSameType(BSLightingShaderProperty::TYPE)) { + BSLightingShaderPropertyRef bs_shader = DynamicCast<BSLightingShaderProperty>(niProp); + if(bs_shader->getTextureSet() != NULL) { + bsTexProp = bs_shader->getTextureSet(); + } + } //Create a list of UV sets to check //pair.first = Texture Type //pair.second = UV Set ID vector< pair<TexType, unsigned int> > uvSets; - if ( shapeUVs.size() != 0 && (niTexingProp != NULL || niTexProp != NULL) ) { + if ( shapeUVs.size() != 0 && (niTexingProp != NULL || niTexProp != NULL || bsTexProp != NULL) ) { if ( niTexingProp != NULL ) { //Add the UV set to the list for every type of texture slot that uses it for ( int tex = 0; tex < 8; ++tex ) { @@ -396,7 +422,7 @@ void ComplexShape::Merge( NiAVObject * root ) { uvSets.push_back( pair<TexType, unsigned int>( TexType(tex), td.uvSet ) ); } } - } else if ( niTexProp != NULL ) { + } else if ( niTexProp != NULL || bsTexProp != NULL ) { //Add the base UV set to the list and just use zero. uvSets.push_back( pair<TexType, unsigned int>( BASE_MAP, 0 ) ); } @@ -619,6 +645,10 @@ void ComplexShape::Merge( NiAVObject * root ) { } } } + + for(int x = 0; x < current_body_parts_faces.size(); x++) { + dismemberPartitionsFaces.push_back(current_body_parts_faces[x]); + } } }