diff --git a/NIF_Blocks.cpp b/NIF_Blocks.cpp index 650327ea7d63409a913d1a85b5ef921a70e6114d..9d24e290fe7068700150f0304b0909bd66eccbc5 100644 --- a/NIF_Blocks.cpp +++ b/NIF_Blocks.cpp @@ -1656,11 +1656,13 @@ void NiSkinData::SetBones( vector<blk_ref> bone_blocks ) { if (node_int == NULL) throw runtime_error("Attempted to add a block as a bone that is not a node."); + //---------------Problem Area---------------// //move the data bone_map.insert( pair<IBlock *, Bone>(bone_blocks[i].get_block(), bones[i]) ); //Increment reference at bone node site node_int->IncSkinRef(this); + //------------------------------------------// } //Clear temporary vector data @@ -1849,9 +1851,9 @@ void NiSkinData::AddBone( blk_ref const & bone, map<int, float> const & in ) { node_int->IncSkinRef(this); } -void NiSkinData::RemoveBoneByPtr( blk_ref const & bone ) { +void NiSkinData::RemoveBoneByPtr( IBlock * bone ) { //Remove bone from internal list - bone_map.erase( bone.get_block() ); + bone_map.erase( bone ); //Do not decrement bone node locatoin because it is already dead } diff --git a/NIF_Blocks.h b/NIF_Blocks.h index f7844c23fee5e10f3150b3ce9579fbe42350545f..dcd777e18aa57fe6f6b6968f5d7f25ead609c06f 100644 --- a/NIF_Blocks.h +++ b/NIF_Blocks.h @@ -1154,7 +1154,7 @@ public: virtual void SetBones( vector<blk_ref> bone_blocks ) = 0; virtual void RepositionTriShape() = 0; virtual void StraightenSkeleton() = 0; - virtual void RemoveBoneByPtr( blk_ref const & bone ) = 0; + virtual void RemoveBoneByPtr( IBlock * bone ) = 0; }; class NiSkinData : public AData, public ISkinData, public ISkinDataInternal { @@ -1184,7 +1184,7 @@ class NiSkinData : public AData, public ISkinData, public ISkinDataInternal { void SetBones( vector<blk_ref> bone_blocks ); // not vector<blk_ref> const &, since we must cast the blk_ref's into (non-constant) IBlock * pointers void RepositionTriShape(); void StraightenSkeleton(); - void RemoveBoneByPtr( blk_ref const & bone ); + void RemoveBoneByPtr( IBlock * bone ); //ISkinData vector<blk_ref> GetBones(); // cannot be const, since this changes the reference counts for the bone blocks!