Skip to content
Snippets Groups Projects
Commit 786ae3ac authored by Shon Ferguson's avatar Shon Ferguson
Browse files

Fixed a bug that was introduced in the reference bone reference tracking.

parent b7e01947
No related branches found
No related tags found
No related merge requests found
...@@ -1656,11 +1656,13 @@ void NiSkinData::SetBones( vector<blk_ref> bone_blocks ) { ...@@ -1656,11 +1656,13 @@ void NiSkinData::SetBones( vector<blk_ref> bone_blocks ) {
if (node_int == NULL) if (node_int == NULL)
throw runtime_error("Attempted to add a block as a bone that is not a node."); throw runtime_error("Attempted to add a block as a bone that is not a node.");
//---------------Problem Area---------------//
//move the data //move the data
bone_map.insert( pair<IBlock *, Bone>(bone_blocks[i].get_block(), bones[i]) ); bone_map.insert( pair<IBlock *, Bone>(bone_blocks[i].get_block(), bones[i]) );
//Increment reference at bone node site //Increment reference at bone node site
node_int->IncSkinRef(this); node_int->IncSkinRef(this);
//------------------------------------------//
} }
//Clear temporary vector data //Clear temporary vector data
...@@ -1849,9 +1851,9 @@ void NiSkinData::AddBone( blk_ref const & bone, map<int, float> const & in ) { ...@@ -1849,9 +1851,9 @@ void NiSkinData::AddBone( blk_ref const & bone, map<int, float> const & in ) {
node_int->IncSkinRef(this); node_int->IncSkinRef(this);
} }
void NiSkinData::RemoveBoneByPtr( blk_ref const & bone ) { void NiSkinData::RemoveBoneByPtr( IBlock * bone ) {
//Remove bone from internal list //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 //Do not decrement bone node locatoin because it is already dead
} }
......
...@@ -1154,7 +1154,7 @@ public: ...@@ -1154,7 +1154,7 @@ public:
virtual void SetBones( vector<blk_ref> bone_blocks ) = 0; virtual void SetBones( vector<blk_ref> bone_blocks ) = 0;
virtual void RepositionTriShape() = 0; virtual void RepositionTriShape() = 0;
virtual void StraightenSkeleton() = 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 { class NiSkinData : public AData, public ISkinData, public ISkinDataInternal {
...@@ -1184,7 +1184,7 @@ 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 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 RepositionTriShape();
void StraightenSkeleton(); void StraightenSkeleton();
void RemoveBoneByPtr( blk_ref const & bone ); void RemoveBoneByPtr( IBlock * bone );
//ISkinData //ISkinData
vector<blk_ref> GetBones(); // cannot be const, since this changes the reference counts for the bone blocks! vector<blk_ref> GetBones(); // cannot be const, since this changes the reference counts for the bone blocks!
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment