Permalink
Browse files

Applied patch #2926679: Fix for Model::SetParent

  • Loading branch information...
Rich Mattes
Rich Mattes committed Sep 15, 2010
1 parent 3849dc5 commit 250d5bea6964720a530cdea837530c084d835c75
Showing with 11 additions and 5 deletions.
  1. +11 −5 libstage/model_getset.cc
View
@@ -120,15 +120,21 @@ int Model::SetParent( Model* newparent)
{
// remove the model from its old parent (if it has one)
if( parent )
- EraseAll( this, parent->children );
+ parent->RemoveChild( this );
+ else
+ world->RemoveChild( this );
+ // link from the model to its new parent
+ this->parent = newparent;
if( newparent )
- newparent->children.push_back( this );
+ newparent->AddChild( this );
+ else
+ world->AddModel( this );
- // link from the model to its new parent
- this->parent = newparent;
+ CallCallbacks( CB_PARENT );
- CallCallbacks( CB_PARENT );
+ SetGlobalPose( oldPose ); // Needs to recalculate position due to change in parent
+
return 0; //ok
}

0 comments on commit 250d5be

Please sign in to comment.